Bug in SubGeometry update functions. Over optimized so they don’t change length when dynamically adding geometry.

Software: Away3D 4.x

Codeguy, Newbie
Posted: 22 February 2012 05:02 PM   Total Posts: 4

I have a project where I am dynamically adding data. Sorry the test case was too complicated to simplify. However, I think the logic will be easily seen in these if statements in SubGeometry.

The problem is that when the number of vertices changes the cached values are not changing. So I modified the if statements in my code to check the length’s to make sure they match as well. Then if they don’t also update. Now things are working.

line 761 is where I have the first bug. This is what it looked like.

_faceNormalsData ||= new Vector.<Number>(lentrue);
   if (
_useFaceWeights_faceWeights ||= new Vector.<Number>(len/3true); 

This is what I changed it to.

_faceNormalsData && _faceNormalsData.length == len || (_faceNormalsData = new Vector.<Number>(lentrue));
   if (
_useFaceWeights_faceWeights && _faceWeights.length == len/|| (_faceNormalsData = new Vector.<Number>(len/3true)); 

line 641 had the same problem. This is what it looked like.

if (_vertexNormals) while (v1 lenV_vertexNormals[v1++0.0

This is what I changed it to.

if (_vertexNormals && _vertexNormals.length == lenV) while (v1 lenV_vertexNormals[v1++0.0

Hope this helps.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X