Visual style definition

The style definition comes from the "style" files. It defines the appearance of the OpenGL display. VisParams properties are created according to the "prop:" sections in the file.

Framsticks calls user defined functions to create and update the object's visual elements during the simulation.

Each function name is built as follows: "[<element_Vstyle>_]<model_Vstyle>_<element>_<action>"

- action="build" when the visual model is first created (load or create geometry and set initial attributes)
- action="update" each time the visual model is displayed (modify geometry to reflect current position or attributes)

"<element>" refers to the kind of the element being processed (part, joint, neuron, model).
The script can access different objects depending on the kind:
1. part
can access:
- "MechPart" after calling Element.useMechPart()
- "Creature" after calling Element.useCreature()

2. joint
can access:
- "MechJoint" after calling Element.useMechJoint()
- "MechPart" after calling Element.useMechPart1() or Element.useMechPart2()
- "Creature" after calling Element.useCreature()

3. neuro
can access:
- "n" after calling Element.useNeuro()
- "Creature" after calling Element.useCreature()

4. model
can access:
- "Creature" after calling Element.useCreature()

"<element_Vstyle>" and "<model_Vstyle>" are element's and model's Vstyle fields. <element_Vstyle> is omitted when the field is empty. Empty model's Vstyle is replaced with "default". Both <element_Vstyle> and <model_Vstyle> can contain several words separated by "_". This is interpreted as a kind of subclassing, i.e. Framsticks will automatically look for the general version of the function when the specific one is not found. Example:
Assuming a part with Vstyle="green" in a model with Vstyle="food" the following functions will be tried until a match is found:
- green_food_part_...
- food_part_...
- default_part_...
So if the experiment requests visualizing some element as "green food" but the visual style only defines generic form of "food", Framsticks will automatically choose the best available visualization.
Global context>>Experiment definition>>Visual style definition