Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.0.0] - 2019-10-30
### Changes
- Updated TMP Examples & Extras to remove CanvasRenderer from text objects in example scenes.
- CanvasRenderer component will now be removed from existing text objects that contains this unnecessary component.
- Editing a prefab that contains a normal <TextMeshPro> component will no longer open the prefab in Canvas mode. Case #1103782 and Case #1188483
  • Loading branch information
Unity Technologies committed Apr 24, 2020
1 parent 6ee2477 commit 9382215
Show file tree
Hide file tree
Showing 63 changed files with 3,009 additions and 5,392 deletions.
139 changes: 11 additions & 128 deletions CHANGELOG.md

Large diffs are not rendered by default.

75 changes: 0 additions & 75 deletions Editor Resources/Shaders/TMP_SDF Internal Editor.shader

This file was deleted.

126 changes: 126 additions & 0 deletions Editor Resources/Shaders/TMP_SDF Internal SSD.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// Simplified SDF shader:
// - No Shading Option (bevel / bump / env map)
// - No Glow Option
// - Softness is applied on both side of the outline

Shader "Hidden/TextMeshPro/Internal/Distance Field SSD" {

Properties {
_FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0

_OutlineSoftness ("Outline Softness", Range(0,1)) = 0.02

_WeightNormal ("Weight Normal", float) = 0
_WeightBold ("Weight Bold", float) = .5

_MainTex ("Font Atlas", 2D) = "white" {}
_TextureWidth ("Texture Width", float) = 512
_TextureHeight ("Texture Height", float) = 512
_GradientScale ("Gradient Scale", float) = 5
_ScaleX ("Scale X", float) = 1
_ScaleY ("Scale Y", float) = 1
_Sharpness ("Sharpness", Range(-1,1)) = 0

_VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0

_ColorMask ("Color Mask", Float) = 15
}

SubShader {
Tags
{
"ForceSupported" = "True"
}

Lighting Off
Blend One OneMinusSrcAlpha
Cull Off
ZWrite Off
ZTest Always

Pass {
CGPROGRAM
#pragma vertex VertShader
#pragma fragment PixShader

#include "UnityCG.cginc"
#include "TMP_Properties.cginc"

sampler2D _GUIClipTexture;
uniform float4x4 unity_GUIClipTextureMatrix;

struct vertex_t {
float4 vertex : POSITION;
float3 normal : NORMAL;
fixed4 color : COLOR;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};

struct pixel_t {
float4 vertex : SV_POSITION;
fixed4 faceColor : COLOR;
float2 texcoord0 : TEXCOORD0;
float2 clipUV : TEXCOORD1;
};


pixel_t VertShader(vertex_t input)
{
// Does not handle simulated bold correctly.

float4 vert = input.vertex;
vert.x += _VertexOffsetX;
vert.y += _VertexOffsetY;
float4 vPosition = UnityObjectToClipPos(vert);

float opacity = input.color.a;

fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor;
faceColor.rgb *= faceColor.a;

// Generate UV for the Clip Texture
float3 eyePos = UnityObjectToViewPos(input.vertex);
float2 clipUV = mul(unity_GUIClipTextureMatrix, float4(eyePos.xy, 0, 1.0));

// Structure for pixel shader
pixel_t output = {
vPosition,
faceColor,
float2(input.texcoord0.x, input.texcoord0.y),
clipUV,
};

return output;
}

half transition(half2 range, half distance)
{
return smoothstep(range.x, range.y, distance);
}

// PIXEL SHADER
fixed4 PixShader(pixel_t input) : SV_Target
{
half distanceSample = tex2D(_MainTex, input.texcoord0).a;
half smoothing = fwidth(distanceSample) * (1 - _Sharpness) + _OutlineSoftness;
half contour = 0.5 - _FaceDilate * 0.5;
half2 edgeRange = half2(contour - smoothing, contour + smoothing);

half4 c = input.faceColor;

half edgeTransition = transition(edgeRange, distanceSample);
c *= edgeTransition;

c *= tex2D(_GUIClipTexture, input.clipUV).a;

return c;
}
ENDCG
}
}

CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 0 additions & 132 deletions Editor Resources/Shaders/TMP_SDF_SSD.cginc

This file was deleted.

9 changes: 0 additions & 9 deletions Editor Resources/Shaders/TMP_SDF_SSD.cginc.meta

This file was deleted.

Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
Binary file modified Package Resources/TMP Examples & Extras.unitypackage
Binary file not shown.
6 changes: 3 additions & 3 deletions Scripts/Editor/GlyphMetricsPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
// We get Rect since a valid position may not be provided by the caller.
Rect rect = new Rect(position.x, position.y, position.width, 49);

EditorGUI.LabelField(new Rect(rect.x, rect.y - 2.5f, rect.width, 18), new GUIContent("Glyph Metrics"));
EditorGUI.LabelField(rect, new GUIContent("Glyph Metrics"));

EditorGUIUtility.labelWidth = 50f;
EditorGUIUtility.fieldWidth = 15f;
EditorGUIUtility.labelWidth = 30f;
EditorGUIUtility.fieldWidth = 10f;

//GUI.enabled = false;
float width = (rect.width - 75f) / 2;
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Editor/GlyphRectPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten

// We get Rect since a valid position may not be provided by the caller.
Rect rect = new Rect(position.x, position.y, position.width, 49);
EditorGUI.LabelField(new Rect(rect.x, rect.y - 2.5f, rect.width, 18), new GUIContent("Glyph Rect"));
EditorGUI.LabelField(rect, new GUIContent("Glyph Rect"));

EditorGUIUtility.labelWidth = 50f;
EditorGUIUtility.fieldWidth = 20f;
EditorGUIUtility.labelWidth = 30f;
EditorGUIUtility.fieldWidth = 10f;

//GUI.enabled = false;
float width = (rect.width - 75f) / 4;
Expand Down
Loading

0 comments on commit 9382215

Please sign in to comment.