C# Class GPUGraph.Graph

Inheritance: ISerializable
Afficher le fichier Open project: heyx3/GPUNoiseForUnity Class Usage Examples

Méthodes publiques

Свойство Type Description
FilePath string
Hash1 string
NextUID int
Output NodeInput
OutputPos UnityEngine.Rect

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
FinalizeDeserialization ( StreamingContext context ) : void
InsertShad ( StringBuilder properties, StringBuilder cgProperties, StringBuilder body, bool addDefines ) : string

Method Details

AddNode() public méthode

public AddNode ( Node n, bool generateNewUID = true ) : void
n Node
generateNewUID bool
Résultat void

Clone() public méthode

public Clone ( int idOffset ) : Graph
idOffset int
Résultat Graph

GenerateShader() public méthode

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. ///
Résultat string

GenerateShader() public méthode

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
Résultat string

GenerateShader() public méthode

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. ///
Résultat string

GetNode() public méthode

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

GetObjectData() public méthode

public GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
Résultat void

Graph() public méthode

public Graph ( ) : System
Résultat System

Graph() public méthode

public Graph ( SerializationInfo info, StreamingContext context ) : System
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
Résultat System

Graph() public méthode

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

InsertShaderCode() public méthode

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. ///
Résultat string

IsValidUID() public static méthode

public static IsValidUID ( int uid ) : bool
uid int
Résultat bool

Load() public méthode

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
Résultat string

PreProcess() public méthode

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
Résultat void

RemoveNode() public méthode

public RemoveNode ( Node n ) : void
n Node
Résultat void

Save() public méthode

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

Property Details

FilePath public_oe property

The filepath that this graph saves to/is read from.
public string FilePath
Résultat string

Hash1 public_oe property

The 1D, 2D, and 3D hash functions this graph is using.
public string Hash1
Résultat string

NextUID public_oe property

The next node added to this graph will be given this ID.
public int NextUID
Résultat int

Output public_oe property

The output of this graph.
public NodeInput,GPUGraph Output
Résultat NodeInput

OutputPos public_oe property

The position of the "Output" node in the editor.
public Rect,UnityEngine OutputPos
Résultat UnityEngine.Rect