Progen3d Grammar Rules

Grammar Rules

Operators

R,R* – variable initiators

S, T, D, A – Transforms applied to the transformation matrix within the current scope.

I – Instantiate

Initialise Variables

Variables are placed inside Rules.

 R variable_name (min max)   # Float variable
 R* variable_name (min max)  # Integer variable

Example:

X -> R Height (4.6 10.7) Y
Y -> R* xlen (4 6)

Rules

Instantiate variables by placing them in front of the rule name after the counter integer, gives them a random value.

Rules must follow on from one rule to one or more rules in a progression such that all rules are expressed.

Rule_Name counter var_1 var_2 ... var_n  ; probability -> <start section> | < repeat section> | <end section> -> <alternate section>

Rule will repeat counter times.

Example:

X -> R* Height (4 7) R Width (10.1 13.5) Y

Y 8 Width Height ; 0.8 -> | S (Width Height Width) I (Cube) | T (Width+3 0 0) -> Empty

Transformations

Transformations act on the transformation matrix in the current scope.

S – scale

T- Translate

D – Distortion – Adjusts one side of the cube thicknesses on the X axis or Y axis and the width depending on the cube type.

A – Rotate

I – instantiate Cube type

Rule ->
  S ( X Y Z ) : S (variable variable variable) | S (numeric numeric numeric) | S (calculation calculation calculation)
  D ( X Y Z ) : S (variable variable variable) | S (numeric numeric numeric) | S (calculation calculation calculation)
  T ( X Y Z ) : T (variable variable variable) | T (numeric numeric numeric) | T (calculation calculation calculation)
  A (angle_in_degrees axis ) - axis is 0 for x 1 for y 2 for z
  I ( CubeX | CubeY texindex rotate_multiple scaletex) 

Examples:

S (Width-1.5 Height/2 Width*2-4.3)
T (-1.5 Height/2 1.0/Width)
D ( 1 0.01 Width/2 )
A ( Angle 0 )

Sections

A section is any part of the rule after the -> and is made of any of the A,S,T,D,I and scope operators [],{}. All brackets must have spaces either side of them. Sections denoted by angled brackets < > in the description.

Repeat Sections

variables are re-instantiated randomly when included in the rule front.

Rule counter var_1 var_2 ... var_n -> <start section> | <repeat section> | <end section>

The repeat section is repeated counter times. The start section is executed once at the start and the end section once at the end of the repeat section. The sections are separated by | or operators.

Example:

WindowsXN Xlength ->  T ( Xlength/2.0-0.8 0 -1 ) | T ( -0.9 0 0 ) [ S ( 0.8 0.95 0.01 ) T ( 0.9 0 0 ) I ( CubeX 2 0 1 ) ]

Probability

Rule var_1 var_2 ... var_n ; probability -> <section A> -> <section B>

Examples:

AddBuilding ; 0.6 -> T (0 0 3) [ Center ]  T (0 0 -2)  [ SectionX ] [ SectionY ]
ChooseX ; 0.2 -> [ Rules I (type texindex) ] -> ChooseY
ChooseY ; 0.8 -> [ Rules I (type texindex) ] -> [ Rules I (type texindex) ]

Scope Stack

'[' Pushes scope transformation matrix onto the stack.
']' Pops scope transformation matrix from the stack.
'{' Instantiates a new scope transformation matrix onto the stack
'}' Matched bracket the same action as ']'. For completeness.

Leave Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Powered by TranslatePress