ccdemos/common_ply.h
branchpyrit
changeset 80 907929fa9b59
parent 72 7c3f38dff082
child 91 9d66d323c354
equal deleted inserted replaced
79:062b1c4143f7 80:907929fa9b59
    55 		{
    55 		{
    56 			printf("ply error: faces of %d vertices not supported", num);
    56 			printf("ply error: faces of %d vertices not supported", num);
    57 			continue;
    57 			continue;
    58 		}
    58 		}
    59 		f >> v1 >> v2 >> v3;
    59 		f >> v1 >> v2 >> v3;
    60 		face = new Triangle(vertices.at(v1), vertices.at(v3), vertices.at(v2), mat);
    60 
       
    61 		// check for invalid faces and ignore them
       
    62 		if (vertices[v1]->P == vertices[v2]->P
       
    63 		 || vertices[v1]->P == vertices[v3]->P
       
    64 		 || vertices[v2]->P == vertices[v3]->P)
       
    65 		{
       
    66 			f.ignore(1000,'\n');
       
    67 			continue;
       
    68 		}
       
    69 
       
    70 		face = new Triangle(vertices[v1], vertices[v3], vertices[v2], mat);
    61 		rt.addShape(face);
    71 		rt.addShape(face);
    62 
    72 
    63 		normals.at(v1) += face->getNormal();
    73 		normals.at(v1) += face->getNormal();
    64 		vertex_face_num.at(v1)++;
    74 		vertex_face_num.at(v1)++;
    65 		normals.at(v2) += face->getNormal();
    75 		normals.at(v2) += face->getNormal();