Skip to content
View source

Your first scene

A scene (.esn) is the graph: it uses Kernel libraries, declares inputs, params and outputs, and places nodes. Continuing from the last page, create scene.esn in rings/:

use "kernels/";
param warmth: Float = 0.6;
node rings: demo.rings@1 { domain = vec2(256, 256); count = 8.0; }
node tint: demo.tint@1 { source <- rings.result; warmth = warmth; }
output result <- tint.result;
Form Meaning
use "kernels/"; Every .ent in the directory (or one file, or a package: use "image.entpkg";).
param warmth: Float = 0.6; A graph parameter the caller may override (--param, the protocol’s param).
node rings: demo.rings@1 { … } A node referencing a published Kernel by id.
domain = vec2(256, 256); A generator with no inputs needs a domain: an integer for Rows, vec2 for Grid, vec3 for Volume; or window().
count = 8.0; A node’s param value: a literal or a graph param by name, never an expression.
source <- rings.result; A wire: reads rings’s output in this evaluation, a dependency. Wiring is written only at the consumer.
output result <- tint.result; A named graph output. The first Image output is what the scene shows.
终端窗口
entelechy run scene.esn --out out.png
scene loaded
published demo.rings@1 g1 from kernels/rings.ent
published demo.tint@1 g2 from kernels/rings.ent
evaluated in 1.32ms: executed [tint+rings], reused 0 -> out.png

The first scene’s output

executed [tint+rings] says the two nodes were fused into one run: tint samples rings only at its own element, so the intermediate is never written. graph shows the plan:

终端窗口
entelechy graph scene.esn
// published: demo.rings@1 g1, demo.tint@1 g2, native.cover@1 g0, …
// plan: 1 group(s)
// tint + rings: fused.tint@1 vec2(256, 256)

Override a param:

终端窗口
entelechy run scene.esn --out warm.png --param warmth=1.0
终端窗口
entelechy trace scene.esn --node tint --at 10 10
tint (demo.tint@1), element (10, 10), as the evaluation at time 0 runs it
c: Vec4 = vec4(0, 0, 1, 1)
-> result: Vec4 = vec4(0, 0, 0.4, 1)

trace runs one element on the interpreter, printing every let with its type and value; it commits nothing.

tests/rings.replay:

scene ../scene.esn
frame 0.0
expect count rings.result = 65536
expect 128 128 = 0.0 0.0 0.4
终端窗口
entelechy replay tests/rings.replay
tests/rings.replay: ok (1 frames, 2 checks)

The whole replay syntax is in Replay tests. This page’s three files are a download.

Next: Live swap — change it while it runs.