git-svn-id: svn://db.shs.com.ru/libs@697 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-12 19:21:34 +00:00
parent a4c329a07b
commit 0c378399c4
5 changed files with 16 additions and 13 deletions

View File

@@ -253,3 +253,11 @@ Scene * loadScene(const QString & filepath) {
return scene;
}
QStringList supportedFormats() {
Assimp::Importer importer;
aiString ret;
importer.GetExtensionList(ret);
return fromAiString(ret).toLower().split(";");
}

View File

@@ -22,5 +22,6 @@
#include "gltypes.h"
Scene * loadScene(const QString & filepath);
QStringList supportedFormats();
#endif // LOADER_ASSIMP_H

View File

@@ -147,7 +147,7 @@ public:
QMatrix4x4 matrix() const;
bool isRawMatrix() {return raw_matrix;}
QVector3D inParentSpace(const QVector3D & v) const;
void transferTransformToChildren(bool only_scale = true);
void transferTransformToChildren(bool only_scale = false);
void cleanTree();
bool isAcceptLight() const {return accept_light;}

View File

@@ -30,6 +30,9 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
setupUi(this);
session.setFile("session_qglview_test.conf");
session.addEntry(this);
extensions = "All(" + supportedFormats().join(" ") + " *.qgl)";
extensions += ";;QGLEngine(*.qgl)";
//view->view()->camera()->setPos(QVector3D(2, 2, 2));
//view->view()->camera()->setAim(QVector3D());
@@ -148,12 +151,7 @@ void QGLViewWindow::on_actionReset_triggered() {
void QGLViewWindow::on_actionImport_triggered() {
QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;"
"QGLView(*.qgl);;"
"Ascii Scene Export(*.ase);;"
"3D Studio(*.3ds);;"
"Wavefront OBJ(*.obj);;"
"Collada(*.dae)");
QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, extensions);
if (fl.isEmpty()) return;
prev_path = fl.back();
foreach (QString f, fl)
@@ -188,12 +186,7 @@ void QGLViewWindow::on_actionSaveSelected_triggered() {
void QGLViewWindow::on_actionOpen_triggered() {
QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;"
"QGLView(*.qgl);;"
"Ascii Scene Export(*.ase);;"
"3D Studio(*.3ds);;"
"Wavefront OBJ(*.obj);;"
"Collada(*.dae)");
QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, extensions);
if (f.isEmpty()) return;
prev_path = f;
loadFile(f);

View File

@@ -53,6 +53,7 @@ private:
void changeEvent(QEvent * e);
void timerEvent(QTimerEvent * );
QString extensions;
QTranslator translator;
QString prev_path;
//GLPrimitiveCube * box;