, Sr. Member
i changed this code of the invertFaces function:
for (i = 0; i<numSubGeoms; ++i){
subGeom = SubGeometry(subGeometries[i]);
indices = subGeom.indexData;
normals = new Vector.<Number>();
tangents = new Vector.<Number>();
for (j = 0; j<indices.length; j+=3){
indV0 = indices[j];
indices[j] = indices[ind = j+1];
indices[ind] = indV0;
}
subGeom.updateIndexData(indices);
subGeom.updateVertexNormalData(normals);
subGeom.updateVertexTangentData(tangents);
}
into this:
for (i = 0; i<numSubGeoms; ++i){
subGeom = SubGeometry(subGeometries[i]);
indices = subGeom.indexData;
//normals = new Vector.<Number>();
normals = subGeom.vertexNormalData;
//tangents = new Vector.<Number>();
tangents = subGeom.vertexTangentData;
for (j = 0; j<indices.length; j+=3){
indV0 = indices[j];
indices[j] = indices[ind = j+1];
indices[ind] = indV0;
}
for (j=1;j<normals.length; j+=3){
normals[j]*=-1;
}
subGeom.updateIndexData(indices);
subGeom.updateVertexNormalData(normals);
subGeom.updateVertexTangentData(tangents);
}
and it seems to work.