MeshHelper.invertFaces and Normals

Software: Away3D 4.x

Avatar
80prozent, Sr. Member
Posted: 21 October 2011 07:03 PM   Total Posts: 430

Hi

i try to invert Faces of a Mesh.

It works fine as long as i dont add lights (or any Method) to the meshs material.

i figured out that this happens because the invertFaces function resets all normal and tangent data, but with empty Vectors.

Does this happens for any reason ?
or is this function still wip and will be updatet ?

thanks

80

 Signature 

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

   

Avatar
80prozent, Sr. Member
Posted: 21 October 2011 07:16 PM   Total Posts: 430   [ # 1 ]

i changed this code of the invertFaces function:

for (0i<numSubGeoms; ++i){
    subGeom 
SubGeometry(subGeometries[i]);
    
indices subGeom.indexData;
    
normals = new Vector.<Number>();
    
tangents = new Vector.<Number>();
    for (
0j<indices.lengthj+=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 (0i<numSubGeoms; ++i){
    subGeom 
SubGeometry(subGeometries[i]);
    
indices subGeom.indexData;
    
//normals = new Vector.<Number>();
    
normals subGeom.vertexNormalData;
    
//tangents = new Vector.<Number>();
    
tangents subGeom.vertexTangentData;
    for (
0j<indices.lengthj+=3){
     indV0 
indices[j];
     
indices[j] indices[ind j+1];
     
indices[ind] indV0;
    
}
    
    
for (j=1;j<normals.lengthj+=3){
     normals[j]
*=-1;
    
}
    
    subGeom
.updateIndexData(indices);
    
subGeom.updateVertexNormalData(normals);
    
subGeom.updateVertexTangentData(tangents);
   


and it seems to work.

 Signature 

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

   

Avatar
80prozent, Sr. Member
Posted: 25 October 2011 11:38 AM   Total Posts: 430   [ # 2 ]

this issue has been solved by Fabrice3D on the latest Git.

Thank you.

 Signature 

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

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X