The output of TOGoSTree4 is specified by a text file. This file is devided into sections, with heading that look like this:
[heading-name heading-arguments ...]
Sections that are recognised are:
[metadata]
- metadata about the file including title and author[animation]
- information about how to set up, execute, and handle output.[tree NAME]
- specify a tree type. If NAME is included, the tree may be used
from a script. Otherwise it will be drawn by itself.[script]
- specify a script that will be run to generate the output. This script
will have access to most animation variables and trees.This section is of the form:
[metadata] title = MY COOL TOGOSTREE4 CONFIG author = FRED THE AWESOME DUDE
This section is of the form:
[animation] config-var = value config-var-2 = another value ...
Most parameters have reasonable defaults. Some recognised parameters and their defaults are:
frames = 1
- Number of frames to render. The current frame number is available to scripts as $frame
.seed = 0
- Seed that will be used by trees and scripts (as $seed
) unless overridden. May be "random
", in which case a random seed will be selected on each run.crop-output-images = off
- If set to "on
", images will have any completely transparent rows of pixels at the top, bottom, and sides removed before being output.image-output-mode = argb
- If set to "doom-palette
", images will be converted to the doom palette before being output.output-grab = off
- Include a 'grAb' chunk in output PNGs corresonding to the origin of the image (if used with 'crop-output-images', cropping will be taken into account to recalculate grab point)These won't make sense unless you've looked at some example configs
public float baseSolidScale = 1; public float baseSpanScale = 1; public float baseRot = 0; public float minSpans = 1; public float maxSpans = 1; public float minLength = 100; public float maxLength = 100; public float changeSolidScale = 0.6f; public float changeSpanScale = 0.8f; public float minCurve = -0.0f; public float maxCurve = 0.0f; public float gnarliness = 0.0f; public float minRot = -1; public float maxRot = 1; public float[] baseColor = null; public float[] changeColor = null; public float[] randColor = null; public float baseChildRot = 0; public float minChildRot = 0; public float maxChildRot = (float)(2*Math.PI); public float minChildren = 2; public float maxChildren = 4; public float minChildAngle = 0.5f; public float maxChildAngle = 0.7f; public float tipChildScale = 0.0f; public float tipChildRot = 0.0f; public float subDivision = 4.0f; public boolean mirrorChildren = false; public boolean drawBase = false;
More parameter hints:
baseSolidScale
and baseSpanScale
can be set together as baseScale
changeSolidScale
and changeSpanScale
can be set together as changeScale
seed
can be specified directly under [tree].seed
can be specified directly under [animation]. This will be
the default value of $seed
in scripts and for trees[tree]
(no name specified) will specify a tree to be
drawn immediately.[tree NAME]
will create a tree that will not be automatically drawn,
but may be draw
n from a script.(CAPITALIZED WORDS indicate variable content)
brush:red = R ; brush:green = G ; brush:blue = B
- set red, green, and blue variablesbrush:unified-noise = N
- set the 'unified noise' to be applied to objects drawn. There's also brush:red-noise
, brush:green-noise
, and brush:blue-noise
.iscale X
- multiply the 'solid' scale by X - makes lines thicker.oscale X
- multiply the 'span' scale by X - makes lines longer.scale X
- multiply solid and span scales by X.move X Y Z
- move the current transform.rotate X Y Z A
- rotate the current transform A radians around the vector (X,Y,Z).scale X
- multiply solid and span scales by Xnewctx { CODE }
- Run code in a new context.
After returning, all variables will be restored. This includes brush attributes
and the current transform, as well as any user defined variables.
plot ()
- Draw a sphere at the origin of the current transform using the current brush attributesdraw OBJECT
- Draw an object at the origin of the current transform.
Trees defined with [tree NAME]
will be available as $NAME
,
e.g.
[tree fred] blah blah blah [script] move 10 0 0 draw $fred
seed = X
- Set the 'seed' for subsequently drawn trees.
Only effective if seed is not specified in the tree config.rand = newrand SEED
- Create a new random number generator with seed SEED
(should be an integer) and assign it to the variable 'rand'random-number = rand -5 5
- Use the previously created random number generator
to get a new number between -5 and 5random-integer = rand -i
- Use the previously created random number generator
to get a random integer (useful as a value for seed
)my-func = func {A B C} { CODE }
- Create a new function that takes 3 arguments and executes
CODE in a new context (preserves the caller's variables)my-func = ufunc {A B C} { CODE }
- Create a new unscoped function that takes 3 arguments and executes
CODE in the caller's context (var assignments other than parameters will override the caller's)my-func "Hello, world" 1 -67.3
- Call a functionmy-func ()
- Call a function that takes no args ('()
' evaluates to null, so the function actually recieves one argument)my-func
- Evaluates to the function itself.call $my-func
- Another way to call a function with no arguments.my-list = list A B C
- Create a list with 3 elements.first-element = my-list 0
- Get an item from a list.my-string = string "one plus five equals " (1 + 5) "!"
- create the string "one plus five equals 6!"ui text = "I am text in the UI"
- Set UI text.if {cond} {stuff} else {other-stuff}
- Conditionally evaluate code.while {cond} {stuff}
- Evaluate code while a condition is true.