Catlike Coding
Unity Code Documentation
Public Member Functions | Public Attributes | List of all members
CatlikeCoding.NumberFlow.Diagram Class Reference

NumberFlow diagram. More...

Inherits ScriptableObject.

Public Member Functions

void Fill (Color[][] buffers, int width, int height)
 Fill pixel buffers with all outputs. More...
 
void Fill (Color[][] buffers)
 Fill pixel buffers with all outputs. Use the default width and height. More...
 
void Fill (Color[] pixels, int outputIndex, int width, int height)
 Fill pixel data with the first output. More...
 
void Fill (Color[] pixels, int outputIndex)
 Fill pixels data with the first output. Use the default width and height. More...
 
void Fill (Color[] pixels, int width, int height)
 Fill pixel data with the first output. More...
 
void Fill (Color[] pixels)
 Fill pixels data with the first output. Use the default width and height. More...
 
int FillRows (Color[][] buffers, int width, int height, int rowIndex, int rowCount)
 Fill multiple rows of pixel buffers. Filling will stop after the last row. More...
 
int FillRows (Color[][] buffers, int rowIndex, int rowCount)
 Fill multiple rows of pixel buffers. Use the default width and height. Filling will stop after the last row. More...
 
int FillRows (Color[] pixels, int outputIndex, int width, int height, int rowIndex, int rowCount)
 Fill multiple rows of pixels. Filling will stop after the last row. More...
 
int FillRows (Color[] pixels, int outputIndex, int rowIndex, int rowCount)
 Fill multiple rows of pixels. Use the default width and height. Filling will stop after the last row. More...
 
int FillRows (Color[] pixels, int width, int height, int rowIndex, int rowCount)
 Fill multiple rows of pixels with the first output. Filling will stop after the last row. More...
 
int FillRows (Color[] pixels, int rowIndex, int rowCount)
 Fill multiple rows of pixels with the first output. Use the default width and height. Filling will stop after the last row. More...
 
Value GetInputValue (string name)
 Get a named input value, which can be used to configure the diagram at runtime. More...
 
void Init ()
 Initialize the diagram. More...
 
void PostProcess (Color[][] buffers, int width, int height, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffers. Call after Fill or FillRows with the same pixel data. More...
 
void PostProcess (Color[][] buffers, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffers. Use the default width and height. Call after Fill or FillRows with the same pixel data. More...
 
void PostProcess (Color[] buffer, int outputIndex, int width, int height, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffer. Call after Fill or FillRows with the same pixel data. More...
 
void PostProcess (Color[] buffer, int outputIndex, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffer. Use the default width and height. Call after Fill or FillRows with the same pixel data. More...
 
void PostProcess (Color[] buffer, int width, int height, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffer for the first output. Call after Fill or FillRows with the same pixel data. More...
 
void PostProcess (Color[] buffer, DiagramNormalFormat normalFormat)
 Posts process filled pixel buffer for the first output. Use the default width and height. Call after Fill or FillRows with the same pixel data. More...
 

Public Attributes

bool animatePreview
 Whether to animate the editor preview. More...
 
string animatePreviewInput
 Input name of the value to animate for the editor preview. More...
 
CubemapFace cubemapDirection
 Which cubemap direction to use when filling. You have to change this when manually generatic a cubemap. More...
 
int currentPixelIndex
 The index of the pixel currently being processed. More...
 
float derivativeScale = 1f
 Scale factor for derivatives. More...
 
float exportAnimateFrom = 0
 Initial value for the export animation input value. More...
 
float exportAnimateTo = 1
 Final value for the export animation input value. More...
 
bool exportAnimation
 Whether to export an animation. More...
 
int exportAnimationFrames
 How many frames to use when exporting an animation. More...
 
string exportAnimationInput
 Input name of the value to animate for the export. More...
 
bool exportAnimationLoop
 Whether to export an animation loop. More...
 
int exportHeight = 1024
 Editor export height. More...
 
int exportWidth = 1024
 Editor export width. More...
 
FunctionLibrary[] functionLibraries
 Additional function libraries available to the diagram. More...
 
int height = 128
 Default and editor preview height. More...
 
bool isCubemap
 Whether the diagram is a cubemap. More...
 
DiagramNode[] nodes
 Nodes in the diagram. More...
 
DiagramOutput[] outputs
 Output definitions. More...
 
int pixelX
 The X coordinate of the pixel currently being processed. More...
 
int pixelY
 The Y coordinate of the pixel currently being processed. More...
 
bool prepared
 Whether the diagram is prepared to be used. More...
 
CubemapFace previewCubemapDirection = CubemapFace.PositiveZ
 Which cubemap direction to preview in the editor. More...
 
DiagramCubemapPreviewType previewCubemapType
 How to display the cubemap preview. More...
 
int previewOutputIndex
 Index of the output to use for the editor preview. More...
 
bool tilePreviewHorizontally
 Whether to tile the editor preview horizontally. More...
 
bool tilePreviewVertically
 Whether to tile the editor preview vertically. More...
 
Vector2 uv
 The uv coordinates of the pixel currently being processed. More...
 
int width = 128
 Default and editor preview width. More...
 

Detailed Description

NumberFlow diagram.

These diagrams are created and edited in the Unity editor. Input values can be configured and colors can be filled via scripts at run time.

See the product page for an overview.

Member Function Documentation

void CatlikeCoding.NumberFlow.Diagram.Fill ( Color  buffers[][],
int  width,
int  height 
)

Fill pixel buffers with all outputs.

Parameters
buffersBuffer of Color arrays representing grids of Pixels. Must have at least one array per output and their lengths must be at least width * height.
widthWidth.
heightHeight.
void CatlikeCoding.NumberFlow.Diagram.Fill ( Color  buffers[][])

Fill pixel buffers with all outputs. Use the default width and height.

Parameters
buffersBuffer of Color arrays representing grids of Pixels. Must have at least one array per output and their lengths must be at least width * height.
void CatlikeCoding.NumberFlow.Diagram.Fill ( Color[]  pixels,
int  outputIndex,
int  width,
int  height 
)

Fill pixel data with the first output.

Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
outputIndexIndex of the output to use.
widthWidth.
heightHeight.
void CatlikeCoding.NumberFlow.Diagram.Fill ( Color[]  pixels,
int  outputIndex 
)

Fill pixels data with the first output. Use the default width and height.

Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
outputIndexIndex of the output to use.
void CatlikeCoding.NumberFlow.Diagram.Fill ( Color[]  pixels,
int  width,
int  height 
)

Fill pixel data with the first output.

Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
widthWidth.
heightHeight.
void CatlikeCoding.NumberFlow.Diagram.Fill ( Color[]  pixels)

Fill pixels data with the first output. Use the default width and height.

Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color  buffers[][],
int  width,
int  height,
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixel buffers. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
buffersBuffer of Color arrays representing grids of Pixels. Must have at least one array per output and their lengths must be at least width * height.
widthWidth.
heightHeight.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color  buffers[][],
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixel buffers. Use the default width and height. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
buffersBuffer of Color arrays representing grids of Pixels. Must have at least one array per output and their lengths must be at least width * height.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color[]  pixels,
int  outputIndex,
int  width,
int  height,
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixels. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
pixelsColor array representing a grid of Pixels. Its length must be at least width * height.
outputIndexIndex of the output to use.
widthWidth.
heightHeight.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color[]  pixels,
int  outputIndex,
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixels. Use the default width and height. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
pixelsColor array representing a grid of Pixels. Its length must be at least width * height.
outputIndexIndex of the output to use.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color[]  pixels,
int  width,
int  height,
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixels with the first output. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
widthWidth.
heightHeight.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
int CatlikeCoding.NumberFlow.Diagram.FillRows ( Color[]  pixels,
int  rowIndex,
int  rowCount 
)

Fill multiple rows of pixels with the first output. Use the default width and height. Filling will stop after the last row.

Returns
Index of the next row that should be filled. When finished, this will be larger than or equal to height.
Parameters
pixelsColor array representing a grid of Pixels. Its length must be width * height.
rowIndexRow index to start from.
rowCountAmount of rows to fill.
Value CatlikeCoding.NumberFlow.Diagram.GetInputValue ( string  name)

Get a named input value, which can be used to configure the diagram at runtime.

It is a good idea to cache the Value object reference to prevent constantly searching the diagram. However, accessing the diagram in the editor will break these caches. If this is an issue, use conditional compilation to only fetch the inputs again in the editor and not in builds.

Returns
Value object instance, or null when it couldn't be found.
Parameters
nameInput name.
void CatlikeCoding.NumberFlow.Diagram.Init ( )

Initialize the diagram.

Used internally and by editor scripts. Do not invoke it.

void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color  buffers[][],
int  width,
int  height,
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffers. Call after Fill or FillRows with the same pixel data.

Parameters
buffersThe buffers.
widthWidth.
heightHeight.
normalFormatNormal format.
void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color  buffers[][],
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffers. Use the default width and height. Call after Fill or FillRows with the same pixel data.

Parameters
buffersThe buffers.
normalFormatNormal format.
void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color[]  buffer,
int  outputIndex,
int  width,
int  height,
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffer. Call after Fill or FillRows with the same pixel data.

Parameters
bufferThe buffer.
outputIndexIndex of the output to use.
widthWidth.
heightHeight.
normalFormatNormal format.
void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color[]  buffer,
int  outputIndex,
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffer. Use the default width and height. Call after Fill or FillRows with the same pixel data.

Parameters
bufferThe buffer.
outputIndexIndex of the output to use.
normalFormatNormal format.
void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color[]  buffer,
int  width,
int  height,
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffer for the first output. Call after Fill or FillRows with the same pixel data.

Parameters
bufferThe buffer.
widthWidth.
heightHeight.
normalFormatNormal format.
void CatlikeCoding.NumberFlow.Diagram.PostProcess ( Color[]  buffer,
DiagramNormalFormat  normalFormat 
)

Posts process filled pixel buffer for the first output. Use the default width and height. Call after Fill or FillRows with the same pixel data.

Parameters
bufferThe buffer.
normalFormatNormal format.

Member Data Documentation

bool CatlikeCoding.NumberFlow.Diagram.animatePreview

Whether to animate the editor preview.

string CatlikeCoding.NumberFlow.Diagram.animatePreviewInput

Input name of the value to animate for the editor preview.

CubemapFace CatlikeCoding.NumberFlow.Diagram.cubemapDirection

Which cubemap direction to use when filling. You have to change this when manually generatic a cubemap.

int CatlikeCoding.NumberFlow.Diagram.currentPixelIndex

The index of the pixel currently being processed.

float CatlikeCoding.NumberFlow.Diagram.derivativeScale = 1f

Scale factor for derivatives.

The delta used for derivatives is equal to derivativeScale / max(width, height). The default scale is 1, so the delta covers one pixel, if width and height are equal.

float CatlikeCoding.NumberFlow.Diagram.exportAnimateFrom = 0

Initial value for the export animation input value.

float CatlikeCoding.NumberFlow.Diagram.exportAnimateTo = 1

Final value for the export animation input value.

bool CatlikeCoding.NumberFlow.Diagram.exportAnimation

Whether to export an animation.

int CatlikeCoding.NumberFlow.Diagram.exportAnimationFrames

How many frames to use when exporting an animation.

string CatlikeCoding.NumberFlow.Diagram.exportAnimationInput

Input name of the value to animate for the export.

bool CatlikeCoding.NumberFlow.Diagram.exportAnimationLoop

Whether to export an animation loop.

This conveniently adjusts exportAnimateTo so it overlaps with the first frame.

int CatlikeCoding.NumberFlow.Diagram.exportHeight = 1024

Editor export height.

Should be in the range 1-4096.

int CatlikeCoding.NumberFlow.Diagram.exportWidth = 1024

Editor export width.

Should be in the range 1-4096.

FunctionLibrary [] CatlikeCoding.NumberFlow.Diagram.functionLibraries

Additional function libraries available to the diagram.

You can add your own libraries here. Do not set it to null.

int CatlikeCoding.NumberFlow.Diagram.height = 128

Default and editor preview height.

Should be in the range 1-4096.

bool CatlikeCoding.NumberFlow.Diagram.isCubemap

Whether the diagram is a cubemap.

DiagramNode [] CatlikeCoding.NumberFlow.Diagram.nodes

Nodes in the diagram.

Used internally and by editor scripts. Do not touch it.

DiagramOutput [] CatlikeCoding.NumberFlow.Diagram.outputs

Output definitions.

int CatlikeCoding.NumberFlow.Diagram.pixelX

The X coordinate of the pixel currently being processed.

int CatlikeCoding.NumberFlow.Diagram.pixelY

The Y coordinate of the pixel currently being processed.

bool CatlikeCoding.NumberFlow.Diagram.prepared

Whether the diagram is prepared to be used.

Used by editor scripts.

CubemapFace CatlikeCoding.NumberFlow.Diagram.previewCubemapDirection = CubemapFace.PositiveZ

Which cubemap direction to preview in the editor.

DiagramCubemapPreviewType CatlikeCoding.NumberFlow.Diagram.previewCubemapType

How to display the cubemap preview.

int CatlikeCoding.NumberFlow.Diagram.previewOutputIndex

Index of the output to use for the editor preview.

bool CatlikeCoding.NumberFlow.Diagram.tilePreviewHorizontally

Whether to tile the editor preview horizontally.

bool CatlikeCoding.NumberFlow.Diagram.tilePreviewVertically

Whether to tile the editor preview vertically.

Vector2 CatlikeCoding.NumberFlow.Diagram.uv

The uv coordinates of the pixel currently being processed.

int CatlikeCoding.NumberFlow.Diagram.width = 128

Default and editor preview width.

Should be in the range 1-4096.