-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to use texture tiling and offset on texture2ds (#4185)
* add ability to use texture tiling and offset on texture2ds * minor code review fixes and adding SplitTextureTransformNode * more code review notes and minor bugfixes * more code review changes and bump subgraph version for reimport * formatting * fixing a bug with the parallax occlusion mapping node, and changing the title of the split texture transform node * fixing node name * make normalfromtexture use tiling correctly, and added copy support for the use tiling flag * formatting * fixing bad merge * fixing more bad merges and a bug I noticed while reviewing output code * Update CHANGELOG.md
- Loading branch information
1 parent
71761d8
commit 65776ae
Showing
11 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
40 changes: 40 additions & 0 deletions
40
com.unity.shadergraph/Editor/Data/Nodes/Utility/SplitTextureTransformNode.cs
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,40 @@ | ||
using System.Reflection; | ||
using UnityEngine; | ||
|
||
namespace UnityEditor.ShaderGraph | ||
{ | ||
[Title("Input", "Texture", "Split Texture Transform")] | ||
class SplitTextureTransformNode : CodeFunctionNode | ||
{ | ||
public override bool hasPreview { get { return false; } } | ||
public SplitTextureTransformNode() | ||
{ | ||
name = "Split Texture Transform"; | ||
} | ||
|
||
protected override MethodInfo GetFunctionToConvert() | ||
{ | ||
return GetType().GetMethod("Unity_SplitTextureTransform", BindingFlags.Static | BindingFlags.NonPublic); | ||
} | ||
|
||
static string Unity_SplitTextureTransform( | ||
[Slot(0, Binding.None)] Texture2D In, | ||
[Slot(1, Binding.None)] out Vector2 Tiling, | ||
[Slot(2, Binding.None)] out Vector2 Offset, | ||
[Slot(3, Binding.None)] out Texture2D TextureOnly) | ||
{ | ||
TextureOnly = default; | ||
Tiling = default; | ||
Offset = default; | ||
return | ||
@" | ||
{ | ||
TextureOnly = In; | ||
TextureOnly.scaleTranslate = float4(1.0f, 1.0f, 0.0f, 0.0f); | ||
Tiling = In.scaleTranslate.xy; | ||
Offset = In.scaleTranslate.zw; | ||
} | ||
"; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
com.unity.shadergraph/Editor/Data/Nodes/Utility/SplitTextureTransformNode.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