pt[indx[0]].....pt[indx[3]]. то есть indx[]

содержит четыре индекса в списке вершин для использования в вычислениях по Ньюэллу

*/
Vector3 m:
for(int i - 0: i < 4 : i++)
{
int next - (i- 3) ? 0 : i + 1:
// which index is next?

// какой индекс следующий?

int f - indx[i], n » indx[next]:
// names for the indices in the pair

// имена для индексов в паре

m.x +- (pt[f].y - pt[n].y) * (pt[f].z + pt[n].z): m.y +- (pt[f].z - pt[n].z) * (pt[f].x + pt[n].x): m.z +- (pt[f].x - pt[n].x) * (pt[f].y + pt[n].y);
}
m.normalize(): return m;
}
//«««««««««««««« readMesh »»»»»»»»»»»»
void Mesh:: readMesh(string fname)
{
fstream inStream:

inStream.open(fname.c_str(). ios ::in); // open needs a c-like string // для открытия требуется тип строки как в С

if(inStream.faiK) || inStream.eofO)
{
cout « "can't open file or eof: " « fname « endl: makeEmptyO: return:
}

inStream » numVerts » numNorms » numFaces; // make arrays for vertices, normals, and faces // создает массивы для вершин, нормалей и граней

pt - new Point3[numVerts]: assert(pt !- NULL):
norm - new Vector3[numNorms]: assert(norm !» NULL):
face - new Face[numFaces]; assert(face !- NULL):

for(int i - 0; i < numVerts: i++) // read in the vertices // читаем в вершинах

inStream » pt[1].x » pt[i].y » pt[1].z":
for(int ii - 0: ii < numNorms: ii++)

ВЗ. Класс SCENE и сопутствующие классы

// read in the normals // читаем в нормалях

inStream » norm[ii].x » norm[ii].y » norm[il].z: for(int f - 0; f < numFaces; f++) // read in face data // читаем данные no грани {

inStream » face[f].nVerts: int n - face[f].nVerts:
face[f].vert - new VertexID[n]: assert(face[f].vert !-
NULL):

fordnt k = 0: k < n; k++) // read vertex indices for this face // читаем индексы вершин для данной грани

inStream » face[f].vert[k].vertlndex: fordnt kk - 0: kk < n: kk++) // read normal indices for this face // читаем индексы нормали для данной грани


⇐ Предыдущая| |Следующая ⇒