Shaders

The code editor

Write ISF fragment and vertex shaders with highlighting, formatting and history.

Open a .fs and its code appears below the preview.

Fragment and vertex

The switch at the bottom of the editor flips between FRAGMENT and VERTEX. The switch appears when the shader has a vertex shader (see Vertex shaders). Add Vertex Shader (context menu, or Edit menu) creates name.vs beside it with the default one; Remove Vertex Shader sends it to the Trash.

Whichever you look at, the inspector on the right keeps showing the ISF header of the shader.

Writing

The editor highlights GLSL and ISF, and shows the line where the compiler complains. Under it, the toolbar has:

  • JSON metadata and main(): fold or unfold the ISF header and the main() function (the gutter does the same);
  • Minimap: shows a small map of the code beside it;
  • Format: tidies the code, leaves the header alone, and counts as one step in the history;
  • Find: opens the search (see below);
  • Copy: copies the code;
  • Input controls, at the right end: shows or hides the live values of the inputs beside the code. It is disabled for a shader with no input.

Finding and replacing

Cmd+F, or Find in the toolbar, opens a search field at the top right of the code. It has the switches Aa for the case, ab for whole words and .* for a regular expression, a count of the matches, and the arrows to go from one to the next. Open the replacement field to replace one match or all of them. Escape closes it.

The CODE view of a pipeline has the same search, without the replacement: the code is read only.

The Toolbox holds snippets you can drop into the code.

Undo

Every edit goes in the history of the document: undo with Cmd+Z, redo with Cmd+Shift+Z. The History view lists the steps and lets you go back to any of them.

Save

Cmd+S, Save As… or Save All. See Saving and drafts.