Example for addTerrainMesh and change height/colors

A forum to store posts deemed exceptionally wise and useful
Post Reply
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Example for addTerrainMesh and change height/colors

Post by knightoflight »

Hi community,
i made another example: How to use the addTerrainMesh-command
and how to change Height and colors.
For the example in this case we dont display a "normal" terrain, instead we display a Mandelbrot set.
http://zenprogramming.tripod.com -> in the Download-section below

if you like please send me a mail :-)
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

hmm, sounds interessting, i'll download it
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Looks very good (movement.exe) but terrible source! Most cpp ides make it possible to spread your code over more then one source file ;)
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
Romul

Post by Romul »

Thanks for the interesting examples. I modified one function though so you can set the alpha of the terrain. (you have to set EMT_TRANSPARENT_VERTEX_ALPHA for the material but I assume you already knew that)

Code: Select all

void setColor(IAnimatedMesh* terrain, int x, int z, s32 Alpha, s32 Red, s32 Green, s32 Blue)
{
	buffer = terrain->getMesh(0)->getMeshBuffer(0);
	v = (S3DVertex*)buffer->getVertices();

	v[x+z*mapHeight].Color.set(Alpha,Red,Green,Blue);
}
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

@Romul: Thank you very much! Yes in the other test below the addTerrainMesh-Example i used the Alphavalue and know it, but your third function belongs good to the other two.

@Peter: You mean the "texturelayer-test with alphablending", not the "addTerrainMesh-Example with Mandelbrot". Yes, the code is a little spagetti, thats cause i called it only a "test" not an "example" ;-)
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

oh, i looked into madelbrot, thats cool, too, but _much_ better source :D
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
Romul

Post by Romul »

No problem. I hope it benefits the community because I know ive learned alot from your examples already.
Im also more interested in terrain than BSP maps etc because I think random generation is the way to go in games, well atleast my game/s.

Anyway, I hope to post something usefull too eventually. Keep up the good work! :D
Post Reply