This commit is contained in:
Deni 2019-03-13 10:00:37 +01:00
parent 79d8c3c83a
commit 194dbeac50
4 changed files with 357 additions and 0 deletions

179
city.cfdg Executable file
View File

@ -0,0 +1,179 @@
/*
city-reflection.cfdg
by AK, Jan 2009
city.cfdg with reflections
Variants: IOH, XCZ, ...
*/
startshape city
background { b -0.90 h 270 sat 0.5 }
/** city has horizontal "skyline" strips vanishing into
distance **/
rule city {
skyline{y -20}
city { s -0.9 0.85 0.9 }
}
rule city 0.1{} // on average 10 skyline strips
rule skyline{ // each strip consists of two half-strips
back-to-back
semiskyline{ x 9 }
semiskyline { x 3 flip 90 }
}
rule semiskyline 2 {
building_site{}
semiskyline { x 15 }
}
rule semiskyline 2 {
building_site{}
semiskyline { x 20 }
}
rule semiskyline{} // on average 5 building sites per
semiskyline
/*************** building sites: some occupied, some vacant
***********/
rule building_site 2{
building{s 10 10 10} // building drawn in the plane
z=10 with reflection drawn in the plane z=-10
G{s 50 5 b 0 sat 1 h 60}
haze {z 9.9 }
haze {z 10.1 }
}
rule building_site 1{
G{s 50 5 b 0 sat 1 h 60}
haze {z 9.9 }
}
/* Each building has a random number of +/- 20% rescaling
steps applied to it. */
rule building 3{building{ s 1 0.8}}
rule building 3{building {s 1 1.2}}
rule building 2{building{ s 0.8 1}}
rule building 2{building {s 1.2 1}}
/* There are three types of buildings, of height 1, 2 or 4
units.
Each has a matching reflection that is proportional
to the building. */
rule building{ B1{ z 1} R1{z -1} }
rule building{ B2{z 1} R2{z -1} }
rule building{ B3{z 1} R3{z -1} }
rule B1{BOX{}}
rule B2{B1{y 1}B1{}}
rule B3{B2{y 2}B2{}}
/* There are three different styles of reflection possible
*/
// Style 1: reflections on rough water
rule R1{RF{ s 1.2 -1.4 y -0.5 b 0.5 sat 0.3 h 180}}
rule R2{RF{ s 1.2 -2.8 y -0.5 b 0.7 sat 0.3 h 180}}
rule R3{RF{ s 1.2 -5.6 y -0.5 b 0.9 sat 0.3 h 180}}
/* vvv----------- unused code --------vvv
// Style 2: reflections on smooth water - not so good as
different windows are lit
rule R1{B1{h 240 sat 0.5 b -0.5 s -1}}
rule R2{B2{h 240 sat 0.5 b -0.5 s -1}}
rule R3{B3{h 240 sat 0.5 b -0.5 s -1}}
// Style 3: tapered reflections on smooth water
rule R1{BOX{h 240 sat 0.5 b -0.5 s -1}}
rule R2{R1{ y -1 s 0.8 1} R1{ s 1.2 1} }
rule R3{R2{ y -2 s 0.64 1 } R2{ s 1.44 1}}
^^^----------- unused code -----------^^^ */
/* This is the element from which buildings are built. A
box with windows. */
rule BOX{
SQUARE{ y 0.5 }
wa{ y 0.5 s 0.8 1 z 0.1}
}
/* get windows on BOX by progressive subdivision */
rule wa{ wb { s 1 0.5 y -0.25 } wb{ s 1 0.5 y 0.25 } }
rule wb{ wc{ s 1 0.5 y -0.25 } wc{ s 1 0.5 y 0.25 } }
rule wc{ wd{ s 0.5 1 x -0.25 } wd { s 0.5 1 x 0.25 }}
rule wd{ we{ s 0.5 1 x -0.25 } we { s 0.5 1 x 0.25 }}
/* but only some windows are lit */
rule we 2 {}
rule we{ win{}}
/* some alternative window subdivision pathways that give
all or no lit windows on a floor */
rule wc 0.1{ wdx{ s 0.5 1 x -0.25 } wdx { s 0.5 1 x 0.25 }}
rule wc 0.1{}
rule wdx{ win{ s 0.5 1 x -0.25 } win { s 0.5 1 x 0.25 }}
/* possibly tweak window colour and brightness */
rule win 3{ win {b 0.2 }}
rule win 3{ win {b -0.2 }}
rule win { win {h 20 }}
/* a window */
rule win{
SQUARE { size .8 0.7 b .5 sat +0.2 }
SQUARE { s 0.1 0.8 b -1} // vertical divider
// SQUARE { s 0.8 0.1 b -1} // horizontal divider
}
/* Reflection on rough water.
The tear-drop shape comes from a shape
being scaled non-proportionally
while progressively shifted. */
rule RF{
SPARKLE{ s 2 0.1 x 1}
SPARKLE{ s 2 0.1 b 0.2}
RF[ y 1 s -0.9 0.96 y -1 b -0.02]
}
rule SPARKLE{ // shiny filler
CIRCLE{ s 1.5 0.5 a -0.98}
6 * {r 60} SPARK { s 0.15 x 0.5 a -0.8}
}
rule SPARK{TRIANGLE{}}
rule SPARK 5{SPARK{r 222}}
rule SPARK 2{SPARK{x 1}}
rule SPARKLE 5 {SPARKLE{r 223}}
rule SPARKLE 2{
SPARKLE{s 0.7 x 0.5}
SPARKLE{s 0.7 x -0.5}
}
rule SPARKLE 0.5{}
/* Ground - a generic blobby shape */
rule G{ CIRCLE{} }
rule G{ CIRCLE{}
G{ y -0.5 s 0.7 0.7 r 60}
G{ y -0.5 s 0.7 0.7 r -60} }
rule G{ G {r 10}}
rule G{G { flip 90}}
rule G 0.2{}
/* ------------ Ground level haze ------------*/
rule haze { haze { x .1 }}
rule haze { haze { x -.1 }}
rule haze {
hazecircle { }
haze { s 1 0.3 x .5 b .3}
haze { s 1 0.3 x -.5 b .3}
}
rule haze .5{}
rule hazecircle { hazecircle { r 10 }}
rule hazecircle { hazecircle { flip 90 }}
rule hazecircle {
CIRCLE { s 30 20 z 0.1 h 40 b 0.5 sat .2 a -0.98 }
}

145
confined.cfdg Normal file
View File

@ -0,0 +1,145 @@
startshape Scene
CF::Impure = 1
//CF::Background = [b -0.8 sat 1 h 200]
CF::Background = [b -0.8]
CF::Size = [s 3]
//random variable that controls how straight the path is
bend = -5..-1
shape Scene {
// Storm
Path(29.5,0,160..200,0) [s (1/60)]
// Square
//loop 10 [s 0.998 a -0.2] Frame [s 0.5 z 1000 b 1 sat 0.4 h 180]
loop 10 [s 0.998 a -0.2] Frame [s 0.5 z 1000 b 0.96 sat 0.81 h 38]
// Outer square
//loop 10 [s 1.003 a -0.2] Frame [s 0.5 z 1000 b 1 sat 0.4 h 180]
loop 10 [s 1.003 a -0.2] Frame [s 0.5 z 1000 b 0.96 sat 0.81 h 38]
// Backgroud glow
//Glow []
}
path Frame
{
MOVETO(1,1)
LINETO(-1,1)
LINETO(-1,-1)
LINETO(1,-1)
CLOSEPOLY()
STROKE(0.01) []
}
shape Path (number px, number py, number pr, number idx)
rule 4000 {
// number of steps to take
if (idx < 2000) {
if (max(abs(px),abs(py)) < 30 ) {
//change the values in rand to
//alter the behaviour of the beam
Path( px + cos(pr), py + sin(pr), pr + rand(bend,2), idx + 1 ) []
// glowing beam
transform [x px y py r pr ] {
loop 10 [s 1 1.5 a -0.4] SQUARE [
// notranje strele
b 0.96 sat 0.81 h 38 s 0.85 0.08]
//b 1 sat 0.4 h 180 s 0.85 0.08]
}
}
else {
Flash[x px y py z 1 s 1.5]
//detect which edge we have crossed and reflect
if (px > 30) {
Path(px/1.004 - cos(pr), py+sin(pr), 180-pr, idx +1) []
Lightning [ x px y py r -5..5]
}
if (px < -30) {
Path(px/1.004 - cos(pr), py+sin(pr), 180-pr, idx +1) []
Lightning [[ x px y py r -5..5 r 180]]
}
if (py > 30) {
Path(px + cos(pr), py/1.004 - sin(pr), pr*-1, idx +1) []
Lightning [[ x px y py r -5..5 r 90]]
}
if (py < -30) {
Path(px + cos(pr), py/1.004 - sin(pr), pr*-1, idx +1) []
Lightning [[ x px y py r -5..5 r -90]]
}
}
}
// done iterating, draw the particle!
else { Flash[[ x px y py z 1 r pr s 1.5 0.4 ]] }
}
// Pike na kvadratu
shape Flash{
loop 10 [s 1.4 a -0.4]
//CIRCLE[b 1 sat 0.4 h 180 s 0.6..1]
CIRCLE[b 0.96 sat 0.81 h 38 s 0.6..1]
}
shape Lightning
rule 10{
LightningUnit []
Lightning [x 1]
Glow2 [s 2 a -0.5]
}
rule 1.5 {
Lightning[r 30..45]
Glow2 [s 4 a -0.5]
}
rule 1.5 {
Lightning[r -30..-45]
Glow2 [s 4 a -0.5]
}
rule 1 {
// s 0.6 normally
Lightning[r 20..45 s 0.6 0.8 a -0.5]
Lightning[r -20..-45 s 0.4 0.8 a -0.5]
Glow2 [s 4 a -0.5]
}
// Strele zunaj
shape LightningUnit {
loop 20 [s 1 1.1 a -0.2]
//SQUARE [b 1 sat 0.4 h 180 s 0.89 0.1 x 0.5]
SQUARE [b 0.96 sat 0.81 h 38 s 0.89 0.1 x 0.5]
}
shape Glow {
loop 30 [s 0.97 a -0.04 ]
//CIRCLE [s 2.3..2.5 x -0.1..0.1 y -0.1..0.1 b 1 sat 0.6 h 180 a -0.97]
CIRCLE [s 2.3..2.5 x -0.1..0.1 y -0.1..0.1 b 0.96 sat 0.81 h 38 a -0.97]
}
shape Glow2 {
loop 5 [s 0.7 a -0.4 ]
//CIRCLE [s 2.3..2.5 x -0.1..0.1 y -0.1..0.1 b 1 sat 0.4 h 180 a -0.99]
CIRCLE [s 2.3..2.5 x -0.1..0.1 y -0.1..0.1 b 0.96 sat 0.81 h 38 a -0.99]
}
// BNR AKL ABD VFF VFJ VFL VFP

14
snowflake.cfdg Executable file
View File

@ -0,0 +1,14 @@
background{b -.95 sat 1 h 270}
startshape init
rule init{turn{sat -1 b 1 a -.995 |sat -1}}
rule turn{
CIRCLE{x 1.77 y .13 s .5} SQUARE{x .5 y -.05 s 1 .1 sat
-1}
turn{ |sat .05 sat 1| a .1 z 1 r -2.072 s 0.299}
turn{ |sat .05 sat 1| a .1 z 1 x 1 r 45.928 s
(1/sqrt(.85)*0.299)}
turn{ |sat .05 sat -1 h 144 z 1 x
(1+1/sqrt(.85)*cos(48)) y (1/sqrt(.85)*sin(48)) r -48 s
(sqrt(.85))}
}

19
symchasm.cfdg Executable file
View File

@ -0,0 +1,19 @@
startshape r0
background {b -1}
rule r0{16*{a -0.2}r1{b 1}}
rule r1 {r2[] r2[s 0.5 x 2.5] r1[x 2.5]}
rule r1 {r2[] r2[s 0.5 y 2.5] r1[y 2.5]}
rule r1 {r1[skew 0 5]}
rule r1 {r1[skew 0 -5]}
rule r1 0.3 {r1 {f 0} r1 {f 45}}
rule r1 {r1[s 0.8]}
rule r2 {r4{a -100 b -100 } r3{}}
rule r4 {CIRCLE[a 0.008 b 0.8 s 10]}
rule r3 { CIRCLE{}}
rule r3 { TRIANGLE{}}
rule r3 { SQUARE{}}
rule r3 { r3{b 1} r3{r 45 b -1 s 0.8}}
rule r3 4 {r3{s 0.9}}