1// this config defines various heightmap brushes
2
3// a brush has two parts: the brushmap and the brushhandle
4
5// the brushmap is a 2D field that defines how the brush affects a heightmap
6
7// the brushhandle is a 2D vertex on the brushmap.
8// this handle is a reference point on the brushmap which represents
9// where the editing cursor is pointed at.
10
11// clearbrush                   : resets the brushmap
12// brushvert <x> <y> <value>    : set a point on the brushmap
13// brushx <x>                   : the x coordinate of the brushhandle
14// brushy <y>                   : the y coordinate of the brushhandle
15
16brushhandle = [
17    brushx $arg1
18    brushy $arg2
19]
20
21brushindex = -1
22brushmax = -1                // make sure to bump this up if you add more brushes
23
24selectbrush = [
25    brushindex = ( + $brushindex $arg1 )
26    if (< $brushindex 0) [ brushindex = $brushmax ]
27    if (> $brushindex $brushmax) [ brushindex = 0 ]
28    do [brush_@brushindex]
29    echo (concatword "^fyHeightmap Brush: ^fw" (getbrushname))
30]; setcomplete "selectbrush" 1
31
32brushverts = [
33    loop y (listlen $arg1) [
34        bv = (at $arg1 $y)
35        loop x (listlen $bv) [
36            brushvert $x $y (at $bv $x)
37        ]
38    ]
39]
40
41newbrush = [
42    brushmax = (+ $brushmax 1)
43    do [
44        brush_@brushmax = [
45            clearbrush
46            @@(if (> $numargs 1) [result [brushname @arg1; brushhandle @arg2 @arg3; brushverts [@@arg4]]])
47        ]
48    ]
49]
50
51newbrush "Tip 1-0 Brush" 0 0 [1]
52newbrush "Tip 2-1 Brush" 2 2 [
53    ""
54    "0 0 1 "
55    "0 1 2 1 "
56    "0 0 1 "
57]
58newbrush "Tip 4-2-1 Brush" 2 2 [
59    "0 0 1 "
60    "0 1 2 1 "
61    "1 2 4 2 1 "
62    "0 1 2 1 "
63    "0 0 1 "
64]
65newbrush "Soft 4-3 Brush" 2 2 [
66    ""
67    "0 2 3 2 "
68    "0 3 4 3 "
69    "0 2 3 2 "
70]
71newbrush "Soft 5-4-2 Brush" 2 2 [
72    "1 2 2 2 1"
73    "2 3 4 3 2"
74    "2 4 5 4 2"
75    "2 3 4 3 2"
76    "1 2 2 2 1"
77]
78newbrush "Square 3x3 brush" 1 1 [
79    "1 1 1 "
80    "1 1 1 "
81    "1 1 1 "
82]
83newbrush "Square 5x5 brush" 2 2 [
84    "1 1 1 1 1 "
85    "1 1 1 1 1 "
86    "1 1 1 1 1 "
87    "1 1 1 1 1 "
88    "1 1 1 1 1 "
89]
90newbrush "Square 7x7 brush" 3 3 [
91    "1 1 1 1 1 1 1 "
92    "1 1 1 1 1 1 1 "
93    "1 1 1 1 1 1 1 "
94    "1 1 1 1 1 1 1 "
95    "1 1 1 1 1 1 1 "
96    "1 1 1 1 1 1 1 "
97    "1 1 1 1 1 1 1 "
98]
99
100newbrush "Smooth 3x3 brush" 1 1 [
101    "0 0 0 "
102    "0 "
103    "0 "
104]
105newbrush "Smooth 5x5 brush" 2 2 [
106    "0 0 0 0 0 "
107    "0 "
108    "0 "
109    "0 "
110    "0 "
111]
112newbrush "Smooth 7x7 brush" 3 3 [
113    "0 0 0 0 0 0 0"
114    "0 "
115    "0 "
116    "0 "
117    "0 "
118    "0 "
119    "0 "
120]
121
122newbrush "Noise 25x25 Brush" 12 12 [
123    "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 "
124    ""
125    "0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 "
126    "0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 2 2 "
127    "0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 "
128    "0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 1 0 0 0 1 1 0 0 1 "
129    "0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 2 "
130    "0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 2 "
131    "0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 1 "
132    "0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 "
133    "0 1 0 2 0 1 1 1 1 0 0 1 0 0 0 0 1 "
134    "0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 "
135    "1 0 1 0 0 0 0 0 1 0 0 0 1 0 1 "
136    "0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 "
137    "0 1 1 1 0 3 0 2 0 0 0 1 1 0 0 0 1 1 "
138    "0 0 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 "
139    "0 0 1 1 0 0 0 0 2 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 "
140    "0 1 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 "
141    "1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 "
142    "0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 "
143    "0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 "
144    "0 0 0 0 1 0 1 1 0 2 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 "
145    "0 0 0 0 0 0 0 0 0 1 0 1 "
146    "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 "
147]
148
149do [ brush_2 ] // 421
150
151//blendmap brushes; not heightmap related, but whatever :P
152loopfiles curbrush blendbrush png [ addblendbrush $curbrush (concatword "blendbrush/" $curbrush ".png") ]
153