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,94 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
using RenderQueue = UnityEngine.Rendering.RenderQueue;
using UnityEditor.ShaderGraph.Drawing;
namespace UnityEditor.Rendering.Canvas.ShaderGraph
{
public class CanvasShaderGUI : ShaderGUI
{
[Flags]
protected enum Expandable
{
SurfaceOptions = 1 << 0,
SurfaceInputs = 1 << 1,
}
protected class Styles
{
// Categories
public static readonly GUIContent SurfaceOptions =
EditorGUIUtility.TrTextContent("Surface Options",
"Controls the rendering states of the fullscreen material.");
public static readonly GUIContent SurfaceInputs = EditorGUIUtility.TrTextContent("Surface Inputs",
"These settings describe the look and feel of the surface itself.");
}
public bool m_FirstTimeApply = true;
// By default, everything is expanded
readonly MaterialHeaderScopeList m_MaterialScopeList = new MaterialHeaderScopeList(uint.MaxValue);
// These have to be stored due to how MaterialHeaderScopeList callbacks work (they don't provide this data in the callbacks)
MaterialEditor m_MaterialEditor;
MaterialProperty[] m_Properties;
private const int queueOffsetRange = 50;
override public void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
{
m_MaterialEditor = materialEditor;
m_Properties = properties;
Material targetMat = materialEditor.target as Material;
if (m_FirstTimeApply)
{
OnOpenGUI(targetMat, materialEditor, properties);
m_FirstTimeApply = false;
}
ShaderPropertiesGUI(materialEditor, targetMat, properties);
}
public virtual void OnOpenGUI(Material material, MaterialEditor materialEditor, MaterialProperty[] properties)
{
// Generate the foldouts
m_MaterialScopeList.RegisterHeaderScope(Styles.SurfaceInputs, (uint)Expandable.SurfaceInputs, DrawSurfaceInputs);
}
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
{
// Clear all keywords for fresh start
// Note: this will nuke user-selected custom keywords when they change shaders
material.shaderKeywords = null;
base.AssignNewShaderToMaterial(material, oldShader, newShader);
// Setup keywords based on the new shader
UnityEditor.Rendering.BuiltIn.ShaderUtils.ResetMaterialKeywords(material);
}
void ShaderPropertiesGUI(MaterialEditor materialEditor, Material material, MaterialProperty[] properties)
{
m_MaterialScopeList.DrawHeaders(materialEditor, material);
}
protected virtual void DrawSurfaceInputs(Material material)
{
DrawShaderGraphProperties(m_MaterialEditor, material, m_Properties);
}
static void DrawShaderGraphProperties(MaterialEditor materialEditor, Material material, MaterialProperty[] properties)
{
if (properties == null)
return;
ShaderGraphPropertyDrawers.DrawShaderGraphGUI(materialEditor, properties);
}
public override void ValidateMaterial(Material material) => SetupSurface(material);
public static void SetupSurface(Material material)
{
// For now there is no keyword in FullScreenShader.
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b2f79c44dead4bc3b025342e56828a27
timeCreated: 1670295364
@@ -0,0 +1,133 @@
Pass
{
$splice(PassName)
Tags
{
$splice(LightMode)
}
// Render State
$splice(RenderState)
// Debug
$splice(Debug)
// --------------------------------------------------
// Pass
HLSLPROGRAM
// Pragmas
$splice(PassPragmas)
// Keywords
$splice(PassKeywords)
$splice(GraphKeywords)
#define CANVAS_SHADERGRAPH
// Defines
#define _SURFACE_TYPE_TRANSPARENT 1
$AlphaClip: #define _AlphaClip 1
$Normal: #define _NORMALMAP 1
$BlendMode.Add: #define _BLENDMODE_ADD 1
$BlendMode.Premultiply: #define _ALPHAPREMULTIPLY_ON 1
$Attributes.normalOS: #define ATTRIBUTES_NEED_NORMAL
$Attributes.tangentOS: #define ATTRIBUTES_NEED_TANGENT
$Attributes.uv0: #define ATTRIBUTES_NEED_TEXCOORD0
$Attributes.uv1: #define ATTRIBUTES_NEED_TEXCOORD1
$Attributes.uv2: #define ATTRIBUTES_NEED_TEXCOORD2
$Attributes.uv3: #define ATTRIBUTES_NEED_TEXCOORD3
$Attributes.uv4: #define ATTRIBUTES_NEED_TEXCOORD4
$Attributes.uv5: #define ATTRIBUTES_NEED_TEXCOORD5
$Attributes.uv6: #define ATTRIBUTES_NEED_TEXCOORD6
$Attributes.uv7: #define ATTRIBUTES_NEED_TEXCOORD7
$Attributes.color: #define ATTRIBUTES_NEED_COLOR
$Attributes.vertexID: #define ATTRIBUTES_NEED_VERTEXID
$Attributes.instanceID: #define ATTRIBUTES_NEED_INSTANCEID
$Varyings.positionWS: #define VARYINGS_NEED_POSITION_WS
$Varyings.positionPredisplacementWS: #define VARYINGS_NEED_POSITIONPREDISPLACEMENT_WS
$Varyings.normalWS: #define VARYINGS_NEED_NORMAL_WS
$Varyings.tangentWS: #define VARYINGS_NEED_TANGENT_WS
$Varyings.texCoord0: #define VARYINGS_NEED_TEXCOORD0
$Varyings.texCoord1: #define VARYINGS_NEED_TEXCOORD1
$Varyings.texCoord2: #define VARYINGS_NEED_TEXCOORD2
$Varyings.texCoord3: #define VARYINGS_NEED_TEXCOORD3
$Varyings.texCoord4: #define VARYINGS_NEED_TEXCOORD4
$Varyings.texCoord5: #define VARYINGS_NEED_TEXCOORD5
$Varyings.texCoord6: #define VARYINGS_NEED_TEXCOORD6
$Varyings.texCoord7: #define VARYINGS_NEED_TEXCOORD7
$Varyings.color: #define VARYINGS_NEED_COLOR
$Varyings.vertexID: #define VARYINGS_NEED_VERTEXID
$Varyings.instanceID: #define VARYINGS_NEED_INSTANCEID
$Varyings.bitangentWS: #define VARYINGS_NEED_BITANGENT_WS
$Varyings.screenPosition: #define VARYINGS_NEED_SCREENPOSITION
$Varyings.fogFactorAndVertexLight: #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
$features.graphVertex: #define FEATURES_GRAPH_VERTEX
$features.graphColorInterp: #define FEATURES_GRAPH_COLOR_INTERP
$Universal.UseLegacySpriteBlocks: #define UNIVERSAL_USELEGACYSPRITEBLOCKS
#define REQUIRE_DEPTH_TEXTURE
#define REQUIRE_NORMAL_TEXTURE
$splice(GraphDefines)
$splice(PreGraphIncludes)
// --------------------------------------------------
// Structs and Packing
$splice(PassStructs)
$splice(InterpolatorPack)
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif
// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif
//UGUI has no keyword for when a renderer has "bloom", so its nessecary to hardcore it here, like all the base UI shaders.
half4 _TextureSampleAdd;
// --------------------------------------------------
// Graph
// Graph Properties
$splice(GraphProperties)
// Graph Includes
$splice(GraphIncludes)
// Graph Functions
$splice(GraphFunctions)
$splice(CustomInterpolatorPreVertex)
// Graph Vertex
$splice(GraphVertex)
$splice(CustomInterpolatorPreSurface)
// Graph Pixel
$splice(GraphPixel)
// --------------------------------------------------
// Build Graph Inputs
$features.graphVertex: $include("BuildVertexDescriptionInputs.template.hlsl")
$features.graphPixel: $include("BuildSurfaceDescriptionInputs.template.hlsl")
// --------------------------------------------------
// Main
$splice(PostGraphIncludes)
ENDHLSL
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3fa60ca3757a4221b2b042165c4696fe
timeCreated: 1655252373