Heightmap2Matrix by GCEclipse10th Sep 2003 12:32
|
---|
Summary Heightmap to matrix conversion Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com function Heightmap2matrix(matrixno,Fname$,XSize,ZSize,HeightFactor#) error=0 rem load the heightmap in BMP format load bitmap Fname$,31 rem make sure its not too big if bitmap width()>64 and bitmap height()>64 error=1 goto error endif Rem Make the matrix make matrix matrixno,XSize,ZSize,bitmap width(),bitmap height() Rem Read the height map and adjust the matrix height for n=0 to bitmap width() for m=0 to bitmap height() R=RGBR(point(n,m)) H=R*HeightFactor# set matrix height matrixno,n,m,H next m:next n update matrix matrixno Error: delete bitmap 31 set current bitmap 0 endfunction error |