Visual

CodeForest
ShapeLibrary.cfdg
startshape TestShape
rule TestShape {
EMPTYSQUARE { x 0 }
EMPTYCIRCLE { x 2 }
SQUARE { x 0 y -2}
CIRCLE { x 2 y -2}
HEPTAGON { x 4 y -2 s 0.5 }
EMPTYHEPTAGON { x 4 s 0.5 }
}
path EMPTYSQUARE {
MOVETO{x 0.5 y 0.5}
LINETO{x -0.5 y 0.5}
LINETO{x -0.5 y -0.5}
LINETO{x 0.5 y -0.5}
CLOSEPOLY{} // go back to (0.5, 0.5) and close the path
FILL{ sat 0 b 1}
STROKE{} // draw a line on the path using the default line width (10%)
}
path EMPTYCIRCLE {
MOVETO{y 0.5}
ARCTO{y -0.5 r 0.5}
ARCTO{y .5 r 0.5}
FILL{ sat 0 b 1}
STROKE{}
}
path HEPTAGON {
MOVETO{x cos(90-360/7) y sin(90-360/7)}
6* {r (360/7)} LINETO{y 1}
CLOSEPOLY{}
}
path EMPTYHEPTAGON {
MOVETO{x cos(90-360/7) y sin(90-360/7)}
6* {r (360/7)} LINETO{y 1}
CLOSEPOLY{}
FILL{ sat 0 b 1}
STROKE{}
}
Forest.cfdg
startshape Ground
include ShapeLibrary.cfdg
//----------GROUND----------//
//Flat Ground
rule Ground 20 {
SQUARE {}
Dirt{ s 2 y -1 b 0.9}
Ground{ x 1}
}
//Hill Up
rule Ground 20 {
SQUARE {}
Dirt{ s 2 y -1 b 0.9}
Ground{ r 1 x 1}
}
//Hill Down
rule Ground 20 {
SQUARE {}
Dirt{ s 2 y -1 b 0.9}
Ground{ r -1 x 1}
}
//Spawn a Tree
rule Ground 3 {
SQUARE {}
Tree { s 2 y 1}
Dirt{ s 2 y -1 b 0.9}
Root {s 2 y -1}
Ground{ x 1}
}
//End the ground
rule Ground 0.5{
}
//----------DIRT----------//
rule Dirt 50{
SQUARE{ z -1}
Dirt{a 0.9 b 0.1 y -1 s 0.9}
}
rule Dirt 50{
SQUARE{ z -1}
Dirt{a 0.9 b 0.1 y -1 s 0.99}
}
//----------TREE----------//
rule Tree{
TreeBranch []
}
rule TreeBranch 500 {
//Trunk Right
EMPTYCIRCLE []
TreeBranch { y 0.2 r 2 s 0.995 }
}
rule TreeBranch 500 {
//Trunk Left
EMPTYCIRCLE []
TreeBranch { y 0.2 r -2 s 0.995 }
}
rule TreeBranch 20{
//Split
EMPTYCIRCLE []
TreeBranch { r -30 s 0.8 }
TreeBranch { r 30 s 0.8}
}
//----------ROOT----------//
//Root
rule Root 20 {
SQUARE {}
Root [ alpha- 0.02 y -0.4 s 0.99 ]
}
//Root Branch Positive
rule Root 5 {
SQUARE {}
Root [ b 0.001 r 15 y -0.4 s 0.95 ]
Root [ b 0.001 r 20 y -0.4 s 0.5 ]
}
//Root Branch Negative
rule Root 5 {
SQUARE {}
Root [ b 0.001 r -15 y -0.4 s 0.95 ]
Root [ b 0.001 r -20 y -0.4 s 0.5 ]
}
//Root Stop
rule Root 0.1 {
}
Tags :



