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.

755 lines
22 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using UnityEngine;
  5. namespace AmplifyShaderEditor
  6. {
  7. [Serializable]
  8. public class TemplateModulesHelper
  9. {
  10. [SerializeField]
  11. internal bool Foldout = false;
  12. private bool m_isDirty = false;
  13. [SerializeField]
  14. private TemplatesBlendModule m_blendOpHelper = new TemplatesBlendModule();
  15. [SerializeField]
  16. private TemplatesBlendModule m_blendOpHelper1 = new TemplatesBlendModule();
  17. [SerializeField]
  18. private TemplatesBlendModule m_blendOpHelper2 = new TemplatesBlendModule();
  19. [SerializeField]
  20. private TemplatesBlendModule m_blendOpHelper3 = new TemplatesBlendModule();
  21. [SerializeField]
  22. private TemplateAlphaToMaskModule m_alphaToMaskHelper = new TemplateAlphaToMaskModule();
  23. [SerializeField]
  24. private TemplateCullModeModule m_cullModeHelper = new TemplateCullModeModule();
  25. [SerializeField]
  26. private TemplateColorMaskModule m_colorMaskHelper = new TemplateColorMaskModule();
  27. [SerializeField]
  28. private TemplateColorMaskModule m_colorMaskHelper1 = new TemplateColorMaskModule();
  29. [SerializeField]
  30. private TemplateColorMaskModule m_colorMaskHelper2 = new TemplateColorMaskModule();
  31. [SerializeField]
  32. private TemplateColorMaskModule m_colorMaskHelper3 = new TemplateColorMaskModule();
  33. [SerializeField]
  34. private TemplatesStencilBufferModule m_stencilBufferHelper = new TemplatesStencilBufferModule();
  35. [SerializeField]
  36. private TemplateDepthModule m_depthOphelper = new TemplateDepthModule();
  37. [SerializeField]
  38. private TemplateTagsModule m_tagsHelper = new TemplateTagsModule();
  39. [SerializeField]
  40. private TemplateShaderModelModule m_shaderModelHelper = new TemplateShaderModelModule();
  41. [SerializeField]
  42. private TemplateAdditionalIncludesHelper m_additionalIncludes = new TemplateAdditionalIncludesHelper();
  43. [SerializeField]
  44. private TemplateAdditionalDefinesHelper m_additionalDefines = new TemplateAdditionalDefinesHelper();
  45. [SerializeField]
  46. private TemplateAdditionalPragmasHelper m_additionalPragmas = new TemplateAdditionalPragmasHelper();
  47. [SerializeField]
  48. private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper(" Additional Directives");
  49. [SerializeField]
  50. private bool m_hasValidData = false;
  51. [SerializeField]
  52. private bool m_allModulesMode = false;
  53. public void CopyFrom( TemplateModulesHelper other )
  54. {
  55. m_allModulesMode = other.AllModulesMode;
  56. if( other.BlendOpHelper.IsDirty )
  57. {
  58. m_blendOpHelper.CopyFrom( other.BlendOpHelper, true );
  59. }
  60. if( other.BlendOpHelper1.IsDirty )
  61. {
  62. m_blendOpHelper1.CopyFrom( other.BlendOpHelper1, true );
  63. }
  64. if( other.BlendOpHelper2.IsDirty )
  65. {
  66. m_blendOpHelper2.CopyFrom( other.BlendOpHelper2, true );
  67. }
  68. if( other.BlendOpHelper3.IsDirty )
  69. {
  70. m_blendOpHelper3.CopyFrom( other.BlendOpHelper3, true );
  71. }
  72. if( other.AlphaToMaskHelper.IsDirty )
  73. {
  74. m_alphaToMaskHelper.CopyFrom( other.AlphaToMaskHelper, true );
  75. }
  76. if( other.CullModeHelper.IsDirty )
  77. {
  78. m_cullModeHelper.CopyFrom( other.CullModeHelper , true );
  79. }
  80. if( other.ColorMaskHelper.IsDirty )
  81. {
  82. m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , true);
  83. }
  84. if( other.ColorMaskHelper1.IsDirty )
  85. {
  86. m_colorMaskHelper1.CopyFrom( other.ColorMaskHelper1, true );
  87. }
  88. if( other.ColorMaskHelper2.IsDirty )
  89. {
  90. m_colorMaskHelper2.CopyFrom( other.ColorMaskHelper2, true );
  91. }
  92. if( other.ColorMaskHelper3.IsDirty )
  93. {
  94. m_colorMaskHelper3.CopyFrom( other.ColorMaskHelper3, true );
  95. }
  96. if( other.StencilBufferHelper.IsDirty )
  97. {
  98. m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper,true );
  99. }
  100. if( other.DepthOphelper.IsDirty )
  101. {
  102. m_depthOphelper.CopyFrom( other.DepthOphelper,true );
  103. }
  104. if( other.TagsHelper.IsDirty )
  105. {
  106. m_tagsHelper.CopyFrom( other.TagsHelper );
  107. }
  108. if( other.ShaderModelHelper.IsDirty )
  109. {
  110. m_shaderModelHelper.CopyFrom( other.ShaderModelHelper, true );
  111. }
  112. }
  113. public void SyncWith( TemplateModulesHelper other )
  114. {
  115. if( m_blendOpHelper.ValidData && other.BlendOpHelper.ValidData )
  116. {
  117. m_blendOpHelper.CopyFrom( other.BlendOpHelper, false );
  118. }
  119. if( m_blendOpHelper1.ValidData && other.BlendOpHelper1.ValidData )
  120. {
  121. m_blendOpHelper1.CopyFrom( other.BlendOpHelper1, false );
  122. }
  123. if( m_blendOpHelper2.ValidData && other.BlendOpHelper2.ValidData )
  124. {
  125. m_blendOpHelper2.CopyFrom( other.BlendOpHelper2, false );
  126. }
  127. if( m_blendOpHelper3.ValidData && other.BlendOpHelper3.ValidData )
  128. {
  129. m_blendOpHelper3.CopyFrom( other.BlendOpHelper3, false );
  130. }
  131. if( m_alphaToMaskHelper.ValidData && other.AlphaToMaskHelper.ValidData )
  132. {
  133. m_alphaToMaskHelper.CopyFrom( other.AlphaToMaskHelper, false );
  134. }
  135. if( m_cullModeHelper.ValidData && other.CullModeHelper.ValidData )
  136. {
  137. m_cullModeHelper.CopyFrom( other.CullModeHelper, false );
  138. }
  139. if( m_colorMaskHelper.ValidData && other.ColorMaskHelper.ValidData )
  140. {
  141. m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , false );
  142. }
  143. if( m_colorMaskHelper1.ValidData && other.ColorMaskHelper1.ValidData )
  144. {
  145. m_colorMaskHelper1.CopyFrom( other.ColorMaskHelper1, false );
  146. }
  147. if( m_colorMaskHelper2.ValidData && other.ColorMaskHelper2.ValidData )
  148. {
  149. m_colorMaskHelper2.CopyFrom( other.ColorMaskHelper2, false );
  150. }
  151. if( m_colorMaskHelper3.ValidData && other.ColorMaskHelper3.ValidData )
  152. {
  153. m_colorMaskHelper3.CopyFrom( other.ColorMaskHelper3, false );
  154. }
  155. if( m_stencilBufferHelper.ValidData && other.StencilBufferHelper.ValidData )
  156. {
  157. m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper, false );
  158. }
  159. if( m_depthOphelper.ValidData && other.DepthOphelper.ValidData )
  160. {
  161. m_depthOphelper.CopyFrom( other.DepthOphelper, false );
  162. }
  163. if( m_shaderModelHelper.ValidData && other.ShaderModelHelper.ValidData )
  164. {
  165. m_shaderModelHelper.CopyFrom( other.ShaderModelHelper , false);
  166. }
  167. }
  168. public void FetchDataFromTemplate( TemplateModulesData module )
  169. {
  170. m_allModulesMode = module.AllModulesMode;
  171. if( module.PragmaTag.IsValid )
  172. {
  173. m_hasValidData = true;
  174. //m_additionalPragmas.IsValid = true;
  175. //m_additionalPragmas.FillNativeItems( module.IncludePragmaContainer.PragmasList );
  176. //m_additionalIncludes.IsValid = true;
  177. //m_additionalIncludes.FillNativeItems( module.IncludePragmaContainer.IncludesList );
  178. //m_additionalDefines.IsValid = true;
  179. //m_additionalDefines.FillNativeItems( module.IncludePragmaContainer.DefinesList );
  180. m_additionalDirectives.FillNativeItems( module.IncludePragmaContainer.NativeDirectivesList );
  181. m_additionalDirectives.IsValid = true;
  182. }
  183. else
  184. {
  185. //m_additionalPragmas.IsValid = false;
  186. //m_additionalIncludes.IsValid = false;
  187. //m_additionalDefines.IsValid = false;
  188. m_additionalDirectives.IsValid = false;
  189. }
  190. m_blendOpHelper.ConfigureFromTemplateData( module.BlendData );
  191. if( module.BlendData.DataCheck == TemplateDataCheck.Valid )
  192. {
  193. m_hasValidData = true;
  194. }
  195. m_blendOpHelper1.ConfigureFromTemplateData( module.BlendData1 );
  196. if( module.BlendData1.DataCheck == TemplateDataCheck.Valid )
  197. {
  198. m_hasValidData = true;
  199. }
  200. m_blendOpHelper2.ConfigureFromTemplateData( module.BlendData2 );
  201. if( module.BlendData2.DataCheck == TemplateDataCheck.Valid )
  202. {
  203. m_hasValidData = true;
  204. }
  205. m_blendOpHelper3.ConfigureFromTemplateData( module.BlendData3 );
  206. if( module.BlendData3.DataCheck == TemplateDataCheck.Valid )
  207. {
  208. m_hasValidData = true;
  209. }
  210. m_alphaToMaskHelper.ConfigureFromTemplateData( module.AlphaToMaskData );
  211. if( module.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid )
  212. {
  213. m_hasValidData = true;
  214. }
  215. m_cullModeHelper.ConfigureFromTemplateData( module.CullModeData );
  216. if( module.CullModeData.DataCheck == TemplateDataCheck.Valid )
  217. {
  218. m_hasValidData = true;
  219. }
  220. m_colorMaskHelper.ConfigureFromTemplateData( module.ColorMaskData );
  221. if( module.ColorMaskData.DataCheck == TemplateDataCheck.Valid )
  222. {
  223. m_hasValidData = true;
  224. }
  225. m_colorMaskHelper1.ConfigureFromTemplateData( module.ColorMaskData1 );
  226. if( module.ColorMaskData1.DataCheck == TemplateDataCheck.Valid )
  227. {
  228. m_hasValidData = true;
  229. }
  230. m_colorMaskHelper2.ConfigureFromTemplateData( module.ColorMaskData2 );
  231. if( module.ColorMaskData2.DataCheck == TemplateDataCheck.Valid )
  232. {
  233. m_hasValidData = true;
  234. }
  235. m_colorMaskHelper3.ConfigureFromTemplateData( module.ColorMaskData3 );
  236. if( module.ColorMaskData3.DataCheck == TemplateDataCheck.Valid )
  237. {
  238. m_hasValidData = true;
  239. }
  240. m_stencilBufferHelper.ConfigureFromTemplateData( module.StencilData );
  241. if( module.StencilData.DataCheck == TemplateDataCheck.Valid )
  242. {
  243. m_hasValidData = true;
  244. }
  245. m_depthOphelper.ConfigureFromTemplateData( module.DepthData );
  246. if( module.DepthData.DataCheck == TemplateDataCheck.Valid )
  247. {
  248. m_hasValidData = true;
  249. }
  250. m_tagsHelper.ConfigureFromTemplateData( module.TagData );
  251. if( module.TagData.DataCheck == TemplateDataCheck.Valid )
  252. {
  253. m_hasValidData = true;
  254. }
  255. m_shaderModelHelper.ConfigureFromTemplateData( module.ShaderModel );
  256. if( module.ShaderModel.DataCheck == TemplateDataCheck.Valid )
  257. {
  258. m_hasValidData = true;
  259. }
  260. }
  261. public void OnLogicUpdate( TemplateModulesData currentModule )
  262. {
  263. if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid )
  264. m_tagsHelper.OnLogicUpdate();
  265. }
  266. public void Draw( ParentNode owner, TemplateModulesData currentModule , TemplateModulesHelper parent = null )
  267. {
  268. if( currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid )
  269. m_shaderModelHelper.Draw( owner );
  270. m_isDirty = m_shaderModelHelper.IsDirty;
  271. if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid )
  272. m_cullModeHelper.Draw( owner );
  273. m_isDirty = m_isDirty || m_cullModeHelper.IsDirty;
  274. if( currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid )
  275. m_colorMaskHelper.Draw( owner );
  276. m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty;
  277. if( currentModule.ColorMaskData1.DataCheck == TemplateDataCheck.Valid )
  278. m_colorMaskHelper1.Draw( owner );
  279. m_isDirty = m_isDirty || m_colorMaskHelper1.IsDirty;
  280. if( currentModule.ColorMaskData2.DataCheck == TemplateDataCheck.Valid )
  281. m_colorMaskHelper2.Draw( owner );
  282. m_isDirty = m_isDirty || m_colorMaskHelper2.IsDirty;
  283. if( currentModule.ColorMaskData3.DataCheck == TemplateDataCheck.Valid )
  284. m_colorMaskHelper3.Draw( owner );
  285. m_isDirty = m_isDirty || m_colorMaskHelper3.IsDirty;
  286. if( currentModule.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid )
  287. m_alphaToMaskHelper.Draw( owner );
  288. m_isDirty = m_isDirty || m_alphaToMaskHelper.IsDirty;
  289. if( currentModule.DepthData.DataCheck == TemplateDataCheck.Valid )
  290. m_depthOphelper.Draw( owner, false );
  291. m_isDirty = m_isDirty || m_depthOphelper.IsDirty;
  292. if( currentModule.BlendData.DataCheck == TemplateDataCheck.Valid )
  293. m_blendOpHelper.Draw( owner, false );
  294. m_isDirty = m_isDirty || m_blendOpHelper.IsDirty;
  295. if( currentModule.BlendData1.DataCheck == TemplateDataCheck.Valid )
  296. m_blendOpHelper1.Draw( owner, false );
  297. m_isDirty = m_isDirty || m_blendOpHelper1.IsDirty;
  298. if( currentModule.BlendData2.DataCheck == TemplateDataCheck.Valid )
  299. m_blendOpHelper2.Draw( owner, false );
  300. m_isDirty = m_isDirty || m_blendOpHelper2.IsDirty;
  301. if( currentModule.BlendData3.DataCheck == TemplateDataCheck.Valid )
  302. m_blendOpHelper3.Draw( owner, false );
  303. m_isDirty = m_isDirty || m_blendOpHelper3.IsDirty;
  304. if( currentModule.StencilData.DataCheck == TemplateDataCheck.Valid )
  305. {
  306. CullMode cullMode = CullMode.Back;
  307. if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid )
  308. {
  309. cullMode = m_cullModeHelper.CurrentCullMode;
  310. }
  311. else if( parent != null && parent.CullModeHelper.ValidData )
  312. {
  313. cullMode = parent.CullModeHelper.CurrentCullMode;
  314. }
  315. m_stencilBufferHelper.Draw( owner, cullMode, false );
  316. }
  317. m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty;
  318. if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid )
  319. m_tagsHelper.Draw( owner, false );
  320. m_isDirty = m_isDirty || m_tagsHelper.IsDirty;
  321. if( currentModule.PragmaTag.IsValid )
  322. {
  323. //m_additionalDefines.Draw( owner );
  324. //m_additionalIncludes.Draw( owner );
  325. //m_additionalPragmas.Draw( owner );
  326. m_additionalDirectives.Draw( owner , false);
  327. }
  328. m_isDirty = m_isDirty ||
  329. //m_additionalDefines.IsDirty ||
  330. //m_additionalIncludes.IsDirty ||
  331. //m_additionalPragmas.IsDirty ||
  332. m_additionalDirectives.IsDirty;
  333. }
  334. public void Destroy()
  335. {
  336. m_shaderModelHelper = null;
  337. m_blendOpHelper = null;
  338. m_blendOpHelper1 = null;
  339. m_blendOpHelper2 = null;
  340. m_blendOpHelper3 = null;
  341. m_cullModeHelper = null;
  342. m_alphaToMaskHelper = null;
  343. m_colorMaskHelper.Destroy();
  344. m_colorMaskHelper = null;
  345. m_colorMaskHelper1.Destroy();
  346. m_colorMaskHelper1 = null;
  347. m_colorMaskHelper2.Destroy();
  348. m_colorMaskHelper2 = null;
  349. m_colorMaskHelper3.Destroy();
  350. m_colorMaskHelper3 = null;
  351. m_stencilBufferHelper.Destroy();
  352. m_stencilBufferHelper = null;
  353. m_tagsHelper.Destroy();
  354. m_tagsHelper = null;
  355. m_additionalDefines.Destroy();
  356. m_additionalDefines = null;
  357. m_additionalIncludes.Destroy();
  358. m_additionalIncludes = null;
  359. m_additionalPragmas.Destroy();
  360. m_additionalPragmas = null;
  361. m_additionalDirectives.Destroy();
  362. m_additionalDirectives = null;
  363. }
  364. public string GenerateAllModulesString( bool isSubShader )
  365. {
  366. string moduleBody = string.Empty;
  367. if( !ShaderModelHelper.IndependentModule )
  368. {
  369. moduleBody += ShaderModelHelper.GenerateShaderData( isSubShader ) + "\n";
  370. }
  371. if( !BlendOpHelper.IndependentModule )
  372. {
  373. if( BlendOpHelper.BlendModeEnabled )
  374. moduleBody += BlendOpHelper.CurrentBlendFactor + "\n";
  375. if( BlendOpHelper.BlendOpActive )
  376. moduleBody += BlendOpHelper.CurrentBlendOp + "\n";
  377. }
  378. if( !AlphaToMaskHelper.IndependentModule )
  379. moduleBody += AlphaToMaskHelper.GenerateShaderData( isSubShader ) + "\n";
  380. if( !CullModeHelper.IndependentModule )
  381. moduleBody += CullModeHelper.GenerateShaderData( isSubShader ) + "\n";
  382. if( !ColorMaskHelper.IndependentModule )
  383. moduleBody += ColorMaskHelper.GenerateShaderData( isSubShader ) + "\n";
  384. if( !DepthOphelper.IndependentModule )
  385. {
  386. moduleBody += DepthOphelper.CurrentZWriteMode;
  387. moduleBody += DepthOphelper.CurrentZTestMode;
  388. if( DepthOphelper.OffsetEnabled )
  389. moduleBody += DepthOphelper.CurrentOffset;
  390. }
  391. if( !StencilBufferHelper.IndependentModule && StencilBufferHelper.Active )
  392. {
  393. CullMode cullMode = ( CullModeHelper.ValidData ) ? CullModeHelper.CurrentCullMode : CullMode.Back;
  394. moduleBody += StencilBufferHelper.CreateStencilOp( cullMode );
  395. }
  396. return moduleBody;
  397. }
  398. public void ReadFromString( ref uint index, ref string[] nodeParams )
  399. {
  400. try
  401. {
  402. m_blendOpHelper.ReadFromString( ref index, ref nodeParams );
  403. }
  404. catch( Exception e )
  405. {
  406. Debug.LogException( e );
  407. }
  408. if( UIUtils.CurrentShaderVersion() > 18103 )
  409. {
  410. try
  411. {
  412. m_blendOpHelper1.ReadFromString( ref index, ref nodeParams );
  413. }
  414. catch( Exception e )
  415. {
  416. Debug.LogException( e );
  417. }
  418. try
  419. {
  420. m_blendOpHelper2.ReadFromString( ref index, ref nodeParams );
  421. }
  422. catch( Exception e )
  423. {
  424. Debug.LogException( e );
  425. }
  426. try
  427. {
  428. m_blendOpHelper3.ReadFromString( ref index, ref nodeParams );
  429. }
  430. catch( Exception e )
  431. {
  432. Debug.LogException( e );
  433. }
  434. try
  435. {
  436. m_alphaToMaskHelper.ReadFromString( ref index, ref nodeParams );
  437. }
  438. catch( Exception e )
  439. {
  440. Debug.LogException( e );
  441. }
  442. }
  443. try
  444. {
  445. m_cullModeHelper.ReadFromString( ref index, ref nodeParams );
  446. }
  447. catch( Exception e )
  448. {
  449. Debug.LogException( e );
  450. }
  451. try
  452. {
  453. m_colorMaskHelper.ReadFromString( ref index, ref nodeParams );
  454. }
  455. catch( Exception e )
  456. {
  457. Debug.LogException( e );
  458. }
  459. if( UIUtils.CurrentShaderVersion() > 18103 )
  460. {
  461. try
  462. {
  463. m_colorMaskHelper1.ReadFromString( ref index, ref nodeParams );
  464. }
  465. catch( Exception e )
  466. {
  467. Debug.LogException( e );
  468. }
  469. try
  470. {
  471. m_colorMaskHelper2.ReadFromString( ref index, ref nodeParams );
  472. }
  473. catch( Exception e )
  474. {
  475. Debug.LogException( e );
  476. }
  477. try
  478. {
  479. m_colorMaskHelper3.ReadFromString( ref index, ref nodeParams );
  480. }
  481. catch( Exception e )
  482. {
  483. Debug.LogException( e );
  484. }
  485. }
  486. try
  487. {
  488. m_stencilBufferHelper.ReadFromString( ref index, ref nodeParams );
  489. }
  490. catch( Exception e )
  491. {
  492. Debug.LogException( e );
  493. }
  494. try
  495. {
  496. m_depthOphelper.ReadFromString( ref index, ref nodeParams );
  497. }
  498. catch( Exception e )
  499. {
  500. Debug.LogException( e );
  501. }
  502. try
  503. {
  504. m_tagsHelper.ReadFromString( ref index, ref nodeParams );
  505. }
  506. catch( Exception e )
  507. {
  508. Debug.LogException( e );
  509. }
  510. try
  511. {
  512. m_shaderModelHelper.ReadFromString( ref index, ref nodeParams );
  513. }
  514. catch( Exception e )
  515. {
  516. Debug.LogException( e );
  517. }
  518. if( UIUtils.CurrentShaderVersion() < 15312 )
  519. {
  520. try
  521. {
  522. m_additionalDefines.ReadFromString( ref index, ref nodeParams );
  523. }
  524. catch( Exception e )
  525. {
  526. Debug.LogException( e );
  527. }
  528. try
  529. {
  530. m_additionalPragmas.ReadFromString( ref index, ref nodeParams );
  531. }
  532. catch( Exception e )
  533. {
  534. Debug.LogException( e );
  535. }
  536. try
  537. {
  538. m_additionalIncludes.ReadFromString( ref index, ref nodeParams );
  539. }
  540. catch( Exception e )
  541. {
  542. Debug.LogException( e );
  543. }
  544. m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.ItemsList );
  545. m_additionalDirectives.AddItems( AdditionalLineType.Define, m_additionalDefines.ItemsList );
  546. m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.ItemsList );
  547. }
  548. else
  549. {
  550. try
  551. {
  552. m_additionalDirectives.ReadFromString( ref index, ref nodeParams );
  553. }
  554. catch( Exception e )
  555. {
  556. Debug.LogException( e );
  557. }
  558. }
  559. }
  560. public void WriteToString( ref string nodeInfo )
  561. {
  562. m_blendOpHelper.WriteToString( ref nodeInfo );
  563. m_blendOpHelper1.WriteToString( ref nodeInfo );
  564. m_blendOpHelper2.WriteToString( ref nodeInfo );
  565. m_blendOpHelper3.WriteToString( ref nodeInfo );
  566. m_alphaToMaskHelper.WriteToString( ref nodeInfo );
  567. m_cullModeHelper.WriteToString( ref nodeInfo );
  568. m_colorMaskHelper.WriteToString( ref nodeInfo );
  569. m_colorMaskHelper1.WriteToString( ref nodeInfo );
  570. m_colorMaskHelper2.WriteToString( ref nodeInfo );
  571. m_colorMaskHelper3.WriteToString( ref nodeInfo );
  572. m_stencilBufferHelper.WriteToString( ref nodeInfo );
  573. m_depthOphelper.WriteToString( ref nodeInfo );
  574. m_tagsHelper.WriteToString( ref nodeInfo );
  575. m_shaderModelHelper.WriteToString( ref nodeInfo );
  576. //m_additionalDefines.WriteToString( ref nodeInfo );
  577. //m_additionalPragmas.WriteToString( ref nodeInfo );
  578. //m_additionalIncludes.WriteToString( ref nodeInfo );
  579. m_additionalDirectives.WriteToString( ref nodeInfo );
  580. }
  581. public TemplatesBlendModule BlendOpHelper { get { return m_blendOpHelper; } }
  582. public TemplatesBlendModule BlendOpHelper1 { get { return m_blendOpHelper1; } }
  583. public TemplatesBlendModule BlendOpHelper2 { get { return m_blendOpHelper2; } }
  584. public TemplatesBlendModule BlendOpHelper3 { get { return m_blendOpHelper3; } }
  585. public TemplateAlphaToMaskModule AlphaToMaskHelper { get { return m_alphaToMaskHelper; } }
  586. public TemplateCullModeModule CullModeHelper { get { return m_cullModeHelper; } }
  587. public TemplateColorMaskModule ColorMaskHelper { get { return m_colorMaskHelper; } }
  588. public TemplateColorMaskModule ColorMaskHelper1 { get { return m_colorMaskHelper1; } }
  589. public TemplateColorMaskModule ColorMaskHelper2 { get { return m_colorMaskHelper2; } }
  590. public TemplateColorMaskModule ColorMaskHelper3 { get { return m_colorMaskHelper3; } }
  591. public TemplatesStencilBufferModule StencilBufferHelper { get { return m_stencilBufferHelper; } }
  592. public TemplateDepthModule DepthOphelper { get { return m_depthOphelper; } }
  593. public TemplateTagsModule TagsHelper { get { return m_tagsHelper; } }
  594. public TemplateShaderModelModule ShaderModelHelper { get { return m_shaderModelHelper; } }
  595. //public TemplateAdditionalIncludesHelper AdditionalIncludes { get { return m_additionalIncludes; } }
  596. //public TemplateAdditionalDefinesHelper AdditionalDefines { get { return m_additionalDefines; } }
  597. //public TemplateAdditionalPragmasHelper AdditionalPragmas { get { return m_additionalPragmas; } }
  598. public TemplateAdditionalDirectivesHelper AdditionalDirectives { get { return m_additionalDirectives; } }
  599. public bool AllModulesMode { get { return m_allModulesMode; } }
  600. public bool HasValidData { get { return m_hasValidData; } }
  601. public bool IsDirty
  602. {
  603. get { return m_isDirty; }
  604. set
  605. {
  606. m_isDirty = value;
  607. if( !value )
  608. {
  609. m_blendOpHelper.IsDirty = false;
  610. m_blendOpHelper1.IsDirty = false;
  611. m_blendOpHelper2.IsDirty = false;
  612. m_blendOpHelper3.IsDirty = false;
  613. m_cullModeHelper.IsDirty = false;
  614. m_alphaToMaskHelper.IsDirty = false;
  615. m_colorMaskHelper.IsDirty = false;
  616. m_colorMaskHelper1.IsDirty = false;
  617. m_colorMaskHelper2.IsDirty = false;
  618. m_colorMaskHelper3.IsDirty = false;
  619. m_stencilBufferHelper.IsDirty = false;
  620. m_tagsHelper.IsDirty = false;
  621. m_shaderModelHelper.IsDirty = false;
  622. //m_additionalDefines.IsDirty = false;
  623. //m_additionalPragmas.IsDirty = false;
  624. //m_additionalIncludes.IsDirty = false;
  625. m_additionalDirectives.IsDirty = false;
  626. }
  627. }
  628. }
  629. // public bool Foldout { get { return m_foldout; } set { m_foldout = value; } }
  630. }
  631. }