C# Class GPUGraph.Node

Inheritance: ISerializable
Mostrar archivo Open project: heyx3/GPUNoiseForUnity Class Usage Examples

Public Properties

Property Type Description
Inputs List
Owner Graph
Pos UnityEngine.Rect
UID int

Protected Properties

Property Type Description
InputDefaultVals List
InputNames List

Public Methods

Method Description
AreFloatsDifferent ( float f1, float f2 ) : bool

Compares two floats like normal, except that if they are both NaN, they are considered to be *equal*.

Clone ( ) : Node

Generates a new node identical to this one, including the UID, but with no graph owner.

Clone ( Graph newOwner, bool addToOwner, int idOffset ) : Node

Generates a new node identical to this one, including the UID, but with a different graph owner.

EmitCode ( StringBuilder outCode ) : void

Appends the actual shader code that computes the output variable.

EmitDefs ( StringBuilder outCode ) : void

Appends any necessary definitions to the given shader.

EmitProperties ( StringBuilder outCode ) : void

Appends any necessary Shaderlab property definitions to the given shader.

GetInputDefaultValue ( int index ) : float
GetInputName ( int index ) : string
GetObjectData ( SerializationInfo info, StreamingContext context ) : void

Outputs class data to a serializer.

Node ( Rect pos, List inputs, List inputNames, List inputDefaultVals ) : System
Node ( SerializationInfo info, StreamingContext context ) : System
OnAddedToGraph ( ) : void

Called when this node's owner/uid is set.

OnGUI ( int &clickedInput, int isSelected ) : GUIResults

Runs the GUI display window for this node. Returns what happened.

OnGraphLoaded ( ) : void

Called after this node's owner is done loading from a file. This is better than a method with OnDeserializedAttribute because this method is only called *after* the graph itself is fully loaded.

OnPreProcess ( ) : IEnumerable

Called right before the graph generates a shader. Special nodes can take this opportunity to modify the graph however they want. Returns any new nodes that have been added to the graph.

Protected Methods

Method Description
CustomGUI ( ) : bool

Child nodes can add custom GUI stuff through this method. Must return whether anything has actually changed.

MakeClone ( ) : Node

Should create the right type of node with the same properties as this one. The base properties of all nodes don't need to be filled in by this method.

Node ( ) : System

Method Details

AreFloatsDifferent() public static method

Compares two floats like normal, except that if they are both NaN, they are considered to be *equal*.
public static AreFloatsDifferent ( float f1, float f2 ) : bool
f1 float
f2 float
return bool

Clone() public method

Generates a new node identical to this one, including the UID, but with no graph owner.
public Clone ( ) : Node
return Node

Clone() public method

Generates a new node identical to this one, including the UID, but with a different graph owner.
public Clone ( Graph newOwner, bool addToOwner, int idOffset ) : Node
newOwner Graph
addToOwner bool
idOffset int
return Node

CustomGUI() protected method

Child nodes can add custom GUI stuff through this method. Must return whether anything has actually changed.
protected CustomGUI ( ) : bool
return bool

EmitCode() public method

Appends the actual shader code that computes the output variable.
public EmitCode ( StringBuilder outCode ) : void
outCode StringBuilder
return void

EmitDefs() public method

Appends any necessary definitions to the given shader.
public EmitDefs ( StringBuilder outCode ) : void
outCode StringBuilder
return void

EmitProperties() public method

Appends any necessary Shaderlab property definitions to the given shader.
public EmitProperties ( StringBuilder outCode ) : void
outCode StringBuilder
return void

GetInputDefaultValue() public method

public GetInputDefaultValue ( int index ) : float
index int
return float

GetInputName() public method

public GetInputName ( int index ) : string
index int
return string

GetObjectData() public method

Outputs class data to a serializer.
public GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
return void

MakeClone() protected abstract method

Should create the right type of node with the same properties as this one. The base properties of all nodes don't need to be filled in by this method.
protected abstract MakeClone ( ) : Node
return Node

Node() protected method

protected Node ( ) : System
return System

Node() public method

public Node ( Rect pos, List inputs, List inputNames, List inputDefaultVals ) : System
pos UnityEngine.Rect
inputs List
inputNames List
inputDefaultVals List
return System

Node() public method

public Node ( SerializationInfo info, StreamingContext context ) : System
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
return System

OnAddedToGraph() public method

Called when this node's owner/uid is set.
public OnAddedToGraph ( ) : void
return void

OnGUI() public method

Runs the GUI display window for this node. Returns what happened.
public OnGUI ( int &clickedInput, int isSelected ) : GUIResults
clickedInput int /// If the user clicked an input, /// the index of that input will be stored in this variable. ///
isSelected int /// If this node's output was previously selected, pass -1. /// If an input was selected, pass the index of that input. /// Otherwise, pass anything else. ///
return GUIResults

OnGraphLoaded() public method

Called after this node's owner is done loading from a file. This is better than a method with OnDeserializedAttribute because this method is only called *after* the graph itself is fully loaded.
public OnGraphLoaded ( ) : void
return void

OnPreProcess() public method

Called right before the graph generates a shader. Special nodes can take this opportunity to modify the graph however they want. Returns any new nodes that have been added to the graph.
public OnPreProcess ( ) : IEnumerable
return IEnumerable

Property Details

InputDefaultVals protected_oe property

protected List InputDefaultVals
return List

InputNames protected_oe property

protected List InputNames
return List

Inputs public_oe property

The inputs into this node. Anyone outside this class should never modify it! Any child classes should take care that "InputNames" and "InputDefaultVals" always have the same number of elements as this list.
public List Inputs
return List

Owner public_oe property

The graph that owns this instance.
public Graph,GPUGraph Owner
return Graph

Pos public_oe property

This node's window's position in the editor.
public Rect,UnityEngine Pos
return UnityEngine.Rect

UID public_oe property

A unique identifier in the graph.
public int UID
return int