Skip to content

Commit

Permalink
updated convertToSeparateBuffers to ensure the subgeometry array is
Browse files Browse the repository at this point in the history
correctly stepped through. Fixes #491
  • Loading branch information
rob-bateman committed Apr 24, 2013
1 parent 972211f commit 58e0b2c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/away3d/core/base/Geometry.as
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,21 @@ package away3d.core.base
public function convertToSeparateBuffers() : void
{
var subGeom : ISubGeometry;
var numSubGeoms : int = _subGeometries.length;
var numSubGeoms : int = _subGeometries.length;
var _removableCompactSubGeometries:Vector.<CompactSubGeometry> = new Vector.<CompactSubGeometry>();

for (var i : int = 0; i < numSubGeoms; ++i) {
subGeom = _subGeometries[i];
if (subGeom is SubGeometry) continue;
removeSubGeometry(subGeom);
if (subGeom is SubGeometry)
continue;

_removableCompactSubGeometries.push(subGeom);
addSubGeometry(subGeom.cloneWithSeperateBuffers());
subGeom.dispose();
}

for each(var s:CompactSubGeometry in _removableCompactSubGeometries) {
removeSubGeometry(s);
s.dispose();
}
}

Expand Down

0 comments on commit 58e0b2c

Please sign in to comment.