Ho cominciato a scrivere del codice
La logica c'è, ma sembra che tutti quest if (che non sono ancora finiti) possano essere raggruppati in un unico ciclo for...che ne dite?codice:void CMesh::GenerateAdjacency() { UINT *pAdjacency = new UINT[2 * this->MeshData.ColladaBuffer.Indici]; for (unsigned int i = 0; i < this->MeshData.ColladaBuffer.Indici; i++) { for (unsigned int z = 0; i < this->MeshData.ColladaBuffer.Indici; z++) { if ((this->MeshData.Indices[i] == this->MeshData.Indices[z]) && (this->MeshData.Indices[i+1] == this->MeshData.Indices[z+1]) && (this->MeshData.Indices[i+2] == this->MeshData.Indices[z+2])) { //Sto leggendo lo stesso indice, vai avanti. continue; } else { if (this->MeshData.Indices[i] == this->MeshData.Indices[z]) { if (this->MeshData.Indices[i+1] == this->MeshData.Indices[z+1]) { //Edge continue; } if (this->MeshData.Indices[i+1] == this->MeshData.Indices[z+2]) { //Edge continue; } if (this->MeshData.Indices[i+2] == this->MeshData.Indices[z+1]) { //Edge continue; } if (this->MeshData.Indices[i+2] == this->MeshData.Indices[z+2]) { //Edge continue; } } if (this->MeshData.Indices[i+1] == this->MeshData.Indices[z]) { if (this->MeshData.Indices[i+2] == this->MeshData.Indices[z+1]) { //Edge continue; } if (this->MeshData.Indices[i+2] == this->MeshData.Indices[z+2]) { //Edge continue; } if (this->MeshData.Indices[i-1] == this->MeshData.Indices[z+1]) { //Edge continue; } if (this->MeshData.Indices[i-2] == this->MeshData.Indices[z+2]) { //Edge continue; } } } } } delete[] pAdjacency; }

Rispondi quotando