Page 1 of 1

Very Custom Terrain Help

Posted: Wed Apr 01, 2009 7:26 am
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.

Posted: Wed Apr 01, 2009 9:26 am
by bitplane
You wrote the pointer to the mesh, you need to write the data it contains instead.

Posted: Wed Apr 01, 2009 4:54 pm
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.