Monday, March 28, 2011

Getting flash.geom.Matrix3D rawData without requiring a Vector.<Number> allocation

Getting the "rawData" property from an instance of flash.geom.Matrix3D (a new class in Flash 10 for high-level 3D matrix math) causes a Vector. (also specific to Flash 10) object allocation to occur. Is there any way to access the raw data without incurring this object allocation overhead?

Since I must access this data multiple times per frame, it has quite an impact on the performance profile.

Thanks!

From stackoverflow
  • I'm pretty sure there isn't. Apart from making sure that you're assigning into an existing reference, instead of creating a new vector every time, the only obvious option I see is to avoid accesses. So, make sure not to reaccess the data until it has changed, and for example if you merely do a translation, then instead of reaccessing the vector you could just perform the translation on the vector data from the last access.

0 comments:

Post a Comment