git-svn-id: svn://db.shs.com.ru/libs@624 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -214,11 +214,12 @@ GLObjectBase * loadFromOBJFile(const QString & filepath, float scale) {
|
|||||||
QVector<Vector3d> vertices, normals, texcoords;
|
QVector<Vector3d> vertices, normals, texcoords;
|
||||||
QVector<Material> materials;
|
QVector<Material> materials;
|
||||||
GLObjectBase * root = new GLObjectBase(), * co = nullptr;
|
GLObjectBase * root = new GLObjectBase(), * co = nullptr;
|
||||||
QString name;
|
QString name, line, pline;
|
||||||
root->setName(QFileInfo(f).baseName());
|
root->setName(QFileInfo(f).baseName());
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
QString line = stream.readLine().trimmed();
|
pline = line;
|
||||||
|
line = stream.readLine().trimmed();
|
||||||
if (line.startsWith("mtllib")) {
|
if (line.startsWith("mtllib")) {
|
||||||
materials = readMTL(filepath, line.mid(6).trimmed());
|
materials = readMTL(filepath, line.mid(6).trimmed());
|
||||||
continue;
|
continue;
|
||||||
@@ -236,6 +237,7 @@ GLObjectBase * loadFromOBJFile(const QString & filepath, float scale) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (line.startsWith("g ") || line.startsWith("o ")) {
|
if (line.startsWith("g ") || line.startsWith("o ")) {
|
||||||
|
if (pline.mid(1) == line.mid(1)) continue;
|
||||||
name = line.mid(1).trimmed();
|
name = line.mid(1).trimmed();
|
||||||
if (co != nullptr) {
|
if (co != nullptr) {
|
||||||
LoaderOBJ::initOBJMesh(co, vertices, normals, texcoords);
|
LoaderOBJ::initOBJMesh(co, vertices, normals, texcoords);
|
||||||
|
|||||||
Reference in New Issue
Block a user