From: <MSo...@ya...> - 2006-01-25 20:37:59
|
Hi Braden, > > I think a view is either coupled to the VRML view concept or free. > > > Hm... I'm not entirely sold on that; but perhaps you're right. I am not a VRML expert. I cannot judge this. It is just what I am doing, but my application is probably far away of the standard application. > This does require a substantial rethinking of the interaction > between=20 > the node implementation and the viewer. Instead of the node > knowing if=20 > it's been rendered before, the viewer would keep track of that. I don't think so. Just when the node creates a reference in the view, it gives the view its own ID and it is the job of the view to store its correpsonding data. When the node tells the view to render the reference it again gives its own ID and the view can retrieve the corresponding data. So instead of the view giving an ID to the node, the node gives an ID to the view. Actually this way, it is completely to the view how it stores the data it needs and different views can use different methods. > A std::map is not a hash map. It is a red-black tree. Lookup > based on=20 > pointers/integers is very efficient. I think a red-black tree is even less efficient than a hash map if there are more than just a few indices in it (a hash map has like an array O(1) average time, while a read-black tree has O(1.5*log(n)) time average performance with a lot of unpredictable jumping). I would spend the memory for the indices in the nodes. This saves then the memory in the per view data structures. Assume you have 1000 nodes and 3 views. When you map this from node pointers using a red-black tree, you need 3 pointers (two next pointers, one key pointer) and a bool for the red/black and say 4 bytes for the stored GL-list index, which are 20 bytes (rounded up to alignment) per node and view. In the sample above this are 1000*3*20=60.000 bytes. When you store an index in the nodes, this are 4 bytes per node. In the view arrays you also need only 4 bytes for the GL-index. This are 1000*(3+1)*4 = 16.000 bytes. A self growing array will waste a factor of sqrt(2) memory on average, so this would be really 1000*(3*1.41+1)*4~21.000 bytes. So a self growing array needs less memory and is faster. Best regards, Michael -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.14.23/240 - Release Date: 25.01.2006 ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |