[closed] Dispose vertex animation

Software: Away3D 4.x

yomyom, Newbie
Posted: 28 November 2017 11:24 AM   Total Posts: 11

Hello !

I would like to dispose a vertex animation. When i take a look to the function dispose() of the vertexclipnode or vertexanimationset, I find an empty function.

only the frames have something in it, and there is something I dont understand :

public function dispose():void
  {
   
var numSubGeoms:uint _subGeometries.length;
   
   for (var 
i:uint 0numSubGeoms; ++i{
    
var subGeom:ISubGeometry _subGeometries[0];
    
removeSubGeometry(subGeom);
    
subGeom.dispose();
   
}
  } 

It disposes only the first subgeom. Is it an error? How to dispose properly the animationset and all the animations inside? frame by frame and then just by setting the animationset and the nodes as “null”?

thank you.

 

   

Hector, Sr. Member
Posted: 28 November 2017 12:48 PM   Total Posts: 137   [ # 1 ]

Hi, looks ok to me.
It always remove the first element, but it does that x numSubGeoms times, so the array is decreasing it’s size on each iteration (probably with the ‘removeSubGeometry()’ function).

Have you tried to debug it with a breakpoint and see if it’s working properly?

Maybe that method is faster than a reverse loop? like:

for (var i:int _subGeometries.length-1>= 0i--) {
 
var subGeom:ISubGeometry _subGeometries[i];
 
removeSubGeometry(subGeom);
 
subGeom.dispose();

Or maybe there is a reason other than perfomance to do it that way like subGeometries dependencies.

   

Avatar
Fabrice Closier, Administrator
Posted: 28 November 2017 01:00 PM   Total Posts: 1265   [ # 2 ]

the vertexAnimator uses frames. VertexClipNode.
Each one receives own geometry representing the position of the vertices at a given frame. The geom in the mesh is a “place holder”, the shader updates these with the interpolation result of the frames vertices buffers.
So to clear you need to loop over these frames stored in VertexClipNode which are also avail in the animationState.

   

yomyom, Newbie
Posted: 28 November 2017 02:04 PM   Total Posts: 11   [ # 3 ]

Thank you for these fast answers !
I’m going to loop ! grin

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X