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.

Code Snippets / loadMatrix Function

Author
Message
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 17th Jan 2007 19:11
This function will obviously load a matrix. It will load it from a heightmap and automatically work out it\'s size, so you dont have to worry about that.

The parameters are:
width#, length#, scale#, heightmap$, texture$, smoothing
- Width and length arent the tiles, just the sizes
- scale controls how much you want the heightmap to take affect.
- the heightmap has to be a black and white image (must be under 70x70 for DBC)
- the whole texture image is pasted onto the matrix. The bigger the image, the smoother it is.
- set smoothing to 0 for no smoothing, or any other value to make the matrix appear smooth.

I stole the matrix normals code from a DBC demo. Dunno how to work them yet, heheh

Code:


fubarpk
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2007 15:13
There seems to be major errors in the code like the variables bmpWidth BmpWidth and bmpwidth all seem to be the same variable in a case sensitive language this is a NO NO

fubar
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 20th Feb 2007 16:04
Yeah but DBPro isn't case sensitive

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 22nd Feb 2007 02:48 Edited at: 22nd Feb 2007 02:57
Runtime Error-- Array does not exist or array subscript out of bounds at line 71.


I really want to try it! My image is 50x50 and I am using DBPro.

EDIT: Wait... it's working now. It just didn't like that specific image (the one from advanced terrain)


EDIT2:

WOW THAT IS AMAZING, ACTUALLY! I just realized that the texture ISN'T tiled! It's like advanced terrain for DBC! Great job

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 24th Feb 2007 06:57
Zotoaster, you beet me too it.

Anyways, good job, I will try it out later.

Cheers,

-db

PS: This should be in the code snippets.


Enter my forums here.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Feb 2007 13:53
It is Or do you mean the codebase?

60 squares, thanks

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 24th Feb 2007 21:09 Edited at: 24th Feb 2007 21:10
Woops.

I thought I was in the DarkBASIC Professional forum.


It should be in the codebase though.

Cheers,

-db

[edit]
When I try to follow the terrain using "control camera using arrowkeys" and "get ground height" etc, it screws up, and offsets where im going. Do you know how to fix this?
[/edit]


Enter my forums here.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Feb 2007 21:23
Hmmm. Have you positioned the matrix at all?

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 24th Feb 2007 21:35
no I havent.


Cheers,

-db


Enter my forums here.
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 25th Feb 2007 09:02
looks awesome zotoaster, good job

Login to post a reply

Server time is: 2025-05-15 12:50:17
Your offset time is: 2025-05-15 12:50:17