PDA

View Full Version : Not directly ogl related: Visibility using trees.



Marcus
05-06-2001, 09:16 AM
In a bsp, octree or quadtree all trees have an amount of children. But you can't change the amount. Therefor if I want a tree that looks something like this:

root
|
+---------+-------+
| |
+--+-+--+-+ +---+---+
| | | | | | |

I've tried to do this using an integer value
in each node to process each child but it becomes incredibly slow. Isn't it possible to in each node have a pointer to a function to process the current kind of node?
Or how to do?

Humus
05-06-2001, 10:35 AM
Not sure on your question but I'd use the CODE tags when I want to illustrate something like this:





root
|
+---------+-------+
| |
+--+-+--+-+ +---+---+
| | | | | | |

MarcusL
05-06-2001, 02:50 PM
This is not opengl related, but what the heck. http://www.opengl.org/discussion_boards/ubb/smile.gif

Why not have just have a dynamic array/linked list at each node storing its children. (or pointers to it)

(In c++, that would be a std::vector<> or std::list<> )

Marcus
05-06-2001, 11:03 PM
That's what I tried.

I'm not sure if this is a correct solution because I have not had time to test it but whould it work if I did like this:

class t_Node
{
t_List<t_Node> children;
void __cdecl * correctMethodForThisone;
};

class t_Tree
{
t_Node root;
};

But how should I code that?