Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

637 lines
34 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. namespace AmplifyShaderEditor
  6. {
  7. public struct Constants
  8. {
  9. /*public readonly static string[] CustomASEStandardArgsMacros =
  10. {
  11. "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Args Macros",
  12. "#define ASE_TEXTURE2D_ARGS(textureName) Texture2D textureName, SamplerState sampler##textureName",
  13. "#define ASE_TEXTURE3D_ARGS(textureName) Texture3D textureName, SamplerState sampler##textureName",
  14. "#define ASE_TEXTURECUBE_ARGS(textureName) TextureCube textureName, SamplerState sampler##textureName",
  15. "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName",
  16. "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName",
  17. "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName",
  18. "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName",
  19. "#else//ASE Args Macros",
  20. "#define ASE_TEXTURE2D_ARGS(textureName) sampler2D textureName",
  21. "#define ASE_TEXTURE3D_ARGS(textureName) sampler3D textureName",
  22. "#define ASE_TEXTURECUBE_ARGS(textureName) samplerCUBE textureName",
  23. "#define ASE_TEXTURE2D_PARAMS(textureName) textureName",
  24. "#define ASE_TEXTURE3D_PARAMS(textureName) textureName",
  25. "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName",
  26. "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName",
  27. "#endif//ASE Args Macros\n"
  28. };
  29. public readonly static string[] CustomASEDeclararionMacros =
  30. {
  31. "#define ASE_TEXTURE2D(textureName) {0}2D(textureName)",
  32. "#define ASE_TEXTURE2D_ARRAY(textureName) {0}2D_ARRAY(textureName)",
  33. "#define ASE_TEXTURE3D(textureName) {0}3D(textureName)",
  34. "#define ASE_TEXTURECUBE(textureName) {0}CUBE(textureName)\n"
  35. };
  36. public readonly static string[] CustomASEStandarSamplingMacrosHelper =
  37. {
  38. "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Sampling Macros",
  39. "#else//ASE Sampling Macros",
  40. "#endif//ASE Sampling Macros\n"
  41. };*/
  42. /*public readonly static string[] CustomASESamplingMacros =
  43. {
  44. "#define ASE_SAMPLE_TEXTURE2D(textureName,{0}coords) {1}2D{2}(textureName,{0}coords)",
  45. "#define ASE_SAMPLE_TEXTURE2D_LOD(textureName, {0}coord2, lod) {1}2D{2}_LOD(textureName, {0}coord2, lod)",
  46. "#define ASE_SAMPLE_TEXTURE2D_BIAS(textureName,{0}coord2, bias) {1}2D{2}_BIAS(textureName,{0}coord2, bias)",
  47. "#define ASE_SAMPLE_TEXTURE2D_GRAD(textureName,{0}coord2, dpdx, dpdy) {1}2D{2}_GRAD(textureName,{0}coord2, dpdx, dpdy)",
  48. "#define ASE_SAMPLE_TEXTURE3D(textureName,{0}coord3) {1}3D{2}(textureName,{0}coord3)",
  49. "#define ASE_SAMPLE_TEXTURE3D_LOD(textureName,{0}coord3, lod) {1}3D{2}_LOD(textureName,{0}coord3, lod)",
  50. "#define ASE_SAMPLE_TEXTURE3D_BIAS(textureName,{0}coord3, bias) {1}3D{2}_BIAS(textureName,{0}coord3, bias)",
  51. "#define ASE_SAMPLE_TEXTURE3D_GRAD(textureName,{0}coord3, dpdx, dpdy) {1}3D{2}_GRAD(textureName,{0}coord3, dpdx, dpdy)",
  52. "#define ASE_SAMPLE_TEXTURECUBE(textureName,{0}coord3) {1}CUBE{2}(textureName,{0}coord3)",
  53. "#define ASE_SAMPLE_TEXTURECUBE_LOD(textureName,{0}coord3, lod) {1}CUBE{2}_LOD(textureName,{0}coord3, lod)",
  54. "#define ASE_SAMPLE_TEXTURECUBE_BIAS(textureName,{0}coord3, bias) {1}CUBE{2}_BIAS(textureName,{0}coord3, bias)\n"
  55. };*/
  56. // SRP
  57. /*public readonly static string[] CustomASESRPArgsMacros =
  58. {
  59. "#define ASE_TEXTURE2D_ARGS(textureName) TEXTURE2D(textureName), SAMPLER(textureName)",
  60. "#define ASE_TEXTURE3D_ARGS(textureName) TEXTURE3D(textureName), SAMPLER(textureName)",
  61. "#define ASE_TEXTURECUBE_ARGS(textureName) TEXTURECUBE(textureName), SAMPLER(textureName)",
  62. "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName",
  63. "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName",
  64. "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName",
  65. "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName\n"
  66. };*/
  67. public readonly static string CustomASEStandardSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName\n";
  68. public readonly static string[] CustomASESRPTextureArrayMacros =
  69. {
  70. "#define ASE_TEXTURE2D_ARRAY_ARGS(textureName) TEXTURE2D_ARRAY_ARGS(textureName,sampler##textureName)\n" ,
  71. "#define ASE_TEXTURE2D_ARRAY_PARAM(textureName) TEXTURE2D_ARRAY_PARAM(textureName,sampler##textureName)\n" ,
  72. "#define ASE_SAMPLE_TEXTURE2D_ARRAY(textureName, coord3) textureName.Sample(sampler##textureName, coord3)",
  73. "#define ASE_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, coord3, lod) textureName.SampleLevel(sampler##textureName, coord3, lod)"
  74. };
  75. public readonly static string CustomASESRPSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName, sampler##textureName\n";
  76. public readonly static string[] CustomSRPSamplingMacros =
  77. {
  78. "#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",
  79. "#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) textureName.SampleGrad(samplerName, coord3, dpdx, dpdy)",
  80. "#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias)",
  81. "#else//3D SRP MACROS",
  82. "#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)",
  83. "#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)",
  84. "#endif//3D SRP MACROS\n"
  85. };
  86. public readonly static Dictionary<TextureType, string> TexDeclarationSRPMacros = new Dictionary<TextureType, string>
  87. {
  88. { TextureType.Texture2D,"TEXTURE2D({0}); SAMPLER(sampler{0});"},
  89. { TextureType.Texture3D,"TEXTURE3D({0}); SAMPLER(sampler{0});"},
  90. { TextureType.Cube,"TEXTURECUBE({0}); SAMPLER(sampler{0});"},
  91. { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0}); SAMPLER(sampler{0});"},
  92. };
  93. public readonly static Dictionary<TextureType, string> SamplerDeclarationSRPMacros = new Dictionary<TextureType, string>
  94. {
  95. { TextureType.Texture2D,"SAMPLER(sampler{0});"},
  96. { TextureType.Texture3D,"SAMPLER(sampler{0});"},
  97. { TextureType.Cube,"SAMPLER(sampler{0});"},
  98. { TextureType.Texture2DArray,"SAMPLER(sampler{0});"},
  99. };
  100. public readonly static Dictionary<TextureType, string> TexDeclarationNoSamplerSRPMacros = new Dictionary<TextureType, string>
  101. {
  102. { TextureType.Texture2D,"TEXTURE2D({0})"},
  103. { TextureType.Texture3D,"TEXTURE3D({0})"},
  104. { TextureType.Cube,"TEXTURECUBE({0})"},
  105. { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0})"},
  106. };
  107. public readonly static Dictionary<TextureType, string> TexSampleSRPMacros = new Dictionary<TextureType, string>
  108. {
  109. { TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}( {1}, {2}, {3} )"},
  110. { TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"},
  111. { TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"},
  112. { TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {2}, {3} )"},
  113. };
  114. public readonly static Dictionary<TextureType, string> TexParams = new Dictionary<TextureType, string>
  115. {
  116. { TextureType.Texture2D,"ASE_TEXTURE2D_PARAMS({0})"},
  117. { TextureType.Texture3D,"ASE_TEXTURE3D_PARAMS({0})"},
  118. { TextureType.Cube,"ASE_TEXTURECUBE_PARAMS({0})"},
  119. { TextureType.Texture2DArray,"ASE_TEXTURE2D_ARRAY_PARAMS({0})"},
  120. };
  121. public readonly static Dictionary<WirePortDataType, TextureType> WireToTexture = new Dictionary<WirePortDataType, TextureType>
  122. {
  123. { WirePortDataType.SAMPLER1D,TextureType.Texture1D},
  124. { WirePortDataType.SAMPLER2D,TextureType.Texture2D},
  125. { WirePortDataType.SAMPLER3D,TextureType.Texture3D},
  126. { WirePortDataType.SAMPLERCUBE,TextureType.Cube},
  127. { WirePortDataType.SAMPLER2DARRAY,TextureType.Texture2DArray},
  128. };
  129. public readonly static Dictionary<TextureType, WirePortDataType> TextureToWire = new Dictionary<TextureType, WirePortDataType>
  130. {
  131. { TextureType.Texture1D,WirePortDataType.SAMPLER1D},
  132. { TextureType.Texture2D,WirePortDataType.SAMPLER2D},
  133. { TextureType.Texture3D, WirePortDataType.SAMPLER3D},
  134. { TextureType.Cube,WirePortDataType.SAMPLERCUBE},
  135. { TextureType.Texture2DArray,WirePortDataType.SAMPLER2DARRAY},
  136. };
  137. // STANDARD
  138. public readonly static string[] CustomASEStandarSamplingMacrosHelper =
  139. {
  140. #if UNITY_2018_1_OR_NEWER
  141. "#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",
  142. #else
  143. "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL)//ASE Sampler Macros",
  144. #endif
  145. "#else//ASE Sampling Macros",
  146. "#endif//ASE Sampling Macros\n"
  147. };
  148. public readonly static string[] CustomASEArraySamplingMacrosRecent =
  149. {
  150. "#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex.Sample(sampler##tex,coord)",
  151. "#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex.SampleLevel(sampler##tex,coord, lod)",
  152. "#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex.SampleBias(sampler##tex,coord,bias)",
  153. "#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex.SampleGrad(sampler##tex,coord,ddx,ddy)",
  154. };
  155. public readonly static string[] CustomASEArraySamplingMacrosOlder =
  156. {
  157. "#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex2DArray(tex,coord)",
  158. "#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex2DArraylod(tex, float4(coord,lod))",
  159. "#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex2DArray(tex,coord)",
  160. "#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex2DArray(tex,coord)",
  161. };
  162. public readonly static string[] CustomASEStandarSamplingMacrosRecent =
  163. {
  164. "#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
  165. "#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
  166. "#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
  167. "#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
  168. "#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
  169. "#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
  170. "#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
  171. "#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
  172. "#define SAMPLE_TEXTURECUBE(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
  173. "#define SAMPLE_TEXTURECUBE_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
  174. "#define SAMPLE_TEXTURECUBE_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
  175. "#define SAMPLE_TEXTURECUBE_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
  176. "#define SAMPLE_TEXTURE2D_ARRAY(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
  177. "#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
  178. "#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
  179. "#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
  180. };
  181. public readonly static string[] CustomASEStandarSamplingMacrosOlder =
  182. {
  183. "#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex2D(tex,coord)",
  184. "#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex2Dlod(tex,float4(coord,0,lod))",
  185. "#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex2Dbias(tex,float4(coord,0,bias))",
  186. "#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex2Dgrad(tex,coord,ddx,ddy)",
  187. "#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex3D(tex,coord)",
  188. "#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex3Dlod(tex,float4(coord,lod))",
  189. "#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex3D(tex,coord)",
  190. "#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex3D(tex,coord)",
  191. "#define SAMPLE_TEXTURECUBE(tex,samplertex,coord) texCUBE(tex,coord)",
  192. "#define SAMPLE_TEXTURECUBE_LOD(tex,samplertex,coord,lod) texCUBElod (tex,half4(coord,lod))",
  193. "#define SAMPLE_TEXTURECUBE_BIAS(tex,samplertex,coord,bias) texCUBE(tex,coord)",
  194. "#define SAMPLE_TEXTURECUBE_GRAD(tex,samplertex,coord,ddx,ddy) texCUBE(tex,coord)",
  195. "#define SAMPLE_TEXTURE2D_ARRAY(tex,samplertex,coord) tex2DArray(tex,coord)",
  196. "#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplertex,coord,lod) tex2DArraylod(tex, float4(coord,lod))",
  197. "#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex2DArray(tex,coord)",
  198. "#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex2DArray(tex,coord)",
  199. };
  200. public readonly static string[] CustomArraySamplingMacros =
  201. {
  202. "#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)//ASE Array Sampler Macros",
  203. "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) UNITY_SAMPLE_TEX2DARRAY (tex,coord)",
  204. "#else//ASE Array Sampler Macros",
  205. "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) tex.SampleGrad (sampler##tex,coord,dx,dy)",
  206. "#endif//ASE Array Sampler Macros\n"
  207. };
  208. public readonly static Dictionary<TextureType, string> TexDeclarationStandardMacros = new Dictionary<TextureType, string>
  209. {
  210. { TextureType.Texture2D,"UNITY_DECLARE_TEX2D({0});"},
  211. { TextureType.Texture3D,"UNITY_DECLARE_TEX3D({0});"},
  212. { TextureType.Cube,"UNITY_DECLARE_TEXCUBE({0});"},
  213. { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY({0});"}
  214. };
  215. public readonly static Dictionary<TextureType, string> TexDeclarationNoSamplerStandardMacros = new Dictionary<TextureType, string>
  216. {
  217. { TextureType.Texture2D,"UNITY_DECLARE_TEX2D_NOSAMPLER({0})"},
  218. { TextureType.Texture3D,"UNITY_DECLARE_TEX3D_NOSAMPLER({0})"},
  219. { TextureType.Cube,"UNITY_DECLARE_TEXCUBE_NOSAMPLER({0})"},
  220. { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY_NOSAMPLER({0})"}
  221. };
  222. public readonly static Dictionary<TextureType, string> TexSampleStandardMacros = new Dictionary<TextureType, string>
  223. {
  224. { TextureType.Texture2D,"UNITY_SAMPLE_TEX2D{0}( {1}, {3} )"},
  225. { TextureType.Texture3D,"UNITY_SAMPLE_TEX3D{0}( {1}, {3} )"},
  226. { TextureType.Cube,"UNITY_SAMPLE_TEXCUBE{0}( {1}, {3} )"},
  227. { TextureType.Texture2DArray,"UNITY_SAMPLE_TEX2DARRAY{0}( {1}, {3} )"}
  228. };
  229. public readonly static Dictionary<TextureType, string> TexSampleSamplerStandardMacros = new Dictionary<TextureType, string>
  230. {
  231. { TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}( {1}, {2}, {3} )"},
  232. { TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"},
  233. { TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"},
  234. { TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {2}, {3} )"}
  235. };
  236. public readonly static Dictionary<TextureType, string> TexSampleStandard = new Dictionary<TextureType, string>
  237. {
  238. { TextureType.Texture2D,"tex2D{0}( {1}, {2} )"},
  239. { TextureType.Texture3D,"tex3D{0}( {1}, {2} )"},
  240. { TextureType.Cube,"texCUBE{0}( {1}, {2} )"},
  241. { TextureType.Texture2DArray,"tex2DArray{0}( {1}, {2} )"}
  242. };
  243. public readonly static char SemiColonSeparator = '@';
  244. public readonly static string AppDataFullName = "appdata_full";
  245. public readonly static string CustomAppDataFullName = "appdata_full_custom";
  246. public readonly static string CustomAppDataFullBody =
  247. "\n\t\tstruct appdata_full_custom\n" +
  248. "\t\t{\n" +
  249. "\t\t\tfloat4 vertex : POSITION;\n" +
  250. "\t\t\tfloat4 tangent : TANGENT;\n" +
  251. "\t\t\tfloat3 normal : NORMAL;\n" +
  252. "\t\t\tfloat4 texcoord : TEXCOORD0;\n" +
  253. "\t\t\tfloat4 texcoord1 : TEXCOORD1;\n" +
  254. "\t\t\tfloat4 texcoord2 : TEXCOORD2;\n" +
  255. "\t\t\tfloat4 texcoord3 : TEXCOORD3;\n" +
  256. "\t\t\tfixed4 color : COLOR;\n" +
  257. "\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n";
  258. public readonly static string IncludeFormat = "#include \"{0}\"";
  259. public readonly static string PragmaFormat = "#pragma {0}";
  260. public readonly static string DefineFormat = "#define {0}";
  261. public readonly static string RenderTypeHelperStr = "RenderType";
  262. public readonly static string RenderQueueHelperStr = "Queue";
  263. public readonly static string DisableBatchingHelperStr = "DisableBatching";
  264. public readonly static string DefaultShaderName = "New Amplify Shader";
  265. public readonly static string UndoReplaceMasterNodeId = "Replacing Master Node";
  266. public readonly static string UnityLightingLib = "Lighting.cginc";
  267. public readonly static string UnityAutoLightLib = "AutoLight.cginc";
  268. public readonly static string UnityBRDFLib = "UnityStandardBRDF.cginc";
  269. public readonly static string LocalValueDecWithoutIdent = "{0} {1} = {2};";
  270. public readonly static string CustomTypeLocalValueDecWithoutIdent = "{0} {1} =({0}){2};";
  271. public readonly static string LocalValueDefWithoutIdent = "{0} {1} {2};";
  272. public readonly static string TilingOffsetFormat = "{0} * {1} + {2}";
  273. public static string InvalidPostProcessDatapath = "__DELETED_GUID_Trash";
  274. //TEMPLATES
  275. public static float PlusMinusButtonLayoutWidth = 15;
  276. public static float NodeButtonSizeX = 16;
  277. public static float NodeButtonSizeY = 16;
  278. public static float NodeButtonDeltaX = 5;
  279. public static float NodeButtonDeltaY = 11;
  280. public readonly static string ReservedPropertyNameStr = "Property name '{0}' is reserved and cannot be used";
  281. public readonly static string NumericPropertyNameStr = "Property name '{0}' is numeric thus cannot be used";
  282. public readonly static string DeprecatedMessageStr = "Node '{0}' is deprecated. Use node '{1}' instead.";
  283. public readonly static string DeprecatedNoAlternativeMessageStr = "Node '{0}' is deprecated and should be removed.";
  284. public readonly static string UndoChangePropertyTypeNodesId = "Changing Property Types";
  285. public readonly static string UndoChangeTypeNodesId = "Changing Nodes Types";
  286. public readonly static string UndoMoveNodesId = "Moving Nodes";
  287. public readonly static string UndoRegisterFullGrapId = "Register Graph";
  288. public readonly static string UndoAddNodeToCommentaryId = "Add node to Commentary";
  289. public readonly static string UndoRemoveNodeFromCommentaryId = "Remove node from Commentary";
  290. public readonly static string UndoCreateDynamicPortId = "Create Dynamic Port";
  291. public readonly static string UndoDeleteDynamicPortId = "Destroy Dynamic Port";
  292. public readonly static string UndoRegisterNodeId = "Register Object";
  293. public readonly static string UndoUnregisterNodeId = "Unregister Object";
  294. public readonly static string UndoCreateNodeId = "Create Object";
  295. public readonly static string UndoPasteNodeId = "Paste Object";
  296. public readonly static string UndoDeleteNodeId = "Destroy Object";
  297. public readonly static string UndoDeleteConnectionId = "Destroy Connection";
  298. public readonly static string UndoCreateConnectionId = "Create Connection";
  299. public readonly static float MenuDragSpeed = -0.5f;
  300. public readonly static string DefaultCustomInspector = "ASEMaterialInspector";
  301. public readonly static string ReferenceTypeStr = "Mode";
  302. public readonly static string AvailableReferenceStr = "Reference";
  303. public readonly static string InstancePostfixStr = " (Reference) ";
  304. public readonly static string ASEMenuName = "Amplify Shader";
  305. public readonly static string LodCrossFadeOption2017 = "dithercrossfade";
  306. public readonly static string UnityShaderVariables = "UnityShaderVariables.cginc";
  307. public readonly static string UnityCgLibFuncs = "UnityCG.cginc";
  308. public readonly static string UnityStandardUtilsLibFuncs = "UnityStandardUtils.cginc";
  309. public readonly static string UnityPBSLightingLib = "UnityPBSLighting.cginc";
  310. public readonly static string UnityDeferredLightLib = "UnityDeferredLibrary.cginc";
  311. public readonly static string ATSharedLibGUID = "ba242738c4be3324aa88d126f7cc19f9";
  312. #if UNITY_5_6_OR_NEWER
  313. public readonly static string CameraDepthTextureValue = "UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture );";
  314. #else
  315. public readonly static string CameraDepthTextureValue = "uniform sampler2D _CameraDepthTexture;";
  316. #endif
  317. //public readonly static string CameraDepthTextureSRPVar = "TEXTURE2D(_CameraDepthTexture);";
  318. //public readonly static string CameraDepthTextureSRPSampler = "SAMPLER(sampler_CameraDepthTexture);";
  319. public readonly static string CameraDepthTextureLWEnabler = "REQUIRE_DEPTH_TEXTURE 1";
  320. public readonly static string CameraDepthTextureTexelSize = "uniform float4 _CameraDepthTexture_TexelSize;";
  321. public readonly static string InstanceIdMacro = "UNITY_VERTEX_INPUT_INSTANCE_ID";
  322. public readonly static string InstanceIdVariable = "UNITY_GET_INSTANCE_ID({0})";
  323. public readonly static string HelpURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor";
  324. //public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes#";
  325. //public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Community_Nodes#";
  326. public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/";
  327. public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/";
  328. public readonly static Color InfiniteLoopColor = Color.red;
  329. public readonly static Color DefaultCategoryColor = new Color( 0.26f, 0.35f, 0.44f, 1.0f );
  330. public readonly static Color NodeBodyColor = new Color( 1f, 1f, 1f, 1.0f );
  331. public readonly static Color ModeTextColor = new Color( 1f, 1f, 1f, 0.25f );
  332. public readonly static Color ModeIconColor = new Color( 1f, 1f, 1f, 0.75f );
  333. public readonly static Color PortTextColor = new Color( 1f, 1f, 1f, 0.5f );
  334. public readonly static Color PortLockedTextColor = new Color( 1f, 1f, 1f, 0.35f );
  335. public readonly static Color BoxSelectionColor = new Color( 0.5f, 0.75f, 1f, 0.33f );
  336. public readonly static Color SpecialRegisterLocalVarSelectionColor = new Color( 0.27f, 0.52f, 1.0f, 1f );
  337. public readonly static Color SpecialGetLocalVarSelectionColor = new Color( 0.2f, 0.8f, 0.4f, 1f );
  338. public readonly static Color NodeSelectedColor = new Color( 0.85f, 0.56f, 0f, 1f );
  339. public readonly static Color NodeDefaultColor = new Color( 1f, 1f, 1f, 1f );
  340. public readonly static Color NodeConnectedColor = new Color( 1.0f, 1f, 0.0f, 1f );
  341. public readonly static Color NodeErrorColor = new Color( 1f, 0.5f, 0.5f, 1f );
  342. public readonly static string NoSpecifiedCategoryStr = "<None>";
  343. public readonly static int MINIMIZE_WINDOW_LOCK_SIZE = 630;
  344. public readonly static int FoldoutMouseId = 0; // Left Mouse Button
  345. public readonly static float SNAP_SQR_DIST = 200f;
  346. public readonly static int INVALID_NODE_ID = -1;
  347. public readonly static float WIRE_WIDTH = 7f;
  348. public readonly static float WIRE_CONTROL_POINT_DIST = 0.7f;
  349. public readonly static float WIRE_CONTROL_POINT_DIST_INV = 1.7f;
  350. public readonly static float IconsLeftRightMargin = 5f;
  351. public readonly static float PropertyPickerWidth = 16f;
  352. public readonly static float PropertyPickerHeight = 16f;
  353. public readonly static float PreviewExpanderWidth = 16f;
  354. public readonly static float PreviewExpanderHeight = 16f;
  355. public readonly static float TextFieldFontSize = 11f;
  356. public readonly static float DefaultFontSize = 15f;
  357. public readonly static float DefaultTitleFontSize = 13f;
  358. public readonly static float PropertiesTitleFontSize = 11f;
  359. public readonly static float MessageFontSize = 40f;
  360. public readonly static float SelectedObjectFontSize = 30f;
  361. public readonly static float PORT_X_ADJUST = 10;
  362. public readonly static float PORT_INITIAL_X = 10;
  363. public readonly static float PORT_INITIAL_Y = 40;
  364. public readonly static float INPUT_PORT_DELTA_Y = 5;
  365. public readonly static float PORT_TO_LABEL_SPACE_X = 5;
  366. public readonly static float NODE_HEADER_HEIGHT = 32;
  367. public readonly static float NODE_HEADER_EXTRA_HEIGHT = 5;
  368. public readonly static float NODE_HEADER_LEFTRIGHT_MARGIN = 10;
  369. public readonly static float MULTIPLE_SELECION_BOX_ALPHA = 0.5f;
  370. public readonly static float RMB_CLICK_DELTA_TIME = 0.1f;
  371. public readonly static float RMB_SCREEN_DIST = 10f;
  372. public readonly static float CAMERA_MAX_ZOOM = 2f;
  373. public readonly static float CAMERA_MIN_ZOOM = 1f;
  374. public readonly static float CAMERA_ZOOM_SPEED = 0.1f;
  375. public readonly static float ALT_CAMERA_ZOOM_SPEED = -0.05f;
  376. public readonly static object INVALID_VALUE = null;
  377. public readonly static float HORIZONTAL_TANGENT_SIZE = 100f;
  378. public readonly static float OUTSIDE_WIRE_MARGIN = 5f;
  379. public readonly static string SubTitleNameFormatStr = "Name( {0} )";
  380. public readonly static string SubTitleSpaceFormatStr = "Space( {0} )";
  381. public readonly static string SubTitleTypeFormatStr = "Type( {0} )";
  382. public readonly static string SubTitleValueFormatStr = "Value( {0} )";
  383. public readonly static string SubTitleConstFormatStr = "Const( {0} )";
  384. public readonly static string SubTitleVarNameFormatStr = "Var( {0} )";
  385. public readonly static string SubTitleRefNameFormatStr = "Ref( {0} )";
  386. public readonly static string CodeWrapper = "( {0} )";
  387. public readonly static string NodesDumpFormat = "{0}:,{1},{2}\n";
  388. public readonly static string TagFormat = " \"{0}\" = \"{1}\"";
  389. public readonly static string LocalVarIdentation = "\t\t\t";
  390. public readonly static string SimpleLocalValueDec = LocalVarIdentation + "{0} {1};\n";
  391. public readonly static string LocalValueDec = LocalVarIdentation + LocalValueDecWithoutIdent + '\n';
  392. public readonly static string LocalValueDef = LocalVarIdentation + "{0} = {1};\n";
  393. public readonly static string CastHelper = "({0}).{1}";
  394. public readonly static string PropertyLocalVarDec = "{0} {1} = {0}({2});";
  395. public readonly static string[] UniformDec = { "uniform {0} {1};", "{0} {1};" };
  396. public readonly static string PropertyValueLabel = "Value( {0} )";
  397. public readonly static string ConstantsValueLabel = "Const( {0} )";
  398. public readonly static string PropertyFloatFormatLabel = "0.###";
  399. public readonly static string PropertyBigFloatFormatLabel = "0.###e+0";
  400. public readonly static string PropertyIntFormatLabel = "0";
  401. public readonly static string PropertyBigIntFormatLabel = "0e+0";
  402. public readonly static string PropertyVectorFormatLabel = "0.##";
  403. public readonly static string PropertyBigVectorFormatLabel = "0.##e+0";
  404. public readonly static string PropertyMatrixFormatLabel = "0.#";
  405. public readonly static string PropertyBigMatrixFormatLabel = "0.#e+0";
  406. public readonly static string NoPropertiesLabel = "No assigned properties";
  407. public readonly static string ValueLabel = "Value";
  408. public readonly static string DefaultValueLabel = "Default Value";
  409. public readonly static string MaterialValueLabel = "Material Value";
  410. public readonly static GUIContent DefaultValueLabelContent = new GUIContent( "Default Value" );
  411. public readonly static GUIContent MaterialValueLabelContent = new GUIContent( "Material Value" );
  412. public readonly static string InputVarStr = "i";//"input";
  413. public readonly static string OutputVarStr = "o";//"output";
  414. public readonly static string CustomLightOutputVarStr = "s";
  415. public readonly static string CustomLightStructStr = "Custom";
  416. public readonly static string VertexShaderOutputStr = "o";
  417. public readonly static string VertexShaderInputStr = "v";//"vertexData";
  418. public readonly static string VertexDataFunc = "vertexDataFunc";
  419. public readonly static string VirtualCoordNameStr = "vcoord";
  420. public readonly static string VertexVecNameStr = "vertexVec";
  421. public readonly static string VertexVecDecStr = "float3 " + VertexVecNameStr;
  422. public readonly static string VertexVecVertStr = VertexShaderOutputStr + "." + VertexVecNameStr;
  423. public readonly static string NormalVecNameStr = "normalVec";
  424. public readonly static string NormalVecDecStr = "float3 " + NormalVecNameStr;
  425. public readonly static string NormalVecFragStr = InputVarStr + "." + NormalVecNameStr;
  426. public readonly static string NormalVecVertStr = VertexShaderOutputStr + "." + NormalVecNameStr;
  427. public readonly static string IncidentVecNameStr = "incidentVec";
  428. public readonly static string IncidentVecDecStr = "float3 " + IncidentVecNameStr;
  429. public readonly static string IncidentVecDefStr = VertexShaderOutputStr + "." + IncidentVecNameStr + " = normalize( " + VertexVecNameStr + " - _WorldSpaceCameraPos.xyz)";
  430. public readonly static string IncidentVecFragStr = InputVarStr + "." + IncidentVecNameStr;
  431. public readonly static string IncidentVecVertStr = VertexShaderOutputStr + "." + IncidentVecNameStr;
  432. public readonly static string WorldNormalLocalDecStr = "WorldNormalVector( " + Constants.InputVarStr + " , {0}( 0,0,1 ))";
  433. public readonly static string VFaceVariable = "ASEVFace";
  434. public readonly static string VFaceInput = "half ASEVFace : VFACE";
  435. public readonly static string ColorVariable = "vertexColor";
  436. public readonly static string ColorInput = "float4 vertexColor : COLOR";
  437. public readonly static string NoStringValue = "None";
  438. public readonly static string EmptyPortValue = " ";
  439. public readonly static string[] OverallInvalidChars = { "\r", "\n", "\\", " ", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" };
  440. public readonly static string[] ShaderInvalidChars = { "\r", "\n", "\\", "\'", "\"", };
  441. public readonly static string[] EnumInvalidChars = { "\r", "\n", "\\", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" };
  442. public readonly static string[] AttrInvalidChars = { "\r", "\n", "\\", ">", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*" };
  443. public readonly static string[] WikiInvalidChars = { "#", "<", ">", "[", "]", "|", "{", "}", "%", "+", "?", "\\", "/", ",", ";", "." };
  444. public readonly static string[,] UrlReplacementStringValues =
  445. {
  446. { " = ", "Equals" },
  447. { " == ", "Equals" },
  448. { " != ", "NotEqual" },
  449. { " \u2260 ", "NotEqual" },
  450. { " > ", "Greater" },
  451. { " \u2265 " , "GreaterOrEqual" },
  452. { " >= ", "GreaterOrEqual" },
  453. { " < ", "Less" },
  454. { " \u2264 ", "LessOrEqual" },
  455. { " <= ", "LessOrEqual" },
  456. { " ", "_" },
  457. { "[", string.Empty },
  458. { "]", string.Empty }
  459. };
  460. public readonly static int UrlReplacementStringValuesLen = UrlReplacementStringValues.Length / 2;
  461. public readonly static string[,] ReplacementStringValues =
  462. {
  463. { " = ", "Equals" },
  464. { " == ", "Equals" },
  465. { " != ", "NotEqual" },
  466. { " \u2260 ", "NotEqual" },
  467. { " > ", "Greater" },
  468. { " \u2265 ", "GreaterOrEqual" },
  469. { " >= ", "GreaterOrEqual" },
  470. { " < ", "Less" },
  471. { " \u2264 ", "LessOrEqual" },
  472. { " <= ", "LessOrEqual" }
  473. };
  474. public readonly static int ReplacementStringValuesLen = ReplacementStringValues.Length / 2;
  475. public readonly static string InternalData = "INTERNAL_DATA";
  476. public readonly static string NoMaterialStr = "None";
  477. public readonly static string OptionalParametersSep = " ";
  478. public readonly static string NodeUndoId = "NODE_UNDO_ID";
  479. public readonly static string NodeCreateUndoId = "NODE_CREATE_UNDO_ID";
  480. public readonly static string NodeDestroyUndoId = "NODE_DESTROY_UNDO_ID";
  481. // Custom node tags
  482. //[InPortBegin:Id:Type:Name:InPortEnd]
  483. public readonly static string CNIP = "#IP";
  484. public readonly static float FLOAT_DRAW_HEIGHT_FIELD_SIZE = 16f;
  485. public readonly static float FLOAT_DRAW_WIDTH_FIELD_SIZE = 45f;
  486. public readonly static float FLOAT_WIDTH_SPACING = 3f;
  487. public readonly static Color LockedPortColor = new Color( 0.3f, 0.3f, 0.3f, 0.5f );
  488. #if UNITY_2018_2_OR_NEWER
  489. public readonly static int[] AvailableUVChannels = { 0, 1, 2, 3, 4, 5, 6, 7 };
  490. public readonly static string[] AvailableUVChannelsStr = { "0", "1", "2", "3", "4", "5", "6", "7"};
  491. public readonly static string AvailableUVChannelLabel = "UV Channel";
  492. public readonly static int[] AvailableUVSets = { 0, 1, 2, 3, 4, 5, 6, 7 };
  493. public readonly static string[] AvailableUVSetsStr = { "1", "2", "3", "4","5", "6", "7", "8" };
  494. public readonly static string AvailableUVSetsLabel = "UV Set";
  495. #else
  496. public readonly static int[] AvailableUVChannels = { 0, 1, 2, 3 };
  497. public readonly static string[] AvailableUVChannelsStr = { "0", "1", "2", "3" };
  498. public readonly static string AvailableUVChannelLabel = "UV Channel";
  499. public readonly static int[] AvailableUVSets = { 0, 1, 2, 3 };
  500. public readonly static string[] AvailableUVSetsStr = { "1", "2", "3", "4" };
  501. public readonly static string AvailableUVSetsLabel = "UV Set";
  502. #endif
  503. public readonly static int[] AvailableUVSizes = { 2, 3, 4 };
  504. public readonly static string[] AvailableUVSizesStr = { "Float 2", "Float 3", "Float 4" };
  505. public readonly static string AvailableUVSizesLabel = "Coord Size";
  506. public readonly static string LineSeparator = "________________________________";
  507. public readonly static Vector2 CopyPasteDeltaPos = new Vector2( 40, 40 );
  508. public readonly static string[] VectorSuffixes = { ".x", ".y", ".z", ".w" };
  509. public readonly static string[] ColorSuffixes = { ".r", ".g", ".b", ".a" };
  510. public const string InternalDataLabelStr = "Internal Data";
  511. public const string AttributesLaberStr = "Attributes";
  512. public const string ParameterLabelStr = "Parameters";
  513. public static readonly string[] ReferenceArrayLabels = { "Object", "Reference" };
  514. public static readonly string[] ChannelNamesVector = { "X", "Y", "Z", "W" };
  515. public static readonly string[] ChannelNamesColor = { "R", "G", "B", "A" };
  516. public static readonly string SamplerFormat = "sampler{0}";
  517. public static readonly string SamplerDeclFormat = "SamplerState {0}";
  518. public static readonly string SamplerDeclSRPFormat = "SAMPLER({0})";
  519. }
  520. }