Author Topic:   Reducing Memory
posted December 28, 2000 07:45 PM         
From a previous thread:

[2] The second solution is to set aabbMin.y to the minimum elevation
in the entire terrain, and to set aabbMax.y to the maximum elevation
in the entire terrain. This solution is far from perfect, but it can
be okay (depends on your needs).

[3] A quadtree with N levels has ((4^n)-1)/3 nodes. You can now
allocate an array with ((4^n)-1)/3 elements, where each elements
contains the aabbMin.y and aabbMax.y of the corresponding AABB.

My quadtree data is currently contains:

struct QUAD_AABB {

FLOAT min_y;
FLOAT max_y;

If I use approach [2], then my min_y will always be zero, so I can
eliminate this variable. max_y will also be constant, so I can get
rid of it. This leaves me with a quadtree that takes up no space at all!

If I use a combination of [2] and [3], I can assume min_y will always
be zero and get rid of it. I would use max_y to store the highest elevation
within the node. This would only be 4 bytes.

Or perhaps, instead of storing floats, I could store 1 DWORD. The
high word could store the max_y height, and the low word could store
the min_y height, in raw heightmap units. I could then extract each
and scale it properly into a float.

Any suggestions?

[This message has been edited by Lithium (edited December 28, 2000).]