Heightmap LOD
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]
_____ /____ /|| | || MtY | ||_____|/Marty
hi,
I can''t make a pointer in a typedef to the type i''m defining
so that''s no solution, i guess..
Marty
I can''t make a pointer in a typedef to the type i''m defining

Marty
_____ /____ /|| | || MtY | ||_____|/Marty
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement