Adaug proiectul Unity

This commit is contained in:
2026-11-01 23:39:55 +02:00
parent cb14d9d37d
commit 863eac8f2c
23463 changed files with 5412601 additions and 0 deletions
@@ -0,0 +1,54 @@
using UnityEditor.Graphing;
using UnityEditor.Rendering.UITK.ShaderGraph;
using UnityEditor.ShaderGraph.Internal;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "UI", "Element Layout UV")]
[SubTargetFilter(typeof(IUISubTarget))]
class ElementLayoutUV : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK, IMayRequireMeshUV
{
public const int LayoutUVSlotId = 0;
private const string kLayoutUVSlotName = "Layout UV";
public override bool hasPreview { get { return false; } }
public ElementLayoutUV()
{
name = "Element Layout UV";
synonyms = new string[] {};
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector2MaterialSlot(LayoutUVSlotId, kLayoutUVSlotName, kLayoutUVSlotName, SlotType.Output, Vector2.zero));
RemoveSlotsNameNotMatching(new[] { LayoutUVSlotId });
}
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
{
if (generationMode == GenerationMode.Preview)
{
// In preview mode, use standard mesh UV0 (will visualize as color: red = u, green = v)
sb.AppendLine("$precision2 {0} = IN.uv0.xy;", GetVariableNameForSlot(LayoutUVSlotId));
return;
}
if (GetInputNodeFromSlot(LayoutUVSlotId) != null) sb.AppendLine("$precision2 {0} = IN.layoutUV.xy;", GetVariableNameForSlot(LayoutUVSlotId));
}
public bool RequiresUITK(ShaderStageCapability stageCapability)
{
return true;
}
public bool RequiresMeshUV(UVChannel channel, ShaderStageCapability stageCapability)
{
// Require UV0 in preview mode for visualization
return channel == UVChannel.UV0;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1c399b7101e358243b51be6c8482c892
@@ -0,0 +1,52 @@
using UnityEditor.Graphing;
using UnityEditor.Rendering.UITK.ShaderGraph;
using UnityEditor.ShaderGraph.Internal;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "UI", "Element Opacity")]
[SubTargetFilter(typeof(IUISubTarget))]
class ElementOpacityNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK
{
public const int OpacitySlotId = 0;
private const string kOpacitySlotName = "Opacity";
public override bool hasPreview { get { return false; } }
public ElementOpacityNode()
{
name = "Element Opacity";
synonyms = new string[] { "alpha", "fade" };
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector1MaterialSlot(OpacitySlotId, kOpacitySlotName, kOpacitySlotName, SlotType.Output, 1.0f));
RemoveSlotsNameNotMatching(new[] { OpacitySlotId });
}
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
{
string opacityVar = GetVariableNameForSlot(OpacitySlotId);
if (generationMode == GenerationMode.Preview)
{
// No element data is bound in preview; show the identity opacity.
sb.AppendLine("$precision {0} = 1.0;", opacityVar);
return;
}
// The per-element opacity the vertex reads. Applied automatically at the end of the fragment
// unless Automatic Opacity is disabled in the Graph Settings, in which case apply it yourself.
sb.AppendLine("$precision {0} = IN.opacity;", opacityVar);
}
public bool RequiresUITK(ShaderStageCapability stageCapability)
{
return true;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 44fbba7da9553af45b5def0cd4888af3
@@ -0,0 +1,72 @@
using UnityEditor.Graphing;
using UnityEditor.Rendering.UITK.ShaderGraph;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "UI", "Element Texture Size")]
[SubTargetFilter(typeof(IUISubTarget))]
class ElementTextureUVSize : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK
{
public const int TextureWidthSlotId = 0;
public const int TextureHeightSlotId = 1;
public const int TexelWidthSlotId = 2;
public const int TexelHeightSlotId = 3;
private const string kTextureWidthName = "Width";
private const string kTextureHeightName = "Height";
private const string kTexelWidthName = "Texel Width";
private const string kTexelHeightName = "Texel Height";
public override bool hasPreview { get { return false; } }
public ElementTextureUVSize()
{
name = "Element Texture Size";
synonyms = new string[] {};
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector1MaterialSlot(TextureWidthSlotId, kTextureWidthName, kTextureWidthName, SlotType.Output, 0.0f));
AddSlot(new Vector1MaterialSlot(TextureHeightSlotId, kTextureHeightName, kTextureHeightName, SlotType.Output, 0.0f));
AddSlot(new Vector1MaterialSlot(TexelWidthSlotId, kTexelWidthName, kTexelWidthName, SlotType.Output, 0.0f));
AddSlot(new Vector1MaterialSlot(TexelHeightSlotId, kTexelHeightName, kTexelHeightName, SlotType.Output, 0.0f));
RemoveSlotsNameNotMatching(new[] { TextureWidthSlotId, TextureHeightSlotId, TexelWidthSlotId, TexelHeightSlotId });
}
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
{
if (generationMode == GenerationMode.Preview)
{
// In preview mode, return default values (1.0)
if (GetInputNodeFromSlot(TextureWidthSlotId) != null) sb.AppendLine("$precision1 {0} = 1.0;", GetVariableNameForSlot(TextureWidthSlotId));
if (GetInputNodeFromSlot(TextureHeightSlotId) != null) sb.AppendLine("$precision1 {0} = 1.0;", GetVariableNameForSlot(TextureHeightSlotId));
if (GetInputNodeFromSlot(TexelWidthSlotId) != null) sb.AppendLine("$precision1 {0} = 1.0;", GetVariableNameForSlot(TexelWidthSlotId));
if (GetInputNodeFromSlot(TexelHeightSlotId) != null) sb.AppendLine("$precision1 {0} = 1.0;", GetVariableNameForSlot(TexelHeightSlotId));
return;
}
if ((GetInputNodeFromSlot(TextureWidthSlotId) != null) ||
(GetInputNodeFromSlot(TextureHeightSlotId) != null) ||
(GetInputNodeFromSlot(TexelWidthSlotId) != null) ||
(GetInputNodeFromSlot(TexelHeightSlotId) != null))
{
string variableName = string.Format("TextureInfo_{0}", objectId.ToString());
sb.AppendLine(string.Format("TextureInfo {0} = GetTextureInfo(IN.typeTexSettings.y);", variableName));
if (GetInputNodeFromSlot(TextureWidthSlotId) != null) sb.AppendLine(string.Format("$precision1 {0} = {1}.textureSize.x;", GetVariableNameForSlot(TextureWidthSlotId), variableName));
if (GetInputNodeFromSlot(TextureHeightSlotId) != null) sb.AppendLine(string.Format("$precision1 {0} = {1}.textureSize.y;", GetVariableNameForSlot(TextureHeightSlotId), variableName));
if (GetInputNodeFromSlot(TexelWidthSlotId) != null) sb.AppendLine(string.Format("$precision1 {0} = {1}.texelSize.x;", GetVariableNameForSlot(TexelWidthSlotId), variableName));
if (GetInputNodeFromSlot(TexelHeightSlotId) != null) sb.AppendLine(string.Format("$precision1 {0} = {1}.texelSize.y;", GetVariableNameForSlot(TexelHeightSlotId), variableName));
}
}
public bool RequiresUITK(ShaderStageCapability stageCapability)
{
return true;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2065162ee28baee4dbc14fccf4a6c3fd
@@ -0,0 +1,54 @@
using UnityEditor.Graphing;
using UnityEditor.Rendering.UITK.ShaderGraph;
using UnityEditor.ShaderGraph.Internal;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "UI", "Element Texture UV")]
[SubTargetFilter(typeof(IUISubTarget))]
class ElementTextureUVNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK, IMayRequireMeshUV
{
public const int TextureUVSlotId = 0;
private const string kTextureUVSlotName = "Texture UV";
public override bool hasPreview { get { return false; } }
public ElementTextureUVNode()
{
name = "Element Texture UV";
synonyms = new string[] {};
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector2MaterialSlot(TextureUVSlotId, kTextureUVSlotName, kTextureUVSlotName, SlotType.Output, Vector2.zero));
RemoveSlotsNameNotMatching(new[] { TextureUVSlotId });
}
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
{
if (generationMode == GenerationMode.Preview)
{
// In preview mode, use standard mesh UV0 (will visualize as color: red = u, green = v)
sb.AppendLine("$precision2 {0} = IN.uv0.xy;", GetVariableNameForSlot(TextureUVSlotId));
return;
}
if (GetInputNodeFromSlot(TextureUVSlotId) != null) sb.AppendLine("$precision2 {0} = IN.uvClip.xy;", GetVariableNameForSlot(TextureUVSlotId));
}
public bool RequiresUITK(ShaderStageCapability stageCapability)
{
return true;
}
public bool RequiresMeshUV(UVChannel channel, ShaderStageCapability stageCapability)
{
// Require UV0 in preview mode for visualization
return channel == UVChannel.UV0;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 917ad6055d0c59f4aa7fe4ffa65b272a
@@ -0,0 +1,52 @@
using UnityEditor.Graphing;
using UnityEditor.Rendering.UITK.ShaderGraph;
using UnityEditor.ShaderGraph.Internal;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Input", "UI", "Element Tint")]
[SubTargetFilter(typeof(IUISubTarget))]
class ElementTintNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireUITK
{
public const int TintSlotId = 0;
private const string kTintSlotName = "Tint";
public override bool hasPreview { get { return false; } }
public ElementTintNode()
{
name = "Element Tint";
synonyms = new string[] { "color", "vertex color", "dynamic color" };
UpdateNodeAfterDeserialization();
}
public override void UpdateNodeAfterDeserialization()
{
AddSlot(new ColorRGBAMaterialSlot(TintSlotId, kTintSlotName, kTintSlotName, SlotType.Output, Vector4.one));
RemoveSlotsNameNotMatching(new[] { TintSlotId });
}
public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode)
{
string tintVar = GetVariableNameForSlot(TintSlotId);
if (generationMode == GenerationMode.Preview)
{
// No element / dynamic-color data is bound in preview; show the identity tint.
sb.AppendLine("$precision4 {0} = $precision4(1.0, 1.0, 1.0, 1.0);", tintVar);
return;
}
// The straight tint (vertexColor * dynamicColor), interpolated in the fragment. It does not
// include the per-element opacity (see the Element Opacity node).
sb.AppendLine("$precision4 {0} = IN.color;", tintVar);
}
public bool RequiresUITK(ShaderStageCapability stageCapability)
{
return true;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1aa5997e0f5062c479ca5217c247f550