Тёмная тема
Как рассчитать tangent space с помощью NVMESHMENDER? (комментарии)
Это сообщение сгенерировано автоматически.
У кого-нибудь есть nvmeshmender из nvidia sdk? Скинте, пожалуйста.
немного не понял... что делать с mappingNewToOld если кол-во вершин меняется
как адресоваться ?
посмотрите - так всё?
void _arrays::MeshTangentSpaceCPU(bool invertIndexes,float min_smooth_angle) { // return; std::vector< MeshMender::Vertex > theVerts; std::vector< unsigned int > theIndices; std::vector< unsigned int > mappingNewToOld; MeshMender mender ; int i; for( i=0;i<numverts;i++) { MeshMender::Vertex v; v.pos[0] = verts[i][0]; v.pos[1] = verts[i][1]; v.pos[2] = verts[i][2]; v.s = tex_st[i][0]; v.t = tex_st[i][1]; //meshmender will computer normals, tangents, and binormals, no need to fill those in. //however, if you do not have meshmender compute the normals, you _must_ pass in valid //normals to meshmender theVerts.push_back(v); } if(invertIndexes) { for(int ind=numIndexes-1;ind>=0;--ind) theIndices.push_back(Indexes[ind]); } else { for(int ind = 0 ; ind < numIndexes; ++ind) theIndices.push_back(Indexes[ind]); } // pass it in to the mender to do it's stuff mender.Mend( theVerts, theIndices, mappingNewToOld,min_smooth_angle,min_smooth_angle,min_smooth_angle); // смотрим какой новой вершине соотвествует старая for(i=0;i<(int)mappingNewToOld.size();i++) { int oldID=mappingNewToOld[i]; int newID = i; VectorCopyAB(verts[oldID],theVerts[newID].pos); tex_st[oldID][0]=theVerts[newID].s; tex_st[oldID][1]=theVerts[newID].t; VectorCopyAB(basisx[oldID],theVerts[newID].tangent); VectorCopyAB(basisy[oldID],theVerts[newID].binormal); VectorCopyAB(basisz[oldID],theVerts[newID].normal); } theVerts.clear(); theIndices.clear(); mappingNewToOld.clear(); }
проблема в том чтобы у сущесвтующих вершин заполнить их nbt а не вставлять новые!
Тема в архиве.