Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / makin matrix using a heightmap

Author
Message
doffer
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location:
Posted: 17th Jan 2004 18:24
Hi.

I've downloaded the landscape editor, wich you will find under work in progress, it's very good.

Unfortunatly it doesn't save a matrix, but instead you are getting a heightmap, and a texture that matches.

How do i make my matrix in dbc, using the heightmap.

Denmark Denmark Denmark.
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 17th Jan 2004 19:06
It's not very hard. I've made a heightmap reader once for myself...
here's how 2 do it.

step 1
Load the bitmap into your program (juzt load bitmap "Heightmap.bmp")

step 2
you need to calculate the pixels in heightmap per tile. This means if you have a 63*63 tile matrix (this gives you 64*64 adjustable points) and you have a heightmap of 256*256. Then you must read every 256/64=4 pixels to get the correct height. You can skip this part if you make just a 64*64 heightmap (i did )

step 3
use this piece of code to scan the map and apply it to the matrix


step 4
Build this in your application and yer done

IMPORTANT!!!!!!!!!!
it takes a while to scan the bitmap because the point command is pretty slow, and this code scans 64*64=4096 times... if you want something quicker i recommend saving and reading in a file format created by yourself or use a matrix modeling program like MagicWorld or MatEdit

Juzt a dude who likez progging

Login to post a reply

Server time is: 2025-05-22 14:58:07
Your offset time is: 2025-05-22 14:58:07