You mean like this?
Clicking:
set normalization on
create bitmap 1,64,64
box 0,0,64,64
blur bitmap 1,4
get image 1,0,0,64,64
delete bitmap 1
make matrix 1,80,60,50,50
prepare matrix texture 1,1,1,1
make camera 1
position camera 1,40,50,30
rotate camera 1,90,0,0
set camera to image 1,2,256,256
make object plain 1,50,50
texture object 1,2
position object 1,1000,1000,1000
rotate object 1,90,0,0
position camera 1000,1025,950
rotate camera 20,0,0
type Vertices
Height as float
Fixed as integer
Velocity as float
endtype
dim Grid(2,51,51) as Vertices
sync on
sync rate 30
do
for x=0 to 50
for y=0 to 50
Grid(0,x,y).Height=get matrix height(1,x,y)
next y
next x
if mouseclick()=1
Grid(0,25,25).Height=-100.0
Grid(0,25,25).Fixed=1
endif
for x=1 to 49
for y=1 to 49
if Grid(0,x,y).Fixed=0
a#=Grid(0,x-1,y-1).Height
b#=Grid(0,x-1,y).Height
c#=Grid(0,x,y-1).Height
d#=(Grid(0,x,y).Height+(Grid(0,x,y).Velocity*3.0))*3.0
e#=Grid(0,x-1,y+1).Height
f#=Grid(0,x+1,y-1).Height
g#=Grid(0,x,y+1).Height
h#=Grid(0,x+1,y).Height
i#=Grid(0,x+1,y+1).Height
Grid(1,x,y).Height=(a#+b#+c#+d#+e#+f#+g#+h#+i#)/11.0
Grid(0,x,y).Velocity=(Grid(1,x,y).Height-Grid(0,x,y).Height)+(Grid(0,x,y).Velocity*0.18)
if Grid(1,x,y).Height<-3.0
inc Grid(0,x,y).Velocity,1.0
endif
if Grid(1,x,y).Height>3.0
dec Grid(0,x,y).Velocity,1.0
endif
`Grid(1,x,y).Height=Grid(1,x,y).Height+Grid(0,x,y).Velocity
`Grid(0,x,y).Velocity=curvevalue(0.0,Grid(0,x,y).Velocity,20.0)
else
Grid(1,x,y).Height=Grid(0,x,y).Height
dec Grid(0,x,y).Fixed,1
endif
set matrix height 1,x,y,Grid(1,x,y).Height
next y
next x
SetNormals()
update matrix 1
sync
loop
Function SetNormals()
For X=1 To 49
for Z=1 To 49
H8#=Get Matrix Height(1,X,Z-1)
H4#=Get Matrix Height(1,X-1,Z)
H#=Get Matrix Height(1,X,Z)
H2#=Get Matrix Height(1,X,Z)
X1#=(X-1)*25.0 : Y1#=H#
X2#=(X+0)*25.0 : Y2#=H4#
DX#=X2#-X1#
DY#=Y2#-Y1#
AX#=ATanFull(DX#,DY#)
AX#=WrapValue(90-AX#)
Z1#=(Z-1)*25.0 : Y1#=H2#
Z2#=(Z+0)*25.0 : Y2#=H8#
DZ#=Z2#-Z1#
DY#=Y2#-Y1#
AZ#=ATanFull(DZ#,DY#)
AZ#=WrapValue(90-AZ#)
NX#=Sin(AX#)
NY#=Cos(AX#)
NZ#=Sin(AZ#)
Set Matrix Normal 1,X,Z,NX#,NX#,NZ#
Next Z
Next X
Update Matrix 1
EndFunction
TinTin's rain version:
set normalization on
create bitmap 1,64,64
box 0,0,64,64
blur bitmap 1,4
get image 1,0,0,64,64
delete bitmap 1
make matrix 1,80,60,50,50
prepare matrix texture 1,1,1,1
make camera 1
position camera 1,40,50,30
rotate camera 1,90,0,0
set camera to image 1,2,256,256
make object plain 1,50,50
texture object 1,2
position object 1,1000,1000,1000
rotate object 1,90,0,0
position camera 1000,1025,950
rotate camera 20,0,0
type Vertices
Height as float
Fixed as integer
Velocity as float
endtype
dim Grid(2,51,51) as Vertices
sync on
sync rate 30
do
for x=0 to 50
for y=0 to 50
Grid(0,x,y).Height=get matrix height(1,x,y)
next y
next x
X=Rnd(48)+2
Y=Rnd(48)+2
Z=-(Rnd(2)+2)
Grid(0,X,Y).Height=Z
Grid(0,X,Y).Fixed=1
Grid(0,X+1,Y).Height=Z
Grid(0,X+1,Y).Fixed=1
Grid(0,X,Y+1).Height=Z
Grid(0,X,Y+1).Fixed=1
Grid(0,X+1,Y+1).Height=Z
Grid(0,X+1,Y+1).Fixed=1
for x=1 to 49
for y=1 to 49
if Grid(0,x,y).Fixed=0
a#=Grid(0,x-1,y-1).Height
b#=Grid(0,x-1,y).Height
c#=Grid(0,x,y-1).Height
d#=(Grid(0,x,y).Height+(Grid(0,x,y).Velocity*3.0))*3.0
e#=Grid(0,x-1,y+1).Height
f#=Grid(0,x+1,y-1).Height
g#=Grid(0,x,y+1).Height
h#=Grid(0,x+1,y).Height
i#=Grid(0,x+1,y+1).Height
Grid(1,x,y).Height=(a#+b#+c#+d#+e#+f#+g#+h#+i#)/11.0
Grid(0,x,y).Velocity=(Grid(1,x,y).Height-Grid(0,x,y).Height)+(Grid(0,x,y).Velocity*0.18)
if Grid(1,x,y).Height<-3.0
inc Grid(0,x,y).Velocity,1.0
endif
if Grid(1,x,y).Height>3.0
dec Grid(0,x,y).Velocity,1.0
endif
`Grid(1,x,y).Height=Grid(1,x,y).Height+Grid(0,x,y).Velocity
`Grid(0,x,y).Velocity=curvevalue(0.0,Grid(0,x,y).Velocity,20.0)
else
Grid(1,x,y).Height=Grid(0,x,y).Height
dec Grid(0,x,y).Fixed,1
endif
set matrix height 1,x,y,Grid(1,x,y).Height
next y
next x
SetNormals()
update matrix 1
sync
loop
Function SetNormals()
For X=1 To 49
for Z=1 To 49
H8#=Get Matrix Height(1,X,Z-1)
H4#=Get Matrix Height(1,X-1,Z)
H#=Get Matrix Height(1,X,Z)
H2#=Get Matrix Height(1,X,Z)
X1#=(X-1)*25.0 : Y1#=H#
X2#=(X+0)*25.0 : Y2#=H4#
DX#=X2#-X1#
DY#=Y2#-Y1#
AX#=ATanFull(DX#,DY#)
AX#=WrapValue(90-AX#)
Z1#=(Z-1)*25.0 : Y1#=H2#
Z2#=(Z+0)*25.0 : Y2#=H8#
DZ#=Z2#-Z1#
DY#=Y2#-Y1#
AZ#=ATanFull(DZ#,DY#)
AZ#=WrapValue(90-AZ#)
NX#=Sin(AX#)
NY#=Cos(AX#)
NZ#=Sin(AZ#)
Set Matrix Normal 1,X,Z,NX#,NX#,NZ#
Next Z
Next X
Update Matrix 1
EndFunction