Hi,
I've got a really weird problem here...
When I load a Geoscape terrain in DarkBasic Classic, i'm just getting some weird matrices placed after each other.
I guess its an bug in the script.
I used the htMAP.dba for DBPro but i modified it a bit.
I Removed the word "GLOBAL" and replaced the camera commands.
But it still looks weird.
Here's the script.
sync on
sync rate 60
hide mouse
autocam off
randomize timer()
color light 0, rgb(255, 255, 255)
`overall position of last matrix
posX# = 0
posZ# = 0
`-----------------------------------------------------------
`ALTER THE FOLLOWING VARIABLE TO LOAD YOUR EXPORTED FILE
`-----------------------------------------------------------
filename$ = "matrix.gdb"
`open the main file to find the files to load
open to read 2 , filename$
`number of db units wide the overall heightmap is
pixelsX# = 0
pixelsZ# = 0
`read the total size in db units of x and z
read float 2 , pixelsZ#
read float 2 , pixelsX#
`number in the X by Z grid of matrices
ZMatrices = 0
XMatrices = 0
read long 2 , ZMatrices
read long 2 , XMatrices
`store a count so we can assign a unique matrix number
count = 1
`load all the matrices in the exported grid
for z = 0 to ZMatrices-1
lastZ# = 0
for x = 0 to XMatrices-1
read string 2, dbmName$
read string 2, bmpName$
lastZ# = LoadMatrix( count, dbmName$, bmpName$ )
count = count + 1
next x
posX# = 0
posZ# = posZ# - lastZ#
next z
close file 2
`setup camera
SET CAMERA RANGE 1, 8000
position camera 0, 400, 0
point camera 100, 0, -100
`main loop
do
rem Crude way to fix mouse pointer (hide this and run again)
position mouse 320,240
rem Use MOUSEMOVE to alter camera angles
cx#=wrapvalue(cx#+mousemovey())
cy#=wrapvalue(cy#+mousemovex())
cz#=wrapvalue(cz#+mousemovez())
rotate camera cx#,cy#,cz#
rem Simple movement
if upkey()=1 then move camera 25
if downkey()=1 then move camera -25
rem Update screen
sync
rem End loop
loop
show mouse
function LoadMatrix( matrixNumber, fileName$, textureName$ )
`read the matrix file
open to read 1 , fileName$
`get the x and z tile values
dimx = 0
dimz = 0
read long 1 , dimx
read long 1 , dimz
`get the db units x and z values
sizeX# = 0
sizeZ# = 0
read float 1 , sizeX#
read float 1 , sizeZ#
`create matrix
make matrix matrixNumber, sizeX#, sizeZ#, dimx , dimz
position matrix matrixNumber, posX# , 0 , posZ#
posX# = posX# + sizeX#
`read in the height data
for z = dimz to 0 step -1
for x = 0 to dimx
read float 1 , ht#
set matrix height matrixNumber ,x , z, ht#
next x
next z
close file 1
`sort out the texture
load image textureName$,matrixNumber
prepare matrix texture matrixNumber,matrixNumber, dimx, dimz
in=1
for z=dimz-1 to 0 step -1
for x=0 to dimx-1
set matrix tile matrixNumber,x,z,in
in = in + 1
next x
next z
set matrix texture matrixNumber, 2, 0
update matrix matrixNumber
endfunction sizeZ#