2010/7/5 tarwin <[email protected]>
> Seems I ain't so stupid after all ... I just updated the function and
> got from 1.65 seconds to 0.29 seconds!!! Yay for super big differences
> in speed. Here's the updated code for the haXe version - should be
> fine in the Flash version too.
>
Hey! Pretty cool!!! : )
I'll try to integrate it into the svn. : )
>
> The only problem is that it seems to speed things up for parsing, but
> makes displaying 6 times slower when playing your animation (or
> something like that?!) Can anyone explain it?
>
Shouldn't the TypedDictionary be declared as a class member? I think it
should work like this:
private var _skinVerticesHash:flash.utils.TypedDictionary<SkinVertex,
Bool>; //don't forget to create a new instance in the constructor!
/**
* Adds a <code>SkinController</code> and all associated
<code>SkinVertex</code> objects to the animation.
*/
public function addSkinController(skinController:SkinController):Void
{
if (_skinControllers.indexOf(skinController) != -1)
return;
_skinControllers.push(skinController);
for (_skinVertex in skinController.skinVertices)
{
if (!_skinVerticesHash.exists(_skinVertex))
{
_skinVertices.push(_skinVertex);
_skinVerticesHash.set(_skinVertex, true);
}
}
}
>
> ----------------------------------------------------------
>
> public function
> addSkinController(skinController:SkinController):Void
> {
> if (_skinControllers.indexOf(skinController) != -1)
> return;
>
> _skinControllers.push(skinController);
>
> var d:flash.utils.TypedDictionary<SkinVertex, Bool> = new
> flash.utils.TypedDictionary(true);
>
> for (_skinVertex in skinController.skinVertices) {
> if (!d.exists(_skinVertex)){
> _skinVertices.push(_skinVertex);
> d.set(_skinVertex, true);
> }
> }
> }
>
> ----------------------------------------------------------