REM Project: matrix test
REM Created: 12.04.2013 0:35:07
REM
REM ***** Main Source File *****
REM make demo from examples
cls
sync on
sync rate 100
hide mouse
make object cube 1,10
position object 1,100,0,0
SET DISPLAY MODE 1024, 768, 16
SET WINDOW ON
SET WINDOW LAYOUT 0, 0, 0
MAXIMIZE WINDOW
disable escapekey
CLOUDP = 25
Dim OBJ( 7 )
RTS Set Auto Zoom 1.0
Cls 0 : Set Cursor 0,0 : Ink Rgb( 255, 255, 255 ), 0
RTS Fog On
Backdrop On
RTS Setup Skybox "RTS_MassiveMountain", 0
RTS Set Clock 3 , 0 , 1.0
RTS Set Wind Speed 0.0001, 0.0005
Set Camera Range 1 , 110000
Clear Camera View 0 , Rgb( 0 , 0 , 0 )
Position Camera 0 , 0 , 0
CLOUDS = RTS Get Loaded Object( 1 )
If CLOUDS = 0 Then End
rem Create matrix
load image "ground.bmp",100
load image "water.bmp",200
make matrix 1,5000,5000,50,50
PREPARE MATRIX TEXTURE 1, 100, 1,1
make matrix 2,5000,5000,50,50
PREPARE MATRIX TEXTURE 2, 200, 1,1
position matrix 2,0,10,0
position camera 500,10,500
point camera 50,10,51
for d=1 to 50
col=rnd(500)+100
rad=rnd(10)+10
rx=rnd(50)
ry=rnd(50)
alfastep#=90/rad
alfa#=90
for r=0 to rad
col1#=rad*cos(alfa#)
alfa#=alfa#-alfastep#
for ang=1 to 360
xx=int(rx+sin(ang)*r)
yy=int(ry+cos(ang)*r)
if xx>50 then xx=xx-50
if yy>50 then yy=yy-50
if xx<0 then xx=xx+50
if yy<0 then yy=yy+50
rem col1=GET GROUND HEIGHT(1, xx, yy)
rem if col1>col then col=col1
rem if col1<col then col=col
SET MATRIX HEIGHT 1,xx ,yy,col1#*3
next ang
next r
next d
for d=1 to 5
col=-rnd(500)+100
rad=rnd(10)+1
rx=rnd(50)
ry=rnd(50)
alfastep#=90/rad
alfa#=90
for r=0 to rad
col1#=rad*cos(alfa#)
alfa#=alfa#-alfastep#
for ang=1 to 360
xx=int(rx+sin(ang)*r)
yy=int(ry+cos(ang)*r)
if xx>50 then xx=xx-50
if yy>50 then yy=yy-50
if xx<0 then xx=xx+50
if yy<0 then yy=yy+50
SET MATRIX HEIGHT 1,xx ,yy,col1#*3
next ang
next r
next d
update matrix 1
repeat
x2#=CAMERA POSITION X()
y2#=camera position z()
if x2#-x1#>100
x1#=2500
x2#=2500
SHIFT MATRIX LEFT 1
endif
if x2#-x1#<-100
x1#=2500
x2#=2500
SHIFT MATRIX right 1
endif
if y2#-y1#>100
y1#=2500
y2#=2500
SHIFT MATRIX down 1
endif
if y2#-y1#<-100
y1#=2500
y2#=2500
SHIFT MATRIX up 1
endif
update matrix 1
rotate camera CAMERA ANGLE X()+mousemovey(),CAMERA ANGLE y()+mousemovex(),0
yh#=GET GROUND HEIGHT(1, x2#, y2#)+7
position camera x2#,yh#,y2#
if upkey()=1 then move camera 10
if downkey()=1 then move camera -10
set cursor 0,0
print SCREEN FPS()
Set Cursor 0 , 0
Print "Frame Rate : " , Screen Fps()
Print "View : " , XAngle , " / " , YAngle
Print "Real Time Hour : " , RTS Get Hour() , "h" , RTS Get Minutes() , "m" , RTS Get Seconds() , "s"
D$ = Inkey$()
CLOUDP = CLOUDP + ( D$ = "z" ) - ( D$ = "a" )
If CLOUDP < 0 : CLOUDP = 0 : Else : If CLOUDP > 100 : CLOUDP = 100 : Endif : Endif
MISTP = MISTP + ( D$ = "s" ) - ( D$ = "q" )
If MISTP < 0 : MISTP = 0 : Else : If MISTP > 100 : MISTP = 100 : Endif : Endif
RTS Set Cloud Density CLOUDP
RTS Set Mist Density MISTP
Print "Clouds, Mist : ", CLOUDP, " / ", MISTP
print "move mouse to rotate camera"
print "arrow keys to move camera"
RTS Update Skybox
print "space key exit"
randomize matrix 2,2
update matrix 2
Sync
Until SpaceKey() = 1
RTS Clear Skybox
delete matrix 1
delete matrix 2
end