Context-free city

%3 cluster_2f5b0fa2_5316_45d6_9435_2ee7cc71f216 Context-free city _6fa145ea_4fe7_4ab3_a1c7_7255214b0f1f CFDG __0:cluster_2f5b0fa2_5316_45d6_9435_2ee7cc71f216->_6fa145ea_4fe7_4ab3_a1c7_7255214b0f1f

A simple vaporwave-style city rendered with CFDG.

startshape SCENE

CF::Background = [hue 300 sat 1 b -0.9]
// CF::Size = [s 100 0 x 0 y 0] // center on (-xpos, -ypos)
CF::Size = [  s 100 100 x 0 y 0 ]

shape SCENE {
    FLOOR [ hue rand(0, 360) ]
    CITY [ sat 1 b 0.5 s .5 y -25 x 100 ]
    SKY [ y 10 z -100 ]
}

// SKY
shape SKY {
    loop 10 [ y 5 ] STAR_ROW [ x - 70]
}

shape STAR_ROW {
    loop 28 [ x + 5 ] STAR_POINT []
}

shape STAR_POINT {
    MAYBE_STAR [ x + rand(-10, 10) y + rand(-10, 10) ]
}

shape MAYBE_STAR
rule 1 { STAR [] }
rule 5 { STAR [ s .5 ] }
rule 1 {  }

shape STAR {
    STAR_p [ b 1 ]
}

path STAR_p {
 	MOVETO(-1, 0)
	LINETO(-.75, .1)
	LINETO(-.5, .25)
	LINETO(-.25, .5)

	LINETO(0, 1)
	LINETO(.1, .75)
	LINETO(.25, .5)
	LINETO(.5, .25)

	LINETO(1, 0)
	LINETO(.75, -.1)
	LINETO(.5, -.25)
	LINETO(.25, -.5)

	LINETO(0, -1)
	LINETO(-.1, -.75)
	LINETO(-.25, -.5)
	LINETO(-.5, -.25)

	CLOSEPOLY()
}

// CITY
shape CITY {
    // S was 0.8
    loop 6 [ y 15 s 0.8 b -0.5 z -5 ] BUILDING_ROW [ x -1 hue rand (0, 360) ]
}

shape BUILDING_ROW {
    loop 30 [ x -40 ]
    BUILDING [
        x rand (0, 28)
    ]
}

shape BUILDING {
    BUILDING_BODY []
    BUILDING_WINDOWS [ x - 6 y + 6 z + 1]
}

shape BUILDING_BODY {
    // Front body
    SQUARE [ s 20  ]
    SQUARE [ s 20 y -20 ]

    // Back body
    SQUARE [ s 20 y 5 x 5 z -1 b -0.5 ]
    SQUARE [ s 20 y -15 x 5 z -1 b -0.5 ]

    // Connection for 3d effect
    TRIANGLE [ s 7 b -0.5 y -26 x 11 r 45 z -1 ]
    TRIANGLE [ s 7 b -0.5 y 11 x -6 r -13 z -1 ]
}

shape BUILDING_WINDOWS {
    loop 7 [ y - 4 ] BUILDING_WINDOWS_ROW []
}

shape BUILDING_WINDOWS_ROW {
    loop 4 [ x + 4 ] BUILDING_WINDOW []
}

shape BUILDING_WINDOW
rule 2 {
    SQUARE [ sat -0.5 b +1 ]
    SQUARE [ sat -0.5 y -1 b +1 ]
}
rule { }

// Floor
shape FLOOR {
    loop 50 [ y - 1 b +0.0025 ] SQUARE [ s 100 z - 100 y -50 sat 1 ]
}