浏览代码

Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017

/main
Eduardo Chaves 8 年前
当前提交
7658d069
共有 5 个文件被更改,包括 119 次插入1 次删除
  1. 2
      MaterialGraphProject/Assets/Matt/SubsurfaceMaster.ShaderGraph
  2. 1
      MaterialGraphProject/Assets/Matt/ClothMaster.ShaderGraph
  3. 9
      MaterialGraphProject/Assets/Matt/ClothMaster.ShaderGraph.meta
  4. 96
      MaterialGraphProject/Assets/Matt/ClothMasterNode.cs
  5. 12
      MaterialGraphProject/Assets/Matt/ClothMasterNode.cs.meta

2
MaterialGraphProject/Assets/Matt/SubsurfaceMaster.ShaderGraph
文件差异内容过多而无法显示
查看文件

1
MaterialGraphProject/Assets/Matt/ClothMaster.ShaderGraph
文件差异内容过多而无法显示
查看文件

9
MaterialGraphProject/Assets/Matt/ClothMaster.ShaderGraph.meta


fileFormatVersion: 2
guid: c6f272d98c8edc642b85922a6d8ffe9c
timeCreated: 1495626442
licenseType: Pro
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

96
MaterialGraphProject/Assets/Matt/ClothMasterNode.cs


using System;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Serializable]
[Title("Master/Cloth")]
public class ClothMasterNode : AbstractAdvancedMasterNode
{
//public const string MetallicSlotName = "Metallic";
//public const int MetallicSlotId = 2;
public const string FuzzSlotName = "Fuzz";
public const int FuzzSlotId = 9;
public const string ClothFactorSlotName = "ClothFactor";
public const int ClothFactorSlotId = 10;
public const string LightFunctionName = "Advanced";
public const string SurfaceOutputStructureName = "SurfaceOutputAdvanced";
public ClothMasterNode()
{
name = "Cloth";
UpdateNodeAfterDeserialization();
}
public override string GetMaterialID()
{
return "SHADINGMODELID_CLOTH";
}
public override int[] GetCustomDataSlots()
{
return new int[] { 9, 10 };
}
public override string[] GetCustomData()
{
string fuzzInput = GetVariableNameForSlotAtId(9);
if (fuzzInput == "")
fuzzInput = "float3(0,0,0)";
else
fuzzInput = fuzzInput + ".rgb";
string clothFactorInput = GetVariableNameForSlotAtId(10);
if (clothFactorInput == "")
clothFactorInput = "0";
else
clothFactorInput = clothFactorInput + ".r";
return new string[] { "o.CustomData = float4(" + fuzzInput + ", "+ clothFactorInput + ");" };
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(AlbedoSlotId, AlbedoSlotName, AlbedoSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero));
AddSlot(new MaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero));
AddSlot(new MaterialSlot(EmissionSlotId, EmissionSlotName, EmissionSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero));
//AddSlot(new MaterialSlot(MetallicSlotId, MetallicSlotName, MetallicSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(SmoothnessSlotId, SmoothnessSlotName, SmoothnessSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(OcclusionSlotId, OcclusionSlotName, OcclusionSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(AnisotropySlotId, AnisotropySlotName, AnisotropySlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(TangentSlotId, TangentSlotName, TangentSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero));
AddSlot(new MaterialSlot(AnisotropySlotId, AnisotropySlotName, AnisotropySlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
AddSlot(new MaterialSlot(FuzzSlotId, FuzzSlotName, FuzzSlotName, SlotType.Input, SlotValueType.Vector3, Vector4.zero));
AddSlot(new MaterialSlot(ClothFactorSlotId, ClothFactorSlotName, ClothFactorSlotName, SlotType.Input, SlotValueType.Vector1, Vector4.zero));
// clear out slot names that do not match the slots
// we support
RemoveSlotsNameNotMatching(
new[]
{
AlbedoSlotId,
NormalSlotId,
EmissionSlotId,
//MetallicSlotId,
SmoothnessSlotId,
OcclusionSlotId,
AlphaSlotId,
AnisotropySlotId,
TangentSlotId,
FuzzSlotId,
ClothFactorSlotId
});
}
public override string GetSurfaceOutputName()
{
return SurfaceOutputStructureName;
}
public override string GetLightFunction()
{
return LightFunctionName;
}
}
}

12
MaterialGraphProject/Assets/Matt/ClothMasterNode.cs.meta


fileFormatVersion: 2
guid: 4a9c7c58817be884f8b788d9e11dbef0
timeCreated: 1478188276
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存