initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,46 @@
|
|||
using UnityEditor.Graphing;
|
||||
using UnityEditor.ShaderGraph.Internal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[Title("Input", "Lighting", "Ambient")]
|
||||
class AmbientNode : AbstractMaterialNode
|
||||
{
|
||||
const string kOutputSlotName = "Color/Sky";
|
||||
const string kOutputSlot1Name = "Equator";
|
||||
const string kOutputSlot2Name = "Ground";
|
||||
|
||||
public const int OutputSlotId = 0;
|
||||
public const int OutputSlot1Id = 1;
|
||||
public const int OutputSlot2Id = 2;
|
||||
|
||||
public AmbientNode()
|
||||
{
|
||||
name = "Ambient";
|
||||
synonyms = new string[] { "scene color" };
|
||||
UpdateNodeAfterDeserialization();
|
||||
}
|
||||
|
||||
public sealed override void UpdateNodeAfterDeserialization()
|
||||
{
|
||||
AddSlot(new ColorRGBMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, Vector4.zero, ColorMode.Default));
|
||||
AddSlot(new ColorRGBMaterialSlot(OutputSlot1Id, kOutputSlot1Name, kOutputSlot1Name, SlotType.Output, Vector4.zero, ColorMode.Default));
|
||||
AddSlot(new ColorRGBMaterialSlot(OutputSlot2Id, kOutputSlot2Name, kOutputSlot2Name, SlotType.Output, Vector4.zero, ColorMode.Default));
|
||||
RemoveSlotsNameNotMatching(new[] { OutputSlotId, OutputSlot1Id, OutputSlot2Id });
|
||||
}
|
||||
|
||||
public override string GetVariableNameForSlot(int slotId)
|
||||
{
|
||||
switch (slotId)
|
||||
{
|
||||
case OutputSlot1Id:
|
||||
return "SHADERGRAPH_AMBIENT_EQUATOR";
|
||||
case OutputSlot2Id:
|
||||
return "SHADERGRAPH_AMBIENT_GROUND";
|
||||
default:
|
||||
return "SHADERGRAPH_AMBIENT_SKY";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0f9e9a126b4ecf24d81258763ac4a64d
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,77 @@
|
|||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEditor.Graphing;
|
||||
using UnityEditor.ShaderGraph.Drawing.Controls;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[FormerName("UnityEditor.ShaderGraph.BakedGAbstractMaterialNode")]
|
||||
[FormerName("UnityEditor.ShaderGraph.LightProbeNode")]
|
||||
[Title("Input", "Lighting", "Baked GI")]
|
||||
class BakedGINode : CodeFunctionNode
|
||||
{
|
||||
public override bool hasPreview { get { return false; } }
|
||||
|
||||
public BakedGINode()
|
||||
{
|
||||
name = "Baked GI";
|
||||
synonyms = new string[] { "global illumination" };
|
||||
}
|
||||
|
||||
protected override MethodInfo GetFunctionToConvert()
|
||||
{
|
||||
if (applyScaling.isOn)
|
||||
return GetType().GetMethod("Unity_BakedGIScale", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
else
|
||||
return GetType().GetMethod("Unity_BakedGI", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool m_ApplyScaling = true;
|
||||
|
||||
[ToggleControl("Apply Lightmap Scaling")]
|
||||
public ToggleData applyScaling
|
||||
{
|
||||
get { return new ToggleData(m_ApplyScaling); }
|
||||
set
|
||||
{
|
||||
if (m_ApplyScaling == value.isOn)
|
||||
return;
|
||||
m_ApplyScaling = value.isOn;
|
||||
Dirty(ModificationScope.Node);
|
||||
}
|
||||
}
|
||||
|
||||
static string Unity_BakedGI(
|
||||
[Slot(2, Binding.WorldSpacePosition)] Vector3 Position,
|
||||
[Slot(0, Binding.WorldSpaceNormal)] Vector3 Normal,
|
||||
[Slot(3, Binding.MeshUV1)] Vector2 StaticUV,
|
||||
[Slot(4, Binding.MeshUV2)] Vector2 DynamicUV,
|
||||
[Slot(1, Binding.None)] out Vector3 Out)
|
||||
{
|
||||
Out = Vector3.one;
|
||||
return
|
||||
@"
|
||||
{
|
||||
Out = SHADERGRAPH_BAKED_GI(Position, Normal, StaticUV, DynamicUV, false);
|
||||
}
|
||||
";
|
||||
}
|
||||
|
||||
static string Unity_BakedGIScale(
|
||||
[Slot(2, Binding.WorldSpacePosition)] Vector3 Position,
|
||||
[Slot(0, Binding.WorldSpaceNormal)] Vector3 Normal,
|
||||
[Slot(3, Binding.MeshUV1)] Vector2 StaticUV,
|
||||
[Slot(4, Binding.MeshUV2)] Vector2 DynamicUV,
|
||||
[Slot(1, Binding.None)] out Vector3 Out)
|
||||
{
|
||||
Out = Vector3.one;
|
||||
return
|
||||
@"
|
||||
{
|
||||
Out = SHADERGRAPH_BAKED_GI(Position, Normal, StaticUV, DynamicUV, true);
|
||||
}
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f77cdea8b1204b12bb03da3dd3bd3b6
|
||||
timeCreated: 1495482070
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
|||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[Title("Input", "Lighting", "Reflection Probe")]
|
||||
class ReflectionProbeNode : CodeFunctionNode
|
||||
{
|
||||
public ReflectionProbeNode()
|
||||
{
|
||||
name = "Reflection Probe";
|
||||
synonyms = new string[] { "light probe", "cube map", "environment" };
|
||||
}
|
||||
|
||||
public override bool hasPreview { get { return false; } }
|
||||
|
||||
protected override MethodInfo GetFunctionToConvert()
|
||||
{
|
||||
return GetType().GetMethod("Unity_ReflectionProbe", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
}
|
||||
|
||||
static string Unity_ReflectionProbe(
|
||||
[Slot(0, Binding.ObjectSpaceViewDirection)] Vector3 ViewDir,
|
||||
[Slot(1, Binding.ObjectSpaceNormal)] Vector3 Normal,
|
||||
[Slot(2, Binding.None)] Vector1 LOD,
|
||||
[Slot(3, Binding.None)] out Vector3 Out)
|
||||
{
|
||||
Out = Vector3.one;
|
||||
return
|
||||
@"
|
||||
{
|
||||
Out = SHADERGRAPH_REFLECTION_PROBE(ViewDir, Normal, LOD);
|
||||
}
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb8845c10261f47d0a719ac80481e667
|
||||
timeCreated: 1495482070
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue