i put the code which compute the normals' weight which is followed by the initialisation and the computation of the per vertex normals(in the previous post)
file.read((char*) &(myObjects[counterObj].nbPoly), sizeof (unsigned short int)); for (polyCounter = 0 ; polyCounter< myObjects[counterObj].nbPoly ; polyCounter++) { file.read((char*) &(myObjects[counterObj].myIndices[polyCounter][0]), sizeof (unsigned short int)); file.read((char*) &(myObjects[counterObj].myIndices[polyCounter][1]), sizeof (unsigned short int)); file.read((char*) &(myObjects[counterObj].myIndices[polyCounter][2]), sizeof (unsigned short int)); file.read((char*) &(faceInfo), sizeof (short int)); // cout<<"face info "<<faceInfo<<endl ; int Va = myObjects[counterObj].myIndices[polyCounter][0] ; int Vb = myObjects[counterObj].myIndices[polyCounter][1] ; int Vc = myObjects[counterObj].myIndices[polyCounter][2] ; float Vab[] = {(myObjects[counterObj].myVertices[Vb][0] - myObjects[counterObj].myVertices[Va][0]), (myObjects[counterObj].myVertices[Vb][1] - myObjects[counterObj].myVertices[Va][1]), (myObjects[counterObj].myVertices[Vb][2] - myObjects[counterObj].myVertices[Va][2])}; float Vac[] = {(myObjects[counterObj].myVertices[Vc][0] - myObjects[counterObj].myVertices[Va][0]), (myObjects[counterObj].myVertices[Vc][1] - myObjects[counterObj].myVertices[Va][1]), (myObjects[counterObj].myVertices[Vc][2] - myObjects[counterObj].myVertices[Va][2])}; float Vba[] = {(myObjects[counterObj].myVertices[Va][0] - myObjects[counterObj].myVertices[Vb][0]), (myObjects[counterObj].myVertices[Va][1] - myObjects[counterObj].myVertices[Vb][1]), (myObjects[counterObj].myVertices[Va][2] - myObjects[counterObj].myVertices[Vb][2])}; float Vbc[] = {(myObjects[counterObj].myVertices[Vc][0] - myObjects[counterObj].myVertices[Vb][0]), (myObjects[counterObj].myVertices[Vc][1] - myObjects[counterObj].myVertices[Vb][1]), (myObjects[counterObj].myVertices[Vc][2] - myObjects[counterObj].myVertices[Vb][2])}; float Vca[] = {(myObjects[counterObj].myVertices[Va][0] - myObjects[counterObj].myVertices[Vc][0]), (myObjects[counterObj].myVertices[Va][1] - myObjects[counterObj].myVertices[Vc][1]), (myObjects[counterObj].myVertices[Va][2] - myObjects[counterObj].myVertices[Vc][2])}; float Vcb[] = {(myObjects[counterObj].myVertices[Vb][0] - myObjects[counterObj].myVertices[Vc][0]), (myObjects[counterObj].myVertices[Vb][1] - myObjects[counterObj].myVertices[Vc][1]), (myObjects[counterObj].myVertices[Vb][2] - myObjects[counterObj].myVertices[Vc][2])}; normalize(Vab) ; normalize(Vac) ; dotProduct(Vab, Vac, &resultDp) ; //oFile2<<dec<<"resultDp "<<resultDp<<endl ; angle[polyCounter][0]=acosf(resultDp) ; //oFile2<<"angle "<<dec<<angle[polyCounter][0]<<endl ; normalize(Vba) ; normalize(Vbc) ; dotProduct(Vba, Vbc, &resultDp) ; //cout<<"resultDp "<<resultDp<<endl ; angle[polyCounter][1]=acosf(resultDp) ; normalize(Vca) ; normalize(Vcb) ; dotProduct(Vca, Vcb, &resultDp) ; angle[polyCounter][2]=acosf(resultDp) ; switch (faceInfo) { case 0x3 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vac, Vbc) ; break ; case 0x7 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vab, Vbc) ; break ; case 0x6 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vab, Vbc) ; break ; case 0x5 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vac, Vab) ; break ; case 0x4 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vab, Vcb) ; break ; case 0x2 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vca, Vbc) ; break ; case 0x1 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vac, Vcb) ; break ; case 0x0 :crossProduct(&myObjects[counterObj].perFaceNormals[polyCounter], Vba, Vcb) ; break ; } normalize(&myObjects[counterObj].perFaceNormals[polyCounter]) ; //oFile2<<dec<<"angle "<<angle[polyCounter*3]<<" "<<angle[polyCounter*3+1]<<" "<<angle[polyCounter*3+2]<<endl ; }//end of the for loop