From 14937e1a6180a7f54a12a7ecf732606c38c99643 Mon Sep 17 00:00:00 2001 From: RSlysz Date: Tue, 6 Apr 2021 12:44:43 +0200 Subject: [PATCH 1/2] Allows negative UV --- .../Editor/Material/Decal/DecalProjectorEditor.cs | 2 +- .../Editor/Material/Decal/DisplacableRectHandles.cs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalProjectorEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalProjectorEditor.cs index 1351301e735..74e5a6cbaad 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalProjectorEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalProjectorEditor.cs @@ -119,7 +119,7 @@ static DisplacableRectHandles uvHandles get { if (s_uvHandles == null || s_uvHandles.Equals(null)) - s_uvHandles = new DisplacableRectHandles(s_LastColor); + s_uvHandles = new DisplacableRectHandles(s_LastColor, allowsNegative: true); return s_uvHandles; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DisplacableRectHandles.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DisplacableRectHandles.cs index 6579041a564..b3e12138ddf 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DisplacableRectHandles.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DisplacableRectHandles.cs @@ -15,6 +15,7 @@ enum NamedEdge { Right, Top, Left, Bottom, None } Color m_MonochromeHandleColor; Color m_WireframeColor; Color m_WireframeColorBehind; + bool allowsNegative; /// The position of the center of the box in Handle.matrix space. On plane z=0. public Vector2 center { get; set; } @@ -58,9 +59,10 @@ public Color baseColor } } - public DisplacableRectHandles(Color baseColor) + public DisplacableRectHandles(Color baseColor, bool allowsNegative = false) { this.baseColor = baseColor; + this.allowsNegative = allowsNegative; } /// Draw the rect. @@ -258,7 +260,8 @@ public void DrawHandle() case NamedEdge.Bottom: topPosition.y -= delta; break; } - EnsureEdgeFacesOutsideForSymetry(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition); + if (!allowsNegative) + EnsureEdgeFacesOutsideForSymetry(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition); } if (useHomothety) @@ -278,13 +281,14 @@ public void DrawHandle() break; } - EnsureEdgeFacesOutsideForHomothety(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition); + if (!allowsNegative) + EnsureEdgeFacesOutsideForHomothety(theChangedEdge, ref leftPosition, ref rightPosition, ref topPosition, ref bottomPosition); } var max = new Vector2(rightPosition.x, topPosition.y); var min = new Vector2(leftPosition.x, bottomPosition.y); - if (!useSymetry && !useHomothety) + if (!useSymetry && !useHomothety && !allowsNegative) EnsureEdgeFacesOutsideForOtherTransformation(ref max, ref min); center = (max + min) * .5f; From d076fc22cc5f58cdbbd839045ef9074e01388fcd Mon Sep 17 00:00:00 2001 From: RSlysz Date: Tue, 6 Apr 2021 13:59:05 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 81158c24c67..6719018d7f8 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -135,6 +135,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a bug with Reflection Probe baking would result in an incorrect baking reusing other's Reflection Probe baking - Fixed volumetric fog being visually chopped or missing when using hardware Dynamic Resolution Scaling. - Fixed generation of the packed depth pyramid when hardware Dynamic Resolution Scaling is enabled. +- Fixed Decal's UV edit mode with negative UV ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard