Archived

This topic is now archived and is closed to further replies.

Marty666

Heightmap LOD

Recommended Posts

Hi all I'm busy loading heightmaps. For my heigtmaps I don't want to use any poly's that are not needed (mutch). To acomplish this i do the following. * I divide my map into 4 pieces. * I calculate an error for each piece (how mutch does it look like the heightmap if i just render this piece as one quad?) * If the error is too big I divide the piece into four pieces again. * I render all the pieces as triangle fan's, so I don't get cracks: Left one has a crack, right one doesn't: |\../|\/|\/|.............|\../|\/|\/| |.\/.|/\|/\|.............|.\/_|/\|/\| |./\.|\/|\/|.............|./\.|\/|\/| |/..\|/\|/\|.............|/..\|/\|/\| (ignore the dots, I dont know how to use the fancy scroll boxes in my message, so I can't use spaces.) otherwise there would be holes in the landscape... My problem is simple. how do i make a good structure (tree) to put these in? I have the type piece: typedef struct piece { float error; GLubyte fan; // one bit for every line of the fan, clockwise. // In the example above (left) it would be 01010101 // and the better version (right) 01110101 (to avoid the crack) }piece; If the error is too big the layer should contain four more layers. How do I define a type that can contain four more of itself whitout overloading the memory? pointers maybe? typedef struct piece { float error; GLubyte fan; piece* piece1; piece* piece2; piece* piece3; piece* piece4; }piece; Thanx! Marty [edited by - Marty666 on March 2, 2003 12:26:53 PM] [edited by - Marty666 on March 2, 2003 12:28:11 PM] [edited by - Marty666 on March 2, 2003 12:29:39 PM]

Share this post


Link to post
Share on other sites
This should work:


struct piece
{
float error;
GLubyte fan;
struct piece * piece1;
struct piece * piece2;
struct piece * piece3;
struct piece * piece4;
};


typedef struct peice Piece;

Share this post


Link to post
Share on other sites