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.

1437 lines
57 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using System.Text.RegularExpressions;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEditor;
  8. namespace AmplifyShaderEditor
  9. {
  10. [Serializable]
  11. public class TemplateUniquePassData
  12. {
  13. public int SubShaderIdx;
  14. public int PassIdx;
  15. }
  16. [Serializable]
  17. public sealed class TemplateMultiPass : TemplateDataParent
  18. {
  19. [SerializeField]
  20. private List<TemplateShaderPropertyData> m_availableShaderProperties = new List<TemplateShaderPropertyData>();
  21. [SerializeField]
  22. private List<TemplateSubShader> m_subShaders = new List<TemplateSubShader>();
  23. [SerializeField]
  24. private TemplateTagData m_propertyTag;
  25. [SerializeField]
  26. private TemplateIdManager m_templateIdManager;
  27. [SerializeField]
  28. private string m_shaderNameId = string.Empty;
  29. [SerializeField]
  30. private string m_shaderBody;
  31. [SerializeField]
  32. private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer();
  33. [SerializeField]
  34. private TemplateShaderInfo m_shaderData;
  35. [SerializeField]
  36. private bool m_isSinglePass = false;
  37. [SerializeField]
  38. private int m_masterNodesRequired = 0;
  39. [SerializeField]
  40. TemplateInfoContainer m_customInspectorContainer = new TemplateInfoContainer();
  41. [SerializeField]
  42. TemplateInfoContainer m_dependenciesContainer = new TemplateInfoContainer();
  43. [SerializeField]
  44. TemplateInfoContainer m_fallbackContainer = new TemplateInfoContainer();
  45. [SerializeField]
  46. TemplateInfoContainer m_beforePragmaContainer = new TemplateInfoContainer();
  47. [SerializeField]
  48. private CustomTemplatePropertyUIEnum m_customTemplatePropertyUI = CustomTemplatePropertyUIEnum.None;
  49. [SerializeField]
  50. private int m_lodInjectorId = -1;
  51. [SerializeField]
  52. TemplateShaderModelData m_globalShaderModel = new TemplateShaderModelData();
  53. private Dictionary<string, TemplateUniquePassData> m_passUniqueIdData = new Dictionary<string, TemplateUniquePassData>();
  54. public TemplateMultiPass()
  55. {
  56. m_templateType = TemplateDataType.MultiPass;
  57. }
  58. public TemplateMultiPass( string name, string guid, bool isCommunity )
  59. {
  60. m_templateType = TemplateDataType.MultiPass;
  61. Init( name, guid, isCommunity );
  62. }
  63. public override void Init( string name, string guid, bool isCommunity )
  64. {
  65. base.Init( name, guid, isCommunity );
  66. TemplatesManager.CurrTemplateGUIDLoaded = guid;
  67. LoadTemplateBody( guid );
  68. Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name;
  69. }
  70. void LoadTemplateBody( string guid )
  71. {
  72. m_passUniqueIdData.Clear();
  73. m_guid = guid;
  74. string datapath = AssetDatabase.GUIDToAssetPath( guid );
  75. string shaderBody = string.Empty;
  76. shaderBody = IOUtils.LoadTextFileFromDisk( datapath );
  77. shaderBody = shaderBody.Replace( "\r\n", "\n" );
  78. // Insert Before Tag
  79. MatchCollection col = Regex.Matches( shaderBody, TemplateHelperFunctions.BeforePragmaPattern, RegexOptions.Singleline );
  80. for( int i = col.Count - 1; i >= 0; i-- )
  81. {
  82. if( col[ i ].Groups.Count == 3 )
  83. {
  84. shaderBody = shaderBody.Insert( col[ i ].Groups[ 2 ].Index, TemplatesManager.TemplatePragmaBeforeTag + "\n" + col[ i ].Groups[ 1 ].Value );
  85. }
  86. }
  87. //Detect SRP Batcher
  88. MatchCollection srpMatch = Regex.Matches( shaderBody, TemplateHelperFunctions.SRPBatcherFindTag );
  89. for( int i = srpMatch.Count - 1; i >= 0; i-- )
  90. {
  91. if( srpMatch[ i ].Groups.Count == 2 )
  92. {
  93. shaderBody = shaderBody.Insert( srpMatch[ i ].Groups[ 0 ].Index + srpMatch[ i ].Groups[ 0 ].Length, TemplatesManager.TemplateSRPBatcherTag + srpMatch[ i ].Groups[ 1 ].Value );
  94. }
  95. }
  96. // Detect if template has LOD tag, if not, insert one
  97. // It will be read and processed over the TemplateSubShader constructor
  98. {
  99. Match match = Regex.Match( shaderBody, TemplateHelperFunctions.SubShaderLODPattern );
  100. if( match == null || ( match != null && !match.Success ) )
  101. {
  102. MatchCollection subShaderMatch = Regex.Matches( shaderBody, TemplatesManager.TemplateMPSubShaderTag );
  103. int subShaderAmount = subShaderMatch.Count;
  104. for( int i = subShaderAmount - 1; i > -1; i-- )
  105. {
  106. if( subShaderMatch[ i ].Success )
  107. {
  108. shaderBody = shaderBody.Insert( subShaderMatch[ i ].Index + subShaderMatch[ i ].Length, "\n\t\t\tLOD 0\n" );
  109. }
  110. }
  111. }
  112. }
  113. m_shaderData = TemplateShaderInfoUtil.CreateShaderData( shaderBody );
  114. if( m_shaderData == null )
  115. {
  116. m_isValid = false;
  117. return;
  118. }
  119. m_templateIdManager = new TemplateIdManager( shaderBody );
  120. try
  121. {
  122. int nameBegin = shaderBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag );
  123. if( nameBegin < 0 )
  124. {
  125. // Not a template
  126. return;
  127. }
  128. int nameEnd = shaderBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin );
  129. if( nameEnd < 0 )
  130. return;
  131. m_shaderBody = shaderBody;
  132. int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length;
  133. int defaultLength = nameEnd - defaultBegin;
  134. m_defaultShaderName = shaderBody.Substring( defaultBegin, defaultLength );
  135. int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" );
  136. nameIdx[ 0 ] += 1; // Ignore the " character from the string
  137. m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] );
  138. m_shaderNameId = shaderBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin );
  139. m_templateProperties.AddId( shaderBody, m_shaderNameId, false );
  140. m_templateIdManager.RegisterId( nameBegin, m_shaderNameId, m_shaderNameId );
  141. shaderBody = shaderBody.Substring( nameEnd + TemplatesManager.TemplateFullEndTag.Length );
  142. }
  143. catch( Exception e )
  144. {
  145. Debug.LogException( e );
  146. m_isValid = false;
  147. }
  148. m_customTemplatePropertyUI = TemplateHelperFunctions.FetchCustomUI( shaderBody );
  149. TemplateHelperFunctions.FetchDependencies( m_dependenciesContainer, ref m_shaderBody );
  150. if( m_dependenciesContainer.IsValid )
  151. {
  152. int index = m_dependenciesContainer.Id.IndexOf( TemplatesManager.TemplateDependenciesListTag );
  153. m_templateProperties.AddId( new TemplateProperty( m_dependenciesContainer.Id, m_dependenciesContainer.Id.Substring( 0, index ), true ) );
  154. m_templateIdManager.RegisterId( m_dependenciesContainer.Index, m_dependenciesContainer.Id, m_dependenciesContainer.Id );
  155. }
  156. TemplateHelperFunctions.FetchCustomInspector( m_customInspectorContainer, ref m_shaderBody );
  157. if( m_customInspectorContainer.IsValid )
  158. {
  159. int index = m_customInspectorContainer.Id.IndexOf( "CustomEditor" );
  160. m_templateProperties.AddId( new TemplateProperty( m_customInspectorContainer.Id, m_customInspectorContainer.Id.Substring( 0, index ), true ) );
  161. m_templateIdManager.RegisterId( m_customInspectorContainer.Index, m_customInspectorContainer.Id, m_customInspectorContainer.Id );
  162. }
  163. TemplateHelperFunctions.FetchFallback( m_fallbackContainer, ref m_shaderBody );
  164. if( m_fallbackContainer.IsValid )
  165. {
  166. int index = m_fallbackContainer.Id.IndexOf( "Fallback", StringComparison.InvariantCultureIgnoreCase );
  167. m_templateProperties.AddId( new TemplateProperty( m_fallbackContainer.Id, m_fallbackContainer.Id.Substring( 0, index ), true ) );
  168. m_templateIdManager.RegisterId( m_fallbackContainer.Index, m_fallbackContainer.Id, m_fallbackContainer.Id );
  169. }
  170. m_lodInjectorId = m_shaderBody.IndexOf( TemplatesManager.TemplateLODsTag );
  171. // Shader body may have been changed to inject inexisting tags like fallback
  172. m_templateIdManager.ShaderBody = m_shaderBody;
  173. m_propertyTag = new TemplateTagData( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, true );
  174. m_templateIdManager.RegisterId( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, TemplatesManager.TemplatePropertyTag );
  175. m_templateProperties.AddId( shaderBody, TemplatesManager.TemplatePropertyTag, true );
  176. Dictionary<string, TemplateShaderPropertyData> duplicatesHelper = new Dictionary<string, TemplateShaderPropertyData>();
  177. TemplateHelperFunctions.CreateShaderPropertiesList( m_shaderData.Properties, ref m_availableShaderProperties, ref duplicatesHelper );
  178. for( int i = 0; i < m_availableShaderProperties.Count; i++ )
  179. {
  180. m_templateIdManager.RegisterId( m_availableShaderProperties[ i ].Index, m_availableShaderProperties[ i ].FullValue, m_availableShaderProperties[ i ].FullValue );
  181. }
  182. int subShaderCount = m_shaderData.SubShaders.Count;
  183. int mainSubShaderIdx = -1;
  184. int mainPassIdx = -1;
  185. int firstVisibleSubShaderId = -1;
  186. int firstVisiblePassId = -1;
  187. bool foundMainPass = false;
  188. bool foundFirstVisible = false;
  189. m_templateIdManager.RegisterTag( TemplatesManager.TemplatePassesEndTag );
  190. m_templateIdManager.RegisterTag( TemplatesManager.TemplateMainPassTag );
  191. //SHADER MODEL
  192. {
  193. Match shaderModelMatch = Regex.Match( m_shaderData.Properties, TemplateHelperFunctions.ShaderModelPattern );
  194. if( shaderModelMatch != null && shaderModelMatch.Success )
  195. {
  196. if( TemplateHelperFunctions.AvailableInterpolators.ContainsKey( shaderModelMatch.Groups[ 1 ].Value ) )
  197. {
  198. m_globalShaderModel.Id = shaderModelMatch.Groups[ 0 ].Value;
  199. m_globalShaderModel.StartIdx = shaderModelMatch.Index;
  200. m_globalShaderModel.Value = shaderModelMatch.Groups[ 1 ].Value;
  201. m_globalShaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ shaderModelMatch.Groups[ 1 ].Value ];
  202. m_globalShaderModel.DataCheck = TemplateDataCheck.Valid;
  203. }
  204. else
  205. {
  206. m_globalShaderModel.DataCheck = TemplateDataCheck.Invalid;
  207. }
  208. }
  209. }
  210. //
  211. for( int i = 0; i < subShaderCount; i++ )
  212. {
  213. TemplateSubShader subShader = new TemplateSubShader(this, i, m_templateIdManager, "SubShader" + i, m_shaderData.SubShaders[ i ], ref duplicatesHelper );
  214. if( subShader.FoundMainPass )
  215. {
  216. if( !foundMainPass )
  217. {
  218. foundMainPass = true;
  219. mainSubShaderIdx = i;
  220. mainPassIdx = subShader.MainPass;
  221. }
  222. }
  223. else if( subShader.MainPass > -1 )
  224. {
  225. if( !foundFirstVisible )
  226. {
  227. foundFirstVisible = true;
  228. firstVisibleSubShaderId = i;
  229. firstVisiblePassId = subShader.MainPass;
  230. }
  231. }
  232. m_subShaders.Add( subShader );
  233. m_masterNodesRequired += subShader.Passes.Count;
  234. }
  235. if( !foundMainPass && foundFirstVisible )
  236. {
  237. mainSubShaderIdx = firstVisibleSubShaderId;
  238. mainPassIdx = firstVisiblePassId;
  239. }
  240. for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ )
  241. {
  242. m_subShaders[ subShaderIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties , ref duplicatesHelper );
  243. int passCount = m_subShaders[ subShaderIdx ].Passes.Count;
  244. for( int passIdx = 0; passIdx < passCount; passIdx++ )
  245. {
  246. m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties, ref duplicatesHelper );
  247. m_subShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass = ( mainSubShaderIdx == subShaderIdx && mainPassIdx == passIdx );
  248. }
  249. }
  250. duplicatesHelper.Clear();
  251. duplicatesHelper = null;
  252. m_isSinglePass = ( m_subShaders.Count == 1 && m_subShaders[ 0 ].PassAmount == 1 );
  253. }
  254. public void ResetState()
  255. {
  256. m_templateIdManager.ResetRegistersState();
  257. int subshaderCount = m_subShaders.Count;
  258. for( int subShaderIdx = 0; subShaderIdx < subshaderCount; subShaderIdx++ )
  259. {
  260. m_subShaders[ subShaderIdx ].TemplateProperties.ResetTemplateUsageData();
  261. int passCount = m_subShaders[ subShaderIdx ].Passes.Count;
  262. for( int passIdx = 0; passIdx < passCount; passIdx++ )
  263. {
  264. m_subShaders[ subShaderIdx ].Passes[ passIdx ].TemplateProperties.ResetTemplateUsageData();
  265. }
  266. }
  267. }
  268. public override void Destroy()
  269. {
  270. m_templateProperties.Destroy();
  271. m_templateProperties = null;
  272. m_availableShaderProperties.Clear();
  273. m_availableShaderProperties = null;
  274. int subShaderCount = m_subShaders.Count;
  275. for( int i = 0; i < subShaderCount; i++ )
  276. {
  277. m_subShaders[ i ].Destroy();
  278. }
  279. m_subShaders.Clear();
  280. m_subShaders = null;
  281. m_templateIdManager.Destroy();
  282. m_templateIdManager = null;
  283. }
  284. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string[] list )
  285. {
  286. string id = GetSubShaderDataId( type, subShaderId, false );
  287. string body = string.Empty;
  288. FillTemplateBody( subShaderId, -1, id, ref body, list );
  289. SetSubShaderData( type, subShaderId, body );
  290. }
  291. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, List<PropertyDataCollector> list )
  292. {
  293. string id = GetSubShaderDataId( type, subShaderId, false );
  294. string body = string.Empty;
  295. FillTemplateBody( subShaderId, -1, id, ref body, list );
  296. SetSubShaderData( type, subShaderId, body );
  297. }
  298. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string text )
  299. {
  300. if( subShaderId >= m_subShaders.Count )
  301. return;
  302. string prefix = m_subShaders[ subShaderId ].Modules.UniquePrefix;
  303. switch( type )
  304. {
  305. case TemplateModuleDataType.AllModules:
  306. {
  307. m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text );
  308. }
  309. break;
  310. case TemplateModuleDataType.ModuleShaderModel:
  311. {
  312. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ShaderModel.Id, text );
  313. }
  314. break;
  315. case TemplateModuleDataType.ModuleBlendMode:
  316. {
  317. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId, text );
  318. }
  319. break;
  320. case TemplateModuleDataType.ModuleBlendMode1:
  321. {
  322. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendModeId, text );
  323. }
  324. break;
  325. case TemplateModuleDataType.ModuleBlendMode2:
  326. {
  327. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendModeId, text );
  328. }
  329. break;
  330. case TemplateModuleDataType.ModuleBlendMode3:
  331. {
  332. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendModeId, text );
  333. }
  334. break;
  335. case TemplateModuleDataType.ModuleBlendOp:
  336. {
  337. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId, text );
  338. }
  339. break;
  340. case TemplateModuleDataType.ModuleBlendOp1:
  341. {
  342. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendOpId, text );
  343. }
  344. break;
  345. case TemplateModuleDataType.ModuleBlendOp2:
  346. {
  347. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendOpId, text );
  348. }
  349. break;
  350. case TemplateModuleDataType.ModuleBlendOp3:
  351. {
  352. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendOpId, text );
  353. }
  354. break;
  355. case TemplateModuleDataType.ModuleAlphaToMask:
  356. {
  357. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.AlphaToMaskData.AlphaToMaskId, text );
  358. }
  359. break;
  360. case TemplateModuleDataType.ModuleCullMode:
  361. {
  362. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId, text );
  363. }
  364. break;
  365. case TemplateModuleDataType.ModuleColorMask:
  366. {
  367. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId, text );
  368. }
  369. break;
  370. case TemplateModuleDataType.ModuleColorMask1:
  371. {
  372. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData1.ColorMaskId, text );
  373. }
  374. break;
  375. case TemplateModuleDataType.ModuleColorMask2:
  376. {
  377. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData2.ColorMaskId, text );
  378. }
  379. break;
  380. case TemplateModuleDataType.ModuleColorMask3:
  381. {
  382. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData3.ColorMaskId, text );
  383. }
  384. break;
  385. case TemplateModuleDataType.ModuleStencil:
  386. {
  387. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId, text );
  388. }
  389. break;
  390. case TemplateModuleDataType.ModuleZwrite:
  391. {
  392. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId, text );
  393. }
  394. break;
  395. case TemplateModuleDataType.ModuleZTest:
  396. {
  397. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId, text );
  398. }
  399. break;
  400. case TemplateModuleDataType.ModuleZOffset:
  401. {
  402. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId, text );
  403. }
  404. break;
  405. case TemplateModuleDataType.ModuleTag:
  406. {
  407. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId, text );
  408. }
  409. break;
  410. case TemplateModuleDataType.ModuleGlobals:
  411. {
  412. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id, text );
  413. }
  414. break;
  415. case TemplateModuleDataType.ModuleSRPBatcher:
  416. {
  417. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id, text );
  418. }
  419. break;
  420. case TemplateModuleDataType.ModuleFunctions:
  421. {
  422. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id, text );
  423. }
  424. break;
  425. case TemplateModuleDataType.ModulePragma:
  426. {
  427. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id, text );
  428. }
  429. break;
  430. case TemplateModuleDataType.ModulePragmaBefore:
  431. {
  432. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id, text );
  433. }
  434. break;
  435. case TemplateModuleDataType.ModulePass:
  436. {
  437. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id, text );
  438. }
  439. break;
  440. case TemplateModuleDataType.ModuleInputVert:
  441. {
  442. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id, text );
  443. }
  444. break;
  445. case TemplateModuleDataType.ModuleInputFrag:
  446. {
  447. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id, text );
  448. }
  449. break;
  450. }
  451. }
  452. public void SetPropertyData( string[] properties )
  453. {
  454. string body = string.Empty;
  455. FillTemplateBody( -1, -1, TemplatesManager.TemplatePropertyTag, ref body, properties );
  456. SetPropertyData( body );
  457. }
  458. public void SetPropertyData( string text )
  459. {
  460. m_templateIdManager.SetReplacementText( m_propertyTag.Id, text );
  461. }
  462. public string GetSubShaderDataId( TemplateModuleDataType type, int subShaderId, bool addPrefix )
  463. {
  464. if( subShaderId >= m_subShaders.Count )
  465. return string.Empty;
  466. string prefix = string.Empty;
  467. switch( type )
  468. {
  469. case TemplateModuleDataType.AllModules:
  470. {
  471. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  472. return prefix + TemplatesManager.TemplateAllModulesTag;
  473. }
  474. case TemplateModuleDataType.ModuleBlendMode:
  475. {
  476. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  477. return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId;
  478. }
  479. case TemplateModuleDataType.ModuleBlendMode1:
  480. {
  481. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  482. return prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendModeId;
  483. }
  484. case TemplateModuleDataType.ModuleBlendMode2:
  485. {
  486. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  487. return prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendModeId;
  488. }
  489. case TemplateModuleDataType.ModuleBlendMode3:
  490. {
  491. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  492. return prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendModeId;
  493. }
  494. case TemplateModuleDataType.ModuleBlendOp:
  495. {
  496. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  497. return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId;
  498. }
  499. case TemplateModuleDataType.ModuleBlendOp1:
  500. {
  501. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  502. return prefix + m_subShaders[ subShaderId ].Modules.BlendData1.BlendOpId;
  503. }
  504. case TemplateModuleDataType.ModuleBlendOp2:
  505. {
  506. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  507. return prefix + m_subShaders[ subShaderId ].Modules.BlendData2.BlendOpId;
  508. }
  509. case TemplateModuleDataType.ModuleBlendOp3:
  510. {
  511. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  512. return prefix + m_subShaders[ subShaderId ].Modules.BlendData3.BlendOpId;
  513. }
  514. case TemplateModuleDataType.ModuleAlphaToMask:
  515. {
  516. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  517. return prefix + m_subShaders[ subShaderId ].Modules.AlphaToMaskData.AlphaToMaskId;
  518. }
  519. case TemplateModuleDataType.ModuleCullMode:
  520. {
  521. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  522. return prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId;
  523. }
  524. case TemplateModuleDataType.ModuleColorMask:
  525. {
  526. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  527. return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId;
  528. }
  529. case TemplateModuleDataType.ModuleColorMask1:
  530. {
  531. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  532. return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData1.ColorMaskId;
  533. }
  534. case TemplateModuleDataType.ModuleColorMask2:
  535. {
  536. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  537. return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData2.ColorMaskId;
  538. }
  539. case TemplateModuleDataType.ModuleColorMask3:
  540. {
  541. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  542. return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData3.ColorMaskId;
  543. }
  544. case TemplateModuleDataType.ModuleStencil:
  545. {
  546. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  547. return prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId;
  548. }
  549. case TemplateModuleDataType.ModuleZwrite:
  550. {
  551. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  552. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId;
  553. }
  554. case TemplateModuleDataType.ModuleZTest:
  555. {
  556. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  557. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId;
  558. }
  559. case TemplateModuleDataType.ModuleZOffset:
  560. {
  561. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  562. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId;
  563. }
  564. case TemplateModuleDataType.ModuleTag:
  565. {
  566. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  567. return prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId;
  568. }
  569. case TemplateModuleDataType.ModuleGlobals:
  570. {
  571. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  572. return prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id;
  573. }
  574. case TemplateModuleDataType.ModuleSRPBatcher:
  575. {
  576. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  577. return prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id;
  578. }
  579. case TemplateModuleDataType.ModuleFunctions:
  580. {
  581. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  582. return prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id;
  583. }
  584. case TemplateModuleDataType.ModulePragma:
  585. {
  586. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  587. return prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id;
  588. }
  589. case TemplateModuleDataType.ModulePragmaBefore:
  590. {
  591. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  592. return prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id;
  593. }
  594. case TemplateModuleDataType.ModulePass:
  595. {
  596. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  597. return prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id;
  598. }
  599. case TemplateModuleDataType.ModuleInputVert:
  600. {
  601. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  602. return prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id;
  603. }
  604. case TemplateModuleDataType.ModuleInputFrag:
  605. {
  606. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  607. return prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id;
  608. }
  609. }
  610. return string.Empty;
  611. }
  612. public string GetPassDataId( TemplateModuleDataType type, int subShaderId, int passId, bool addPrefix )
  613. {
  614. if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count )
  615. return string.Empty;
  616. string prefix = string.Empty;
  617. switch( type )
  618. {
  619. case TemplateModuleDataType.AllModules:
  620. {
  621. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  622. return prefix + TemplatesManager.TemplateAllModulesTag;
  623. }
  624. case TemplateModuleDataType.ModuleBlendMode:
  625. {
  626. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  627. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId;
  628. }
  629. case TemplateModuleDataType.ModuleBlendMode1:
  630. {
  631. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  632. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendModeId;
  633. }
  634. case TemplateModuleDataType.ModuleBlendMode2:
  635. {
  636. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  637. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendModeId;
  638. }
  639. case TemplateModuleDataType.ModuleBlendMode3:
  640. {
  641. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  642. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendModeId;
  643. }
  644. case TemplateModuleDataType.ModuleBlendOp:
  645. {
  646. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  647. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId;
  648. }
  649. case TemplateModuleDataType.ModuleBlendOp1:
  650. {
  651. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  652. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendOpId;
  653. }
  654. case TemplateModuleDataType.ModuleBlendOp2:
  655. {
  656. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  657. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendOpId;
  658. }
  659. case TemplateModuleDataType.ModuleBlendOp3:
  660. {
  661. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  662. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendOpId;
  663. }
  664. case TemplateModuleDataType.ModuleAlphaToMask:
  665. {
  666. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  667. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.AlphaToMaskData.AlphaToMaskId;
  668. }
  669. case TemplateModuleDataType.ModuleCullMode:
  670. {
  671. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  672. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId;
  673. }
  674. case TemplateModuleDataType.ModuleColorMask:
  675. {
  676. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  677. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId;
  678. }
  679. case TemplateModuleDataType.ModuleColorMask1:
  680. {
  681. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  682. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData1.ColorMaskId;
  683. }
  684. case TemplateModuleDataType.ModuleColorMask2:
  685. {
  686. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  687. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData2.ColorMaskId;
  688. }
  689. case TemplateModuleDataType.ModuleColorMask3:
  690. {
  691. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  692. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData3.ColorMaskId;
  693. }
  694. case TemplateModuleDataType.ModuleStencil:
  695. {
  696. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  697. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId;
  698. }
  699. case TemplateModuleDataType.ModuleZwrite:
  700. {
  701. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  702. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId;
  703. }
  704. case TemplateModuleDataType.ModuleZTest:
  705. {
  706. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  707. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId;
  708. }
  709. case TemplateModuleDataType.ModuleZOffset:
  710. {
  711. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  712. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId;
  713. }
  714. case TemplateModuleDataType.ModuleTag:
  715. {
  716. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  717. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId;
  718. }
  719. case TemplateModuleDataType.ModuleGlobals:
  720. {
  721. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  722. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id;
  723. }
  724. case TemplateModuleDataType.ModuleSRPBatcher:
  725. {
  726. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  727. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id;
  728. }
  729. case TemplateModuleDataType.ModuleFunctions:
  730. {
  731. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  732. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id;
  733. }
  734. case TemplateModuleDataType.ModulePragma:
  735. {
  736. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  737. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id;
  738. }
  739. case TemplateModuleDataType.ModulePragmaBefore:
  740. {
  741. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  742. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id;
  743. }
  744. case TemplateModuleDataType.ModulePass:
  745. {
  746. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  747. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id;
  748. }
  749. case TemplateModuleDataType.ModuleInputVert:
  750. {
  751. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  752. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id;
  753. }
  754. case TemplateModuleDataType.ModuleInputFrag:
  755. {
  756. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  757. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id;
  758. }
  759. case TemplateModuleDataType.PassVertexFunction:
  760. {
  761. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  762. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id;
  763. }
  764. case TemplateModuleDataType.PassFragmentFunction:
  765. {
  766. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  767. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id;
  768. }
  769. case TemplateModuleDataType.PassVertexData:
  770. {
  771. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  772. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId;
  773. }
  774. case TemplateModuleDataType.PassInterpolatorData:
  775. {
  776. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  777. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId;
  778. }
  779. case TemplateModuleDataType.VControl:
  780. {
  781. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  782. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id;
  783. }
  784. case TemplateModuleDataType.ControlData:
  785. {
  786. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  787. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id;
  788. }
  789. case TemplateModuleDataType.DomainData:
  790. {
  791. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  792. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id;
  793. }
  794. }
  795. return string.Empty;
  796. }
  797. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string[] list )
  798. {
  799. //if( list == null || list.Length == 0 )
  800. // return;
  801. string id = GetPassDataId( type, subShaderId, passId, false );
  802. string body = string.Empty;
  803. FillTemplateBody( subShaderId, passId, id, ref body, list );
  804. SetPassData( type, subShaderId, passId, body );
  805. }
  806. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, List<PropertyDataCollector> list )
  807. {
  808. //if( list == null || list.Count == 0 )
  809. // return;
  810. string id = GetPassDataId( type, subShaderId, passId, false );
  811. string body = string.Empty;
  812. FillTemplateBody( subShaderId, passId, id, ref body, list );
  813. SetPassData( type, subShaderId, passId, body );
  814. }
  815. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string text )
  816. {
  817. if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count )
  818. return;
  819. string prefix = string.Empty;
  820. switch( type )
  821. {
  822. //case TemplateModuleDataType.EndPass:
  823. //{
  824. // prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  825. // m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateEndPassTag, text );
  826. //}
  827. //break;
  828. case TemplateModuleDataType.AllModules:
  829. {
  830. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  831. m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text );
  832. }
  833. break;
  834. case TemplateModuleDataType.ModuleShaderModel:
  835. {
  836. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  837. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ShaderModel.Id, text );
  838. }
  839. break;
  840. case TemplateModuleDataType.ModuleBlendMode:
  841. {
  842. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  843. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId, text );
  844. }
  845. break;
  846. case TemplateModuleDataType.ModuleBlendMode1:
  847. {
  848. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  849. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendModeId, text );
  850. }
  851. break;
  852. case TemplateModuleDataType.ModuleBlendMode2:
  853. {
  854. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  855. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendModeId, text );
  856. }
  857. break;
  858. case TemplateModuleDataType.ModuleBlendMode3:
  859. {
  860. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  861. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendModeId, text );
  862. }
  863. break;
  864. case TemplateModuleDataType.ModuleBlendOp:
  865. {
  866. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  867. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId, text );
  868. }
  869. break;
  870. case TemplateModuleDataType.ModuleBlendOp1:
  871. {
  872. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  873. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData1.BlendOpId, text );
  874. }
  875. break;
  876. case TemplateModuleDataType.ModuleBlendOp2:
  877. {
  878. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  879. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData2.BlendOpId, text );
  880. }
  881. break;
  882. case TemplateModuleDataType.ModuleBlendOp3:
  883. {
  884. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  885. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData3.BlendOpId, text );
  886. }
  887. break;
  888. case TemplateModuleDataType.ModuleAlphaToMask:
  889. {
  890. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  891. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.AlphaToMaskData.AlphaToMaskId, text );
  892. }
  893. break;
  894. case TemplateModuleDataType.ModuleCullMode:
  895. {
  896. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  897. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId, text );
  898. }
  899. break;
  900. case TemplateModuleDataType.ModuleColorMask:
  901. {
  902. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  903. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId, text );
  904. }
  905. break;
  906. case TemplateModuleDataType.ModuleColorMask1:
  907. {
  908. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  909. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData1.ColorMaskId, text );
  910. }
  911. break;
  912. case TemplateModuleDataType.ModuleColorMask2:
  913. {
  914. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  915. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData2.ColorMaskId, text );
  916. }
  917. break;
  918. case TemplateModuleDataType.ModuleColorMask3:
  919. {
  920. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  921. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData3.ColorMaskId, text );
  922. }
  923. break;
  924. case TemplateModuleDataType.ModuleStencil:
  925. {
  926. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  927. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId, text );
  928. }
  929. break;
  930. case TemplateModuleDataType.ModuleZwrite:
  931. {
  932. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  933. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId, text );
  934. }
  935. break;
  936. case TemplateModuleDataType.ModuleZTest:
  937. {
  938. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  939. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId, text );
  940. }
  941. break;
  942. case TemplateModuleDataType.ModuleZOffset:
  943. {
  944. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  945. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId, text );
  946. }
  947. break;
  948. case TemplateModuleDataType.ModuleTag:
  949. {
  950. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  951. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId, text );
  952. }
  953. break;
  954. case TemplateModuleDataType.ModuleGlobals:
  955. {
  956. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  957. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id, text );
  958. }
  959. break;
  960. case TemplateModuleDataType.ModuleSRPBatcher:
  961. {
  962. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  963. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id, text );
  964. }
  965. break;
  966. case TemplateModuleDataType.ModuleFunctions:
  967. {
  968. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  969. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id, text );
  970. }
  971. break;
  972. case TemplateModuleDataType.ModulePragma:
  973. {
  974. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  975. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id, text );
  976. }
  977. break;
  978. case TemplateModuleDataType.ModulePragmaBefore:
  979. {
  980. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  981. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id, text );
  982. }
  983. break;
  984. case TemplateModuleDataType.ModulePass:
  985. {
  986. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  987. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id, text );
  988. }
  989. break;
  990. case TemplateModuleDataType.ModuleInputVert:
  991. {
  992. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  993. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id, text );
  994. }
  995. break;
  996. case TemplateModuleDataType.ModuleInputFrag:
  997. {
  998. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  999. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id, text );
  1000. }
  1001. break;
  1002. case TemplateModuleDataType.PassVertexFunction:
  1003. {
  1004. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1005. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id, text );
  1006. }
  1007. break;
  1008. case TemplateModuleDataType.PassFragmentFunction:
  1009. {
  1010. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1011. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id, text );
  1012. }
  1013. break;
  1014. case TemplateModuleDataType.PassVertexData:
  1015. {
  1016. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1017. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId, text );
  1018. }
  1019. break;
  1020. case TemplateModuleDataType.PassInterpolatorData:
  1021. {
  1022. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1023. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId, text );
  1024. }
  1025. break;
  1026. case TemplateModuleDataType.PassNameData:
  1027. {
  1028. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1029. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].PassNameContainer.Id, text );
  1030. }
  1031. break;
  1032. case TemplateModuleDataType.VControl:
  1033. {
  1034. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1035. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id, text );
  1036. }
  1037. break;
  1038. case TemplateModuleDataType.ControlData:
  1039. {
  1040. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1041. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id, text );
  1042. }
  1043. break;
  1044. case TemplateModuleDataType.DomainData:
  1045. {
  1046. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1047. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id, text );
  1048. }
  1049. break;
  1050. }
  1051. }
  1052. public void SetPassInputData( int subShaderId, int passId, int inputId, string text )
  1053. {
  1054. if( subShaderId >= m_subShaders.Count ||
  1055. passId >= m_subShaders[ subShaderId ].Passes.Count )
  1056. return;
  1057. string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1058. TemplateInputData inputData = m_subShaders[ subShaderId ].Passes[ passId ].InputDataFromId( inputId );
  1059. if( inputData != null )
  1060. {
  1061. m_templateIdManager.SetReplacementText( prefix + inputData.TagId, text );
  1062. }
  1063. else
  1064. {
  1065. Debug.LogErrorFormat( "Unable to find input data for port with id {0} on subshader {1} pass {2}", inputId, subShaderId, passId );
  1066. }
  1067. }
  1068. public void SetPassInputDataByArrayIdx( int subShaderId, int passId, int inputId, string text )
  1069. {
  1070. if( subShaderId >= m_subShaders.Count ||
  1071. passId >= m_subShaders[ subShaderId ].Passes.Count ||
  1072. inputId >= m_subShaders[ subShaderId ].Passes[ passId ].InputDataList.Count )
  1073. return;
  1074. string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  1075. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InputDataList[ inputId ].TagId, text );
  1076. }
  1077. public TemplateData CreateTemplateData( string name, string guid, int subShaderId, int passId )
  1078. {
  1079. if( subShaderId >= m_subShaders.Count ||
  1080. passId >= m_subShaders[ subShaderId ].Passes.Count )
  1081. return null;
  1082. if( string.IsNullOrEmpty( name ) )
  1083. name = m_defaultShaderName;
  1084. TemplateData templateData = ScriptableObject.CreateInstance<TemplateData>();
  1085. templateData.Name = name;
  1086. templateData.GUID = guid;
  1087. templateData.TemplateBody = m_shaderBody;
  1088. templateData.DefaultShaderName = m_defaultShaderName;
  1089. templateData.ShaderNameId = m_shaderNameId;
  1090. templateData.OrderId = m_orderId;
  1091. templateData.InputDataList = SubShaders[ subShaderId ].Passes[ passId ].InputDataList;
  1092. templateData.VertexDataContainer = SubShaders[ subShaderId ].Passes[ passId ].VertexDataContainer;
  1093. templateData.InterpolatorDataContainer = SubShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer;
  1094. templateData.AvailableShaderProperties = m_availableShaderProperties;
  1095. templateData.VertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData;
  1096. templateData.FragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData;
  1097. templateData.BlendData = SubShaders[ subShaderId ].Passes[ passId ].Modules.BlendData;
  1098. templateData.CullModeData = SubShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData;
  1099. templateData.ColorMaskData = SubShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData;
  1100. templateData.StencilData = SubShaders[ subShaderId ].Passes[ passId ].Modules.StencilData;
  1101. templateData.DepthData = SubShaders[ subShaderId ].Passes[ passId ].Modules.DepthData;
  1102. templateData.TagData = SubShaders[ subShaderId ].Passes[ passId ].Modules.TagData;
  1103. //templateData.PropertyList = m_pr;
  1104. //private Dictionary<string, TemplateProperty> m_propertyDict = new Dictionary<string, TemplateProperty>();
  1105. return templateData;
  1106. }
  1107. public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, List<PropertyDataCollector> values )
  1108. {
  1109. if( values.Count == 0 )
  1110. {
  1111. return true;
  1112. }
  1113. string[] array = new string[ values.Count ];
  1114. for( int i = 0; i < values.Count; i++ )
  1115. {
  1116. array[ i ] = values[ i ].PropertyName;
  1117. }
  1118. return FillTemplateBody( subShaderId, passId, id, ref body, array );
  1119. }
  1120. public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, params string[] values )
  1121. {
  1122. if( values.Length == 0 )
  1123. {
  1124. if( id[ id.Length - 1 ] == '\n' )
  1125. body = "\n";
  1126. return true;
  1127. }
  1128. TemplatePropertyContainer propertyContainer = null;
  1129. if( subShaderId >= 0 )
  1130. {
  1131. if( passId >= 0 )
  1132. {
  1133. propertyContainer = SubShaders[ subShaderId ].Passes[ passId ].TemplateProperties;
  1134. }
  1135. else
  1136. {
  1137. propertyContainer = SubShaders[ subShaderId ].TemplateProperties;
  1138. }
  1139. }
  1140. else
  1141. {
  1142. propertyContainer = m_templateProperties;
  1143. }
  1144. propertyContainer.BuildInfo();
  1145. if( propertyContainer.PropertyDict.ContainsKey( id ) )
  1146. {
  1147. string finalValue = propertyContainer.PropertyDict[ id ].UseIndentationAtStart ? propertyContainer.PropertyDict[ id ].Indentation : string.Empty;
  1148. for( int i = 0; i < values.Length; i++ )
  1149. {
  1150. if( propertyContainer.PropertyDict[ id ].AutoLineFeed )
  1151. {
  1152. string[] valuesArr = values[ i ].Split( '\n' );
  1153. for( int j = 0; j < valuesArr.Length; j++ )
  1154. {
  1155. //first value will be automatically indented by the string replace
  1156. finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + valuesArr[ j ];
  1157. finalValue += TemplatesManager.TemplateNewLine;
  1158. }
  1159. }
  1160. else
  1161. {
  1162. //first value will be automatically indented by the string replace
  1163. finalValue += ( i == 0 ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + values[ i ];
  1164. }
  1165. }
  1166. body = finalValue;
  1167. propertyContainer.PropertyDict[ id ].Used = true;
  1168. return true;
  1169. }
  1170. if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) )
  1171. {
  1172. 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 );
  1173. return false;
  1174. }
  1175. return true;
  1176. }
  1177. public bool FillVertexInstructions( int subShaderId, int passId, params string[] values )
  1178. {
  1179. TemplateFunctionData vertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData;
  1180. if( vertexFunctionData != null && !string.IsNullOrEmpty( vertexFunctionData.Id ) )
  1181. {
  1182. string body = string.Empty;
  1183. bool isValid = FillTemplateBody( subShaderId, passId, vertexFunctionData.Id, ref body, values );
  1184. SetPassData( TemplateModuleDataType.PassVertexFunction, subShaderId, passId, body );
  1185. return isValid;
  1186. }
  1187. if( values.Length > 0 )
  1188. {
  1189. UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error );
  1190. return false;
  1191. }
  1192. return true;
  1193. }
  1194. public bool FillFragmentInstructions( int subShaderId, int passId, params string[] values )
  1195. {
  1196. TemplateFunctionData fragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData;
  1197. if( fragmentFunctionData != null && !string.IsNullOrEmpty( fragmentFunctionData.Id ) )
  1198. {
  1199. string body = string.Empty;
  1200. bool isValid = FillTemplateBody( subShaderId, passId, fragmentFunctionData.Id, ref body, values );
  1201. SetPassData( TemplateModuleDataType.PassFragmentFunction, subShaderId, passId, body );
  1202. return isValid;
  1203. }
  1204. if( values.Length > 0 )
  1205. {
  1206. UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error );
  1207. return false;
  1208. }
  1209. return true;
  1210. }
  1211. public void SetShaderName( string name )
  1212. {
  1213. m_templateIdManager.SetReplacementText( m_shaderNameId, name );
  1214. }
  1215. public void SetCustomInspector( string customInspector )
  1216. {
  1217. if( m_customInspectorContainer.Index > -1 )
  1218. {
  1219. m_templateIdManager.SetReplacementText( m_customInspectorContainer.Id, m_templateProperties.PropertyDict[ m_customInspectorContainer.Id ].Indentation + customInspector );
  1220. }
  1221. }
  1222. public void SetFallback( string fallback )
  1223. {
  1224. if( m_fallbackContainer.Index > -1 )
  1225. {
  1226. m_templateIdManager.SetReplacementText( m_fallbackContainer.Id, m_templateProperties.PropertyDict[ m_fallbackContainer.Id ].Indentation + fallback );
  1227. }
  1228. }
  1229. public void SetDependencies( string dependencies )
  1230. {
  1231. if( m_dependenciesContainer.Index > -1 )
  1232. {
  1233. m_templateIdManager.SetReplacementText( m_dependenciesContainer.Id, dependencies );
  1234. }
  1235. }
  1236. private void OnEnable()
  1237. {
  1238. hideFlags = HideFlags.HideAndDontSave;
  1239. }
  1240. public override bool Reload()
  1241. {
  1242. m_propertyTag = null;
  1243. m_shaderNameId = string.Empty;
  1244. m_shaderBody = string.Empty;
  1245. m_isSinglePass = false;
  1246. m_masterNodesRequired = 0;
  1247. m_beforePragmaContainer.Reset();
  1248. m_customInspectorContainer.Reset();
  1249. m_fallbackContainer.Reset();
  1250. m_dependenciesContainer.Reset();
  1251. m_availableShaderProperties.Clear();
  1252. int count = m_subShaders.Count;
  1253. for( int i = 0; i < count; i++ )
  1254. {
  1255. m_subShaders[ i ].Destroy();
  1256. }
  1257. m_subShaders.Clear();
  1258. m_templateIdManager.Reset();
  1259. if( m_shaderData != null )
  1260. m_shaderData.Destroy();
  1261. m_templateProperties.Reset();
  1262. string oldName = m_defaultShaderName;
  1263. LoadTemplateBody( m_guid );
  1264. if( m_communityTemplate )
  1265. Name = m_defaultShaderName;
  1266. return !oldName.Equals( m_defaultShaderName );
  1267. }
  1268. public bool GetSubShaderandPassFor( string passUniqueId, ref int subShaderId, ref int passId )
  1269. {
  1270. if( string.IsNullOrEmpty( passUniqueId ) )
  1271. return false;
  1272. if( m_passUniqueIdData.Count == 0 )
  1273. {
  1274. for( int subShaderIdx = 0; subShaderIdx < m_subShaders.Count; subShaderIdx++ )
  1275. {
  1276. for( int passIdx = 0; passIdx < m_subShaders[ subShaderIdx ].Passes.Count; passIdx++ )
  1277. {
  1278. if( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.HasPassUniqueName )
  1279. {
  1280. if( m_passUniqueIdData.ContainsKey( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName ) )
  1281. {
  1282. 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 );
  1283. return false;
  1284. }
  1285. m_passUniqueIdData.Add( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName, new TemplateUniquePassData() { PassIdx = passIdx, SubShaderIdx = subShaderIdx } );
  1286. }
  1287. }
  1288. }
  1289. }
  1290. if( m_passUniqueIdData.ContainsKey( passUniqueId ) )
  1291. {
  1292. subShaderId = m_passUniqueIdData[ passUniqueId ].SubShaderIdx;
  1293. passId = m_passUniqueIdData[ passUniqueId ].PassIdx;
  1294. return true;
  1295. }
  1296. subShaderId = -1;
  1297. passId = -1;
  1298. return false;
  1299. }
  1300. public TemplateShaderPropertyData GetShaderPropertyData( string propertyName )
  1301. {
  1302. return m_availableShaderProperties.Find( ( x ) => ( x.PropertyName.Equals( propertyName ) ) );
  1303. }
  1304. public TemplateSRPType SRPtype { get { return m_subShaders[ 0 ].Modules.SRPType; } }
  1305. //public bool SRPIsPBRHD { get { return m_subShaders[0].Modules.SRPIsPBRHD ; } }
  1306. public List<TemplateSubShader> SubShaders { get { return m_subShaders; } }
  1307. public List<TemplateShaderPropertyData> AvailableShaderProperties { get { return m_availableShaderProperties; } }
  1308. public TemplateTagData PropertyTag { get { return m_propertyTag; } }
  1309. public TemplateIdManager IdManager { get { return m_templateIdManager; } }
  1310. public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } }
  1311. public TemplateInfoContainer CustomInspectorContainer { get { return m_customInspectorContainer; } }
  1312. public TemplateInfoContainer FallbackContainer { get { return m_fallbackContainer; } }
  1313. public TemplateInfoContainer BeforePragmaContainer { get { return m_beforePragmaContainer; } }
  1314. public bool IsSinglePass { get { return m_isSinglePass; } }
  1315. public int MasterNodesRequired { get { return m_masterNodesRequired; } }
  1316. public CustomTemplatePropertyUIEnum CustomTemplatePropertyUI { get { return m_customTemplatePropertyUI; } }
  1317. public bool CanAddLODs { get { return m_lodInjectorId > -1; } }
  1318. public TemplateShaderModelData GlobalShaderModel { get { return m_globalShaderModel; } }
  1319. }
  1320. }