C# 클래스 GPUGraph.Graph

상속: ISerializable
파일 보기 프로젝트 열기: heyx3/GPUNoiseForUnity 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
FilePath string
Hash1 string
NextUID int
Output NodeInput
OutputPos UnityEngine.Rect

공개 메소드들

메소드 설명
AddNode ( Node n, bool generateNewUID = true ) : void
Clone ( int idOffset ) : Graph
GenerateShader ( string shaderName, Action addToProperties, Action addToDefs, StringBuilder>.Action returnFragmentColor ) : string

Generates a shader with customized output.

GenerateShader ( string shaderName, string colorRampParamName ) : string

Generates a shader that outputs a color based on the graph's noise and a color ramp texture.

GenerateShader ( string shaderName, string outputs, float defaultVal ) : string

Generates a shader that outputs this graph's noise in the given channels.

GetNode ( int uid ) : Node

Returns "null" if the given Node uid doesn't exist in this graph.

GetObjectData ( SerializationInfo info, StreamingContext context ) : void
Graph ( ) : System
Graph ( SerializationInfo info, StreamingContext context ) : System
Graph ( string file, bool isGUID = false ) : System

Creates a graph for the given file path/GUID.

InsertShaderCode ( StringBuilder shaderProperties, StringBuilder shaderCGDefines, StringBuilder shaderBody, int idOffset, bool isFirstGraph ) : string

Inserts code for this graph into the given strings, and outputs an expression that evaluates to the output of this graph.

IsValidUID ( int uid ) : bool
Load ( ) : string

Re-loads this graph from its file-path, effectively wiping out any changes to it. Returns an error message, or an empty string if nothing went wrong.

PreProcess ( ) : void

Simplifies this graph by running its nodes through the pre-processing stage. The whole graph will be reduced to its final form (i.e. no "weird" nodes like SubGraphNode).

RemoveNode ( Node n ) : void
Save ( ) : string

Saves this graph to its file-path. Returns an error message, or an empty string if nothing went wrong.

비공개 메소드들

메소드 설명
FinalizeDeserialization ( StreamingContext context ) : void
InsertShad ( StringBuilder properties, StringBuilder cgProperties, StringBuilder body, bool addDefines ) : string

메소드 상세

AddNode() 공개 메소드

public AddNode ( Node n, bool generateNewUID = true ) : void
n Node
generateNewUID bool
리턴 void

Clone() 공개 메소드

public Clone ( int idOffset ) : Graph
idOffset int
리턴 Graph

GenerateShader() 공개 메소드

Generates a shader with customized output.
public GenerateShader ( string shaderName, Action addToProperties, Action addToDefs, StringBuilder>.Action returnFragmentColor ) : string
shaderName string The shader's name in the file.
addToProperties Action Adds any Unity Shaderlab Properties to the given string.
addToDefs Action Adds any Cg declarations to the given string.
returnFragmentColor StringBuilder>.Action /// Outupts shader instructions that return a float4 color /// given the variable holding the graph's noise output. ///
리턴 string

GenerateShader() 공개 메소드

Generates a shader that outputs a color based on the graph's noise and a color ramp texture.
public GenerateShader ( string shaderName, string colorRampParamName ) : string
shaderName string The shader's name in the file.
colorRampParamName string
리턴 string

GenerateShader() 공개 메소드

Generates a shader that outputs this graph's noise in the given channels.
public GenerateShader ( string shaderName, string outputs, float defaultVal ) : string
shaderName string The shader's name in the file.
outputs string The channels to output this graph's noise into.
defaultVal float /// The value held by channels that didn't receive this graph's noise. ///
리턴 string

GetNode() 공개 메소드

Returns "null" if the given Node uid doesn't exist in this graph.
public GetNode ( int uid ) : Node
uid int
리턴 Node

GetObjectData() 공개 메소드

public GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
리턴 void

Graph() 공개 메소드

public Graph ( ) : System
리턴 System

Graph() 공개 메소드

public Graph ( SerializationInfo info, StreamingContext context ) : System
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
리턴 System

Graph() 공개 메소드

Creates a graph for the given file path/GUID.
public Graph ( string file, bool isGUID = false ) : System
file string
isGUID bool
리턴 System

InsertShaderCode() 공개 메소드

Inserts code for this graph into the given strings, and outputs an expression that evaluates to the output of this graph.
public InsertShaderCode ( StringBuilder shaderProperties, StringBuilder shaderCGDefines, StringBuilder shaderBody, int idOffset, bool isFirstGraph ) : string
shaderProperties StringBuilder
shaderCGDefines StringBuilder
shaderBody StringBuilder
idOffset int /// Offsets the ids of the nodes in this graph /// so that they do not conflict with the ID's of any other nodes in other graphs used by this shader. /// This offset should be larger than any ID of a node in any other graph. ///
isFirstGraph bool /// Indicates whether this is the first time that /// generated code from a Graph is being inserted into this shader. /// If true, certain function definitions will be included into the shader code. ///
리턴 string

IsValidUID() 공개 정적인 메소드

public static IsValidUID ( int uid ) : bool
uid int
리턴 bool

Load() 공개 메소드

Re-loads this graph from its file-path, effectively wiping out any changes to it. Returns an error message, or an empty string if nothing went wrong.
public Load ( ) : string
리턴 string

PreProcess() 공개 메소드

Simplifies this graph by running its nodes through the pre-processing stage. The whole graph will be reduced to its final form (i.e. no "weird" nodes like SubGraphNode).
public PreProcess ( ) : void
리턴 void

RemoveNode() 공개 메소드

public RemoveNode ( Node n ) : void
n Node
리턴 void

Save() 공개 메소드

Saves this graph to its file-path. Returns an error message, or an empty string if nothing went wrong.
public Save ( ) : string
리턴 string

프로퍼티 상세

FilePath 공개적으로 프로퍼티

The filepath that this graph saves to/is read from.
public string FilePath
리턴 string

Hash1 공개적으로 프로퍼티

The 1D, 2D, and 3D hash functions this graph is using.
public string Hash1
리턴 string

NextUID 공개적으로 프로퍼티

The next node added to this graph will be given this ID.
public int NextUID
리턴 int

Output 공개적으로 프로퍼티

The output of this graph.
public NodeInput,GPUGraph Output
리턴 NodeInput

OutputPos 공개적으로 프로퍼티

The position of the "Output" node in the editor.
public Rect,UnityEngine OutputPos
리턴 UnityEngine.Rect