Just to add...
>>I kinda figured out what is means:
>>st_x = Left side of rectangle, en_x = Right side of rectangle
>>st_z = Bottom side of rectangle, en_z = Top side of rectangle
>>Am I right?
Yeah, this is the range of height points that will most likely be in range of the cursor.
>>I think it may have to do with this check:
>>Quote: "brush_v#=vr#/brush_range#
>>if brush_v#<1.0"
>>Where if the value is less then 1 then it won't update that point. Right?
Yup, it will only affect points within the brush range.
>>brush_v# = (distance from center) / (?)
>>Quote: "brush_range#=(cursize*100.0)+100.0"
>>What does this calculate?
>>Quote: "ter(xx,zz)=ter(xx,zz)+((1.0-brush_v#)*15.0*elapsed#)"
This seems to determine the height at that point. What I don't understand is how it is calculated. First what is elapsed#? Why is the number 15 important? Is that the speed?
Yeah, the 15.0 is like the brush strength, and elapsed# is worked out with timer() to give predictable results no matter what the frame rate. The thing with shaders is that on less powerful machines they can really slow things down, so it uses timer based adjustments. This means that moulding a hill for 1 second gives the same hill (probably) no matter how fast the PC is.
>>Quote: "(1.0-brush_v#) "
>>Also, what does this mean exactly?
This is a value 0.0-1.0 which is passed to the paint function as a multiplier, so it's really the brush strength depending on the distance from cursor.