/////////////////////////////////////////////////////////////////////////////// // Heightmap Brush List // /////////////////////////////////////////////////////////////////////////////// // a heightmap brush has two parts: the brushmap and the brushhandle // the brushmap is a 2D field that defines how the brush affects a heightmap // the brushhandle is a 2D vertex on the brushmap. // this handle is a reference point on the brushmap which represents // where the editing cursor is pointed at. // clearhbrush : resets the brushmap // hbrushvert : set a point on the brushmap // hbrushx : the x coordinate of the brushhandle // hbrushy : the y coordinate of the brushhandle hbrushhandle = [ hbrushx $arg1 hbrushy $arg2 ] hbrushindex = -1 hbrushmax = -1 // make sure to bump this up if you add more brushes selecthbrush = [ hbrushindex = ( + $hbrushindex $arg1 ) if (< $hbrushindex 0) [ hbrushindex = $hbrushmax ] if (> $hbrushindex $hbrushmax) [ hbrushindex = 0 ] do [hbrush_@hbrushindex] ] hbrushverts = [ loop y (listlen $arg1) [ bv = (at $arg1 $y) loop x (listlen $bv) [ hbrushvert $x $y (at $bv $x) ] ] ] newhbrush = [ hbrushmax = (+ $hbrushmax 1) do [ hbrush_@hbrushmax = [ hbrushname = [@@@arg1] clearhbrush @@(if (> $numargs 1) [result [hbrushhandle @arg2 @arg3; hbrushverts [@@arg4]]]) ] ] ] newhbrush "Circle 1-0" 0 0 [ "1" ] newhbrush "Circle 2-1" 1 1 [ "0 1 0" "1 2 1" "0 1 0" ] newhbrush "Circle 4-2-1" 2 2 [ "0 0 1 0 0" "0 1 2 1 0" "1 2 4 2 1" "0 1 2 1 0" "0 0 1 0 0" ] newhbrush "Square 3x3" 1 1 [ "1 1 1" "1 1 1" "1 1 1" ] newhbrush "Square 5x5" 2 2 [ "1 1 1 1 1" "1 1 1 1 1" "1 1 1 1 1" "1 1 1 1 1" "1 1 1 1 1" ] newhbrush "Square 7x7" 3 3 [ "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" "1 1 1 1 1 1 1" ] newhbrush "Smooth 3x3" 1 1 [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