浏览代码

Added base for Transform node

/main
Andre McGrail 8 年前
当前提交
7da4795e
共有 4 个文件被更改,包括 99 次插入0 次删除
  1. 41
      MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs
  2. 12
      MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs.meta
  3. 34
      MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs
  4. 12
      MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs.meta

41
MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine.MaterialGraph;
using UnityEngine;
namespace UnityEditor.MaterialGraph.Drawing
{
class TransformControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var tNode = node as TransformNode;
if (tNode == null)
return;
//tNode.floatType = (FloatPropertyChunk.FloatType)EditorGUILayout.EnumPopup ("Float", tNode.floatType);
}
public override float GetHeight()
{
return (EditorGUIUtility.singleLineHeight + 16 * EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class TransformNodePresenter : PropertyNodePresenter
{
protected override IEnumerable<GraphElementPresenter> GetControlData()
{
var instance = CreateInstance<TransformControlPresenter>();
instance.Initialize(node);
return new List<GraphElementPresenter>(base.GetControlData()) { instance };
}
}
}

12
MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs.meta


fileFormatVersion: 2
guid: 01ea0408c41734e0b8b28e0983f7a700
timeCreated: 1476732809
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs


namespace UnityEngine.MaterialGraph
{
[Title ("Math/Vector/Transform")]
public class TransformNode : Function1Input
{
public TransformNode ()
{
name = "Transform";
}
protected override string GetFunctionName ()
{
//mul(unity_WorldToObject, float4(i.posWorld.rgb,0) ).xyz - world to local
//mul( tangentTransform, i.posWorld.rgb ).xyz - world to tangent
//mul( UNITY_MATRIX_V, float4(i.posWorld.rgb,0) ).xyz - world to view
//mul( unity_ObjectToWorld, float4(i.posWorld.rgb,0) ).xyz - local to world
//mul( tangentTransform, mul( unity_ObjectToWorld, float4(i.posWorld.rgb,0) ).xyz - local to tangent
//mul( UNITY_MATRIX_MV, float4(i.posWorld.rgb,0) ).xyz - local to view
//mul( i.posWorld.rgb, tangentTransform ).xyz - tangent to world
//mul( unity_WorldToObject, float4(mul( i.posWorld.rgb, tangentTransform ),0) ).xyz - tangent to local
//mul( UNITY_MATRIX_V, float4(mul( i.posWorld.rgb, tangentTransform ),0) ).xyz - tangent to view
//mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_V ).xyz - view to world
//mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_MV ).xyz - view to local
//mul( tangentTransform, mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_V ).xyz ).xyz - view to tangent
return "exp";
}
}
}

12
MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs.meta


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