설명 없음
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.

CustomTextureSubTarget.cs 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using UnityEditor.ShaderGraph;
  5. using UnityEditor.ShaderGraph.Legacy;
  6. namespace UnityEditor.Rendering.CustomRenderTexture.ShaderGraph
  7. {
  8. sealed class CustomTextureSubTarget : SubTarget<CustomRenderTextureTarget>
  9. {
  10. const string kAssetGuid = "5b2d4724a38a5485ba5e7dc2f7d86f1a"; // CustomTextureSubTarget.cs
  11. internal static FieldDescriptor colorField = new FieldDescriptor(String.Empty, "Color", string.Empty);
  12. public CustomTextureSubTarget()
  13. {
  14. isHidden = false;
  15. displayName = "Custom Render Texture";
  16. }
  17. public override bool IsActive() => true;
  18. public override void Setup(ref TargetSetupContext context)
  19. {
  20. context.AddAssetDependency(new GUID(kAssetGuid), AssetCollection.Flags.SourceDependency);
  21. context.AddSubShader(SubShaders.CustomRenderTexture);
  22. }
  23. public override void GetFields(ref TargetFieldContext context)
  24. {
  25. context.AddField(colorField, true);
  26. }
  27. public override void GetActiveBlocks(ref TargetActiveBlockContext context)
  28. {
  29. context.AddBlock(BlockFields.SurfaceDescription.BaseColor);
  30. context.AddBlock(BlockFields.SurfaceDescription.Alpha);
  31. }
  32. public override void GetPropertiesGUI(ref TargetPropertyGUIContext context, Action onChange, Action<String> registerUndo)
  33. {
  34. }
  35. static class SubShaders
  36. {
  37. public static SubShaderDescriptor CustomRenderTexture = new SubShaderDescriptor()
  38. {
  39. generatesPreview = true,
  40. passes = new PassCollection
  41. {
  42. { FullscreePasses.CustomRenderTexture },
  43. },
  44. };
  45. }
  46. }
  47. }