Very Custom Terrain Help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Linaxys
Posts: 47
Joined: Tue Feb 24, 2009 10:46 pm

Very Custom Terrain Help

Post by Linaxys »

Hello,
I am making a game where you can edit the terrain with a mouse by raising or lowing some vertices that you select with your mouse.

I made a terrain from a mesh by placing the vertices, 50 squares, 25*25 each, and I would like to page it to make it really really infinite.

Could anyone tell me what's the best and fastest method to save the whole meshbuffer into a binary file so the game loads it (or create it with all vertices to 0 if it doesn't exist) when I getting close to the next terrain to load please ?

I've tried to write the meshBuffer directly with fwrite but I just see 4 characters like @ ~, I don't think that's the whole terrain.

Thanks a lot.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You wrote the pointer to the mesh, you need to write the data it contains instead.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Also you can made your code more effective if you do not write to the file all of the data (which is vertex positions, colours, normals, UVs and indices). Your terrain is pattern of tiles right? Than you need to write only position on Y axis and discard X and Z. You can discard indices probably too since they can be generated for the same reason. May be you can generate UVs and normals too but that depend on what you need.
Post Reply