int XFileLoader::CreateMesh(vector<vec3>& positions, vector<vec2>& texCoords, vector<unsigned short>& pindices, vector<vec3>& normals, vector<unsigned short>& nindices, unsigned int materialIdx) { if (pindices.size() != nindices.size()) THROW_EXCEPTION_T("Parsing error", ParsingException); //Repack indices vector<vec3> _normals(nindices.size()); for (unsigned int i=0; i < nindices.size(); ++i) _normals[i] = normals[nindices[i]]; int meshIdx = m_meshes.size(); m_meshes.push_back(Mesh(move(positions), move(texCoords), move(pindices), move(_normals), materialIdx)); return meshIdx; }
GLuint Normals(std::vector<GLfloat>& dest) const { dest = _normals(); return 3; }
GLuint Normals(std::vector<T>& dest) const { auto v = _normals(); dest.assign(v.begin(), v.end()); return 3; }