Gold 4.1 - How do we update vertices?

Software: Away3D 4.x

Avatar
theMightyAtom, Sr. Member
Posted: 18 July 2013 08:04 AM   Total Posts: 669

Just downloaded Gold 4.1 release.
The updateVertexData() function has been removed, and I can’t find another way to manipulate vertices manually. Any ideas?

UPDATE: It’s still there, but you have to cast the member of the subGeometry array as a SubGeometry. Guess it was a vector before?

m.geometry.subGeometries[0].updateVertexData(tv); 

becomes

(m.geometry.subGeometries[0] as SubGeometry).updateVertexData(tv); 

It’s causing an error in length compared to previous release. I’ll look into the new structure and find a fix. I use the updateVertexData in alot of my work…

   

Avatar
theMightyAtom, Sr. Member
Posted: 18 July 2013 08:51 AM   Total Posts: 669   [ # 1 ]

I didn’t find a fix, and ended up rolling back.
If anyone has a working example of a vertex manipulation in Gold 4.1.4 I’d be glad to see the code smile Perhaps there’s a much smarter way of doing this?

   

sentoplene, Newbie
Posted: 18 July 2013 09:04 AM   Total Posts: 25   [ # 2 ]

Here’s the magic….

_subGeom _mesh.geometry.subGeometries[0].cloneWithSeperateBuffers();
   
   
_vertexData  _subGeom.vertexData;
   
_uvData   _subGeom.UVData;
   
_normals   _subGeom.vertexNormalData;
   
_tangents   _subGeom.vertexTangentData;
   
_indexData  _subGeom.indexData;
   
   
// do manipulations here
   
   
var vtc:Vector.<Number> = GeomUtil.interleaveBuffers(_numVertices_vertexData_normals_tangents_uvData);
   
CompactSubGeometry(_mesh.geometry.subGeometries[0]).updateData(vtc); 

Or you can use:

_mesh.geometry.convertToSeparateBuffers(); 

which will convert the CompactSubGeometries inside the geometry to SubGeometries, which will contain the ‘Oldskool’ vertexData, normalData etc.

Hope this helps!

   

Avatar
theMightyAtom, Sr. Member
Posted: 18 July 2013 11:43 AM   Total Posts: 669   [ # 3 ]

Thanks a lot Sentoplene. I must have been sleeping in class, when did this all happen? Don’t suppose there’s any docs or an article explaining the structure?

Cheers!

   

Avatar
80prozent, Sr. Member
Posted: 18 July 2013 11:44 AM   Total Posts: 430   [ # 4 ]

Hi
I think the updating the verts of the new compactsubgeometries makes only sense if you do not need to update them very often. If you need to update the verts often (like on every frame), i think its faster to convert to the old subgeometries, and update the old way…..

 Signature 

sorry…i hope my actionscript is better than my english…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X