[Golist] HydroTween init3D

Moses Gunesch moses at goasap.org
Wed Jul 30 06:44:06 PDT 2008


> init3D is only called once when you set up your 3d scene. Then the  
> render function is called when a tween is taking place.
>
>> The init3D function seems to really slow things down when doing  
>> multiple tweens. It seems like render(...) is being called several  
>> times successively, shouldn't this call be delayed some how?



That's because it is being called multiple times when multiple tweens  
are running.

Here's how you can use Go to automate the process so it happens only  
once per pulse cycle, at just the right moment:

- There's a new interface in Go called ILiveManager, just added it a  
few revs ago. What it does is that each time any pulse cycle  
completes, the manager gets its own update() call.

- when init3D is called, automatically register a manager that you  
write, something like class Hydro3DRefresh implements ILiveManager.

- the manager has reserve() and release() methods when items are added  
and removed – store items if they are 3D tweens. (Check their  
properties or target types or whatever.) Use a dictionary with the  
items as the keys and any arbitrary whatnot as the value:  
myDict[ item ] = 1 which gives you direct lookup access without any  
looping. When release() is called: if (myDict[item]!=null) { delete  
myDict[item]; } – it's that easy.

- Your ILiveManager's update method is called within the pulse cycle,  
and just after all tweens are updated – the perfect moment to refresh  
the 3D scene just once per cycle!


* [ I heart Go's automation layer – its best feature! ] *

moses







More information about the GoList mailing list