-
Notifications
You must be signed in to change notification settings - Fork 10
/
square.wl
92 lines (67 loc) · 1.04 KB
/
square.wl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#"standard.h"
main {
seed(rand(0,1337))
thing
movestep(-192,-192)
rectop(1024)
}
rectop(n) {
quad(rec(div(n,2)) rotleft)
}
square(n) {
{ final(mul(n,2)) | rec(n) | rec(n) }
}
rec(n) {
eq(n,64)
? final(mul(n,2))
: movestep(n,n)
quad(square(div(n,2)) rotleft)
movestep(sub(0,n),sub(0,n))
}
final(n) {
{ solids(n) | spaces(n) | spaces(n) }
}
-- SPACES --
spaces(n) {
{ base(n) | base(n) | trim(n) }
}
base(n) {
wall("BRICK7")
sqr(n)
floor("DEM1_6")
rightsector(0,128,128)
}
trim(n) {
wall("MODWALL1")
sqr(n)
floor("FLAT4")
rightsector(0,128,128)
movestep(16,16)
sqr(sub(n,32))
floor("FLAT8")
innerrightsector(0,128,128)
movestep(-16,-16)
}
-- SOLIDS --
solids(n) {
{ octasolid(n,div(n,4)) | plat(n) | 0 }
}
plat(n) {
sqr(n)
rightsector(0,64,128)
}
octasolid(n,s) {
wall("MARBLE3")
quad(
straight(s)
rotright
eright(s)
right(s)
rightsector(0,128,128)
rotright
movestep(n,0)
rotright
)
}
-- TOOLS --
sqr(n) { quad(step(n,0) rotright) }