Thanks for the Hex Editor!(Never know when it might come in handy!)
rEd-EyE your code pulls up the error that [could not understand line]setmatrixheight(1,x,z,a)
Thank you for the code Van-B
Now that I have had time to think about it I did run the .dat file into a string and saved it as a text file to have a better look and see if I could do it. I think I see that the numbers range from about 150-350.
But when you are talking about a heightmap Van "Like using Matedit", will this allow me to output the file so I can use your code snippets above. I do have a heightmap snippet that grabs a greyscale bitmap... I cannot remember where I got it from but it was a well known web site for DBpro...
REM ================
REM System Setup
REM ================
Sync On
Sync Rate 0
Open To Read 1,"heightmap.bmp"
Read Byte 1,Char1
Read Byte 1,Char2
REM Make Certain it is a bitmap
If Upper$(Chr$(Char1) + Chr$(Char2)) = "BM"
REM Begin collecting bitmap data from file header
Read Long 1, VOID :`- Dont need
Read Long 1, VOID :` these bytes
Read Long 1, OFFSET :`- Offset to bitmap data
Read Long 1, VOID :`- Don't need this
Read Long 1, WIDTH :`- Width
Read Long 1, HEIGHT :`- Height
Read Word 1, VOID :`- Don't need these 2 bytes
Read Word 1, BITSPERPIXEL :`- Use this to make sure we are loading in a 24bit bmp
Read Long 1, COMPRESSION :`- Compression type, we are only handling non compressed bmps
REM Check that we are working with a 24bit bmp with no compression, if so, begin reading the
REM Data into an array
If BITSPERPIXEL = 24 And COMPRESSION = 0
REM We've already read in the first 36 bytes. Calculate the remaining bytes left to
REM reach the byte data and move to the correct position in the file
For I = 1 to (OFFSET - 34)
Read Byte 1,VOID
Next I
REM Create an array to hold the bitmap data
Dim Bitmap(WIDTH, HEIGHT)
REM Begin reading in the bitmap data
REM First byte represents the lower left hand corner of the image
REM Last byte represents the upper right
For Y = 1 To HEIGHT
For X = 1 To WIDTH
Read Byte 1, Bitmap(X, HEIGHT-Y)
Read Byte 1, Void : Read Byte 1, Void
Next X
Next Y
REM Now we are ready to create our terrain. First we define some variable for our matrix
MATWIDTH# = 2000.0
MATLENGTH# = 2000.0
XSEG = 60
ZSEG = 60
MAXHEIGHT# = 600
REM Create Our Terrain
Make Matrix 1, MATWIDTH#, MATLENGTH#, XSEG, ZSEG
REM Now we are going to use the pixel data to generate our terrain.
REM Note: Pixels coordinates range from 0 to Width-1 and 0 to Height-1 so the bottom
REM right pixel coordinate of a 256x256 bitmap would be at (255,255)
For Z = 0 To ZSeg
For X = 0 To XSeg
PX = ((WIDTH-1.0) / XSEG) * X
PY = ((HEIGHT-1.0) / ZSEG) * Z
Set Matrix Height 1, X, Z, (MAXHEIGHT# / 255) * Bitmap(PX,PY)*-1
Next X
Next Z
REM Update the matrix so we can see the changes
Update Matrix 1
EndIf
EndIf
Close File 1
Position Camera 0,1000,0
Point Camera 500,500,500
mma=get ground height(1,0,0)
mmb=get ground height(1,0,zseg)
mmc=get ground height(1,xseg,0)
mmd=get ground height(1,xseg,zseg)
While SpaceKey() = 0
set cursor 0,0
print "xseg=";xseg;" zseg=";zseg
set cursor 0,20
print "0,0=";mma
set cursor 0,30
print "0,zseg=";mmb
set cursor 0,40
print "xseg,0=";mmc
set cursor 0,50
print "xseg,zseg=";mmd
Sync
EndWhile
for i=xseg to 0 step-1
set matrix height 1,0,i,-600
update matrix 1
sync
next i
wait key
cx#=camera position x(0)
cy#=camera position y(0)
cz#=camera position z(0)
cvo#=5
do
inc mipper
if upkey()=1 then cz#=cz#+cvo#
if downkey()=1 then cz#=cz#-cvo#
if leftkey()=1 then cx#=cx#-cvo#
if rightkey()=1 then cx#=cx#+cvo#
position camera 0,cx#,cy#,cz#
if inkey$()="a" then pitch camera up 0,1
if inkey$()="z" then pitch camera down 0,1
sync
loop
End
uses
http://www.boyar.net/heightmap.bmp
Anyway of meshing the two programs??? How would I pull the x and y data values from the bytes in this program???
I do know enough that I could make a basic height map for a matrix... The thing for me is that I need the data in memblock form so that I can convert it to an object and finally(hopefully) to a mesh so that I can import it into a 3DEditor and give a little landmass alot of personal touch.