View Single Post
Old 11-25-2008, 04:20 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
So one fundamental difference is that during playback you use a node3d object to link to the cave (cave.setTracker and vizcave.CaveView), and then change that node's position, whereas I use cave.update and viz.MainView.setPosition directly. Aside from personal preference is there any performance reason to do this one way or the other?
There is not major performance reason. The biggest reason is to reduce the amount of code. Your method uses two different code paths to update the cave, depending on whether you are recording or playing data.

A more minor difference is that during playback you yield on None after each position update, whereas I yield on viztask.waitDraw(). What is the difference between these approaches, and which would ensure that each frame of the playback was identical to the recorded frames?
I would not use viztask.waitDraw unless you are interested in the time that the frame is drawn to screen. If you don't care about the time, then I highly recommend using viztask.waitFrame(), or just yield None.

Finally, and this perhaps is not a difference at all, you use vizact.onupdate, while I use viz.callback(viz.UPDATE_EVENT). Is there a reason to prefer one command over the other, or are they completely identical?
I generally recommend using the vizact module instead of using viz.callback. Using viz.callback might break your code in certain cases, because only one function can be registered at a time with viz.callback. So if you end up using it in multiple parts of your script you might end up inadvertently unregistering an update callback.
Reply With Quote