Tim Cooper
8 年前
当前提交
112ae744
共有 12 个文件被更改,包括 223 次插入 和 6 次删除
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/MaterialGraphDataSource.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/subshader.template
-
25MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MasterRemapGraph.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/RemapMasterNode.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/AbstractSurfaceMasterNode.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/SurfaceMaterialOptions.cs
-
18MaterialGraphProject/Assets/ShaderLOD.cs
-
12MaterialGraphProject/Assets/ShaderLOD.cs.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/SurfaceMasterDrawData.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/SurfaceMasterDrawData.cs.meta
-
97MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/ProjectSpecificMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/ProjectSpecificMasterNode.cs.meta
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class ShaderLOD : MonoBehaviour { |
|||
|
|||
void OnGUI() |
|||
{ |
|||
if (GUILayout.Button("200")) |
|||
{ |
|||
Shader.globalMaximumLOD = 200; |
|||
} |
|||
if (GUILayout.Button("400")) |
|||
{ |
|||
Shader.globalMaximumLOD = 400; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4dae8f09bae183044ade8415d66232d2 |
|||
timeCreated: 1481294521 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
[Serializable] |
|||
class SurfaceMasterContolDrawData : ControlDrawData |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var cNode = node as AbstractSurfaceMasterNode; |
|||
if (cNode == null) |
|||
return; |
|||
|
|||
cNode.options.lod = EditorGUILayout.IntField("LOD", cNode.options.lod); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class SurfaceMasterDrawData : MaterialNodeDrawData |
|||
{ |
|||
protected override IEnumerable<GraphElementData> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<SurfaceMasterContolDrawData>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementData> { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8a96d6b5dce22a748b50fa5a7629231e |
|||
timeCreated: 1481294173 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
/*using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text.RegularExpressions; |
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Serializable] |
|||
public abstract class ProjectSpecificMasterNode : AbstractMasterNode |
|||
{ |
|||
public override string GetSubShader(GenerationMode mode) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public override string GetFullShader( |
|||
GenerationMode mode, |
|||
out List<PropertyGenerator.TextureInfo> configuredTextures) |
|||
{ |
|||
var shaderTemplateLocation = ShaderGenerator.GetTemplatePath("shader.template"); |
|||
|
|||
if (!File.Exists(shaderTemplateLocation)) |
|||
{ |
|||
configuredTextures = new List<PropertyGenerator.TextureInfo>(); |
|||
return string.Empty; |
|||
} |
|||
|
|||
var templateText = File.ReadAllText(shaderTemplateLocation); |
|||
|
|||
var shaderBodyVisitor = new ShaderGenerator(); |
|||
var shaderFunctionVisitor = new ShaderGenerator(); |
|||
var shaderPropertiesVisitor = new PropertyGenerator(); |
|||
var shaderPropertyUsagesVisitor = new ShaderGenerator(); |
|||
var shaderInputVisitor = new ShaderGenerator(); |
|||
var vertexShaderBlock = new ShaderGenerator(); |
|||
|
|||
GenerateSurfaceShaderInternal( |
|||
shaderBodyVisitor, |
|||
shaderFunctionVisitor, |
|||
shaderInputVisitor, |
|||
vertexShaderBlock, |
|||
shaderPropertiesVisitor, |
|||
shaderPropertyUsagesVisitor, |
|||
mode); |
|||
|
|||
var tagsVisitor = new ShaderGenerator(); |
|||
var blendingVisitor = new ShaderGenerator(); |
|||
var cullingVisitor = new ShaderGenerator(); |
|||
var zTestVisitor = new ShaderGenerator(); |
|||
var zWriteVisitor = new ShaderGenerator(); |
|||
|
|||
m_MaterialOptions.GetTags(tagsVisitor); |
|||
m_MaterialOptions.GetBlend(blendingVisitor); |
|||
m_MaterialOptions.GetCull(cullingVisitor); |
|||
m_MaterialOptions.GetDepthTest(zTestVisitor); |
|||
m_MaterialOptions.GetDepthWrite(zWriteVisitor); |
|||
|
|||
var resultShader = templateText.Replace("${ShaderName}", GetType() + guid.ToString()); |
|||
resultShader = resultShader.Replace("${ShaderPropertiesHeader}", shaderPropertiesVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ShaderPropertyUsages}", shaderPropertyUsagesVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${LightingFunctionName}", GetLightFunction()); |
|||
resultShader = resultShader.Replace("${SurfaceOutputStructureName}", GetSurfaceOutputName()); |
|||
resultShader = resultShader.Replace("${ShaderFunctions}", shaderFunctionVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ShaderInputs}", shaderInputVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${PixelShaderBody}", shaderBodyVisitor.GetShaderString(3)); |
|||
resultShader = resultShader.Replace("${Tags}", tagsVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Blending}", blendingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${Culling}", cullingVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZTest}", zTestVisitor.GetShaderString(2)); |
|||
resultShader = resultShader.Replace("${ZWrite}", zWriteVisitor.GetShaderString(2)); |
|||
|
|||
resultShader = resultShader.Replace("${VertexShaderDecl}", "vertex:vert"); |
|||
resultShader = resultShader.Replace("${VertexShaderBody}", vertexShaderBlock.GetShaderString(3)); |
|||
|
|||
configuredTextures = shaderPropertiesVisitor.GetConfiguredTexutres(); |
|||
|
|||
return Regex.Replace(resultShader, @"\r\n|\n\r|\n|\r", Environment.NewLine); |
|||
|
|||
} |
|||
|
|||
private void GenerateSurfaceShaderInternal( |
|||
ShaderGenerator propertyUsages, |
|||
GenerationMode mode) |
|||
{ |
|||
var activeNodeList = new List<INode>(); |
|||
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this); |
|||
|
|||
foreach (var node in activeNodeList.OfType<AbstractMaterialNode>()) |
|||
{ |
|||
node.GeneratePropertyUsages(propertyUsages, mode); |
|||
} |
|||
|
|||
} |
|||
} |
|||
}*/ |
|
|||
fileFormatVersion: 2 |
|||
guid: c9237152ca800cd48a60f04edac61381 |
|||
timeCreated: 1481184633 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue