-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [3.2.0-pre.1] - 2021-08-06
- Loading branch information
Unity Technologies
committed
Aug 6, 2021
1 parent
5671be3
commit 9737d20
Showing
95 changed files
with
8,254 additions
and
1,386 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
ValidationExceptions.json.meta → ...e Resources/TMP Shaders.unitypackage.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#if HDRP_7_5_OR_NEWER | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
using UnityEditor.Rendering.HighDefinition; | ||
|
||
// Include material common properties names | ||
using static UnityEngine.Rendering.HighDefinition.HDMaterialProperties; | ||
|
||
namespace TMPro.EditorUtilities | ||
{ | ||
/// <summary> | ||
/// Common GUI for Lit ShaderGraphs | ||
/// </summary> | ||
internal class HDRP_LitShaderGUI : HDShaderGUI | ||
{ | ||
// For surface option shader graph we only want all unlit features but alpha clip and back then front rendering | ||
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Lit | ||
| SurfaceOptionUIBlock.Features.ShowDepthOffsetOnly; | ||
|
||
const EmissionUIBlock.Features emissionFeatures = EmissionUIBlock.Features.All ^ EmissionUIBlock.Features.EnableEmissionForGI; | ||
|
||
MaterialUIBlockList m_UIBlocks = new MaterialUIBlockList | ||
{ | ||
new SurfaceOptionUIBlock(MaterialUIBlock.Expandable.Base, features: surfaceOptionFeatures), | ||
new ShaderGraphUIBlock(MaterialUIBlock.Expandable.ShaderGraph), | ||
//new EmissionUIBlock(MaterialUIBlock.Expandable.Emissive), | ||
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, ~AdvancedOptionsUIBlock.Features.SpecularOcclusion) | ||
}; | ||
|
||
protected MaterialUIBlockList uiBlocks => m_UIBlocks; | ||
|
||
/// <summary> | ||
/// Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlock. | ||
/// </summary> | ||
/// <param name="materialEditor">The current material editor.</param> | ||
/// <param name="props">The list of properties the material has.</param> | ||
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props) | ||
{ | ||
using (var changed = new EditorGUI.ChangeCheckScope()) | ||
{ | ||
m_UIBlocks.OnGUI(materialEditor, props); | ||
ApplyKeywordsAndPassesIfNeeded(changed.changed, m_UIBlocks.materials); | ||
} | ||
} | ||
|
||
//const string kUVEmissive = "_UVEmissive"; | ||
|
||
/// <summary> | ||
/// Sets up the keywords and passes for a Lit Shader Graph material. | ||
/// </summary> | ||
/// <param name="material">The target material.</param> | ||
public static void SetupMaterialKeywordsAndPass(Material material) | ||
{ | ||
SynchronizeShaderGraphProperties(material); | ||
|
||
BaseLitGUI.SetupBaseLitKeywords(material); | ||
BaseLitGUI.SetupBaseLitMaterialPass(material); | ||
|
||
bool receiveSSR = false; | ||
if (material.GetSurfaceType() == SurfaceType.Transparent) | ||
receiveSSR = material.HasProperty(kReceivesSSRTransparent) ? material.GetFloat(kReceivesSSRTransparent) != 0 : false; | ||
else | ||
receiveSSR = material.HasProperty(kReceivesSSR) ? material.GetFloat(kReceivesSSR) != 0 : false; | ||
bool useSplitLighting = material.HasProperty(kUseSplitLighting) ? material.GetInt(kUseSplitLighting) != 0: false; | ||
BaseLitGUI.SetupStencil(material, receiveSSR, useSplitLighting); | ||
|
||
if (material.HasProperty(kAddPrecomputedVelocity)) | ||
CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0); | ||
|
||
/*if (material.HasProperty(kUVEmissive) && material.HasProperty(kEmissiveColorMap)) | ||
{ | ||
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_PLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Planar && material.GetTexture(kEmissiveColorMap)); | ||
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_TRIPLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Triplanar && material.GetTexture(kEmissiveColorMap)); | ||
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_BASE", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.SameAsBase && material.GetTexture(kEmissiveColorMap)); | ||
CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(kEmissiveColorMap)); | ||
}*/ | ||
} | ||
|
||
protected override void SetupMaterialKeywordsAndPassInternal(Material material) => SetupMaterialKeywordsAndPass(material); | ||
} | ||
} | ||
#endif |
3 changes: 2 additions & 1 deletion
3
Scripts/Editor/TMPro_FontPlugin.cs.meta → ...pts/Editor/HDRP/HDRP_LitShaderGUI.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#if HDRP_7_5_OR_NEWER | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEditor.Rendering.HighDefinition; | ||
|
||
|
||
namespace TMPro.EditorUtilities | ||
{ | ||
/// <summary> | ||
/// Common GUI for Lit ShaderGraphs | ||
/// </summary> | ||
internal class HDRP_UnlitShaderGUI : HDShaderGUI | ||
{ | ||
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit; | ||
|
||
MaterialUIBlockList m_UIBlocks = new MaterialUIBlockList | ||
{ | ||
new SurfaceOptionUIBlock(MaterialUIBlock.Expandable.Base, features: surfaceOptionFeatures), | ||
new ShaderGraphUIBlock(MaterialUIBlock.Expandable.ShaderGraph, ShaderGraphUIBlock.Features.Unlit), | ||
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, ~AdvancedOptionsUIBlock.Features.SpecularOcclusion) | ||
}; | ||
|
||
/// <summary>List of UI Blocks used to render the material inspector.</summary> | ||
protected MaterialUIBlockList uiBlocks => m_UIBlocks; | ||
|
||
/// <summary> | ||
/// Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlockList. | ||
/// </summary> | ||
/// <param name="materialEditor">The current material editor.</param> | ||
/// <param name="props">The list of properties the material has.</param> | ||
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props) | ||
{ | ||
using (var changed = new EditorGUI.ChangeCheckScope()) | ||
{ | ||
m_UIBlocks.OnGUI(materialEditor, props); | ||
ApplyKeywordsAndPassesIfNeeded(changed.changed, m_UIBlocks.materials); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Sets up the keywords and passes for the Unlit Shader Graph material you pass in. | ||
/// </summary> | ||
/// <param name="material">The target material.</param> | ||
public static void SetupUnlitKeywordsAndPass(Material material) | ||
{ | ||
SynchronizeShaderGraphProperties(material); | ||
UnlitGUI.SetupUnlitMaterialKeywordsAndPass(material); | ||
} | ||
|
||
/// <summary> | ||
/// Sets up the keywords and passes for the current selected material. | ||
/// </summary> | ||
/// <param name="material">The selected material.</param> | ||
protected override void SetupMaterialKeywordsAndPassInternal(Material material) => SetupUnlitKeywordsAndPass(material); | ||
} | ||
} | ||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.