git-svn-id: svn://db.shs.com.ru/libs@697 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -253,3 +253,11 @@ Scene * loadScene(const QString & filepath) {
|
|||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList supportedFormats() {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
aiString ret;
|
||||||
|
importer.GetExtensionList(ret);
|
||||||
|
return fromAiString(ret).toLower().split(";");
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,5 +22,6 @@
|
|||||||
#include "gltypes.h"
|
#include "gltypes.h"
|
||||||
|
|
||||||
Scene * loadScene(const QString & filepath);
|
Scene * loadScene(const QString & filepath);
|
||||||
|
QStringList supportedFormats();
|
||||||
|
|
||||||
#endif // LOADER_ASSIMP_H
|
#endif // LOADER_ASSIMP_H
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
QMatrix4x4 matrix() const;
|
QMatrix4x4 matrix() const;
|
||||||
bool isRawMatrix() {return raw_matrix;}
|
bool isRawMatrix() {return raw_matrix;}
|
||||||
QVector3D inParentSpace(const QVector3D & v) const;
|
QVector3D inParentSpace(const QVector3D & v) const;
|
||||||
void transferTransformToChildren(bool only_scale = true);
|
void transferTransformToChildren(bool only_scale = false);
|
||||||
void cleanTree();
|
void cleanTree();
|
||||||
|
|
||||||
bool isAcceptLight() const {return accept_light;}
|
bool isAcceptLight() const {return accept_light;}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
|
|||||||
session.setFile("session_qglview_test.conf");
|
session.setFile("session_qglview_test.conf");
|
||||||
session.addEntry(this);
|
session.addEntry(this);
|
||||||
|
|
||||||
|
extensions = "All(" + supportedFormats().join(" ") + " *.qgl)";
|
||||||
|
extensions += ";;QGLEngine(*.qgl)";
|
||||||
|
|
||||||
//view->view()->camera()->setPos(QVector3D(2, 2, 2));
|
//view->view()->camera()->setPos(QVector3D(2, 2, 2));
|
||||||
//view->view()->camera()->setAim(QVector3D());
|
//view->view()->camera()->setAim(QVector3D());
|
||||||
//view->view()->camera()->flyToDistance(2.);
|
//view->view()->camera()->flyToDistance(2.);
|
||||||
@@ -148,12 +151,7 @@ void QGLViewWindow::on_actionReset_triggered() {
|
|||||||
|
|
||||||
|
|
||||||
void QGLViewWindow::on_actionImport_triggered() {
|
void QGLViewWindow::on_actionImport_triggered() {
|
||||||
QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;"
|
QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, extensions);
|
||||||
"QGLView(*.qgl);;"
|
|
||||||
"Ascii Scene Export(*.ase);;"
|
|
||||||
"3D Studio(*.3ds);;"
|
|
||||||
"Wavefront OBJ(*.obj);;"
|
|
||||||
"Collada(*.dae)");
|
|
||||||
if (fl.isEmpty()) return;
|
if (fl.isEmpty()) return;
|
||||||
prev_path = fl.back();
|
prev_path = fl.back();
|
||||||
foreach (QString f, fl)
|
foreach (QString f, fl)
|
||||||
@@ -188,12 +186,7 @@ void QGLViewWindow::on_actionSaveSelected_triggered() {
|
|||||||
|
|
||||||
|
|
||||||
void QGLViewWindow::on_actionOpen_triggered() {
|
void QGLViewWindow::on_actionOpen_triggered() {
|
||||||
QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;"
|
QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, extensions);
|
||||||
"QGLView(*.qgl);;"
|
|
||||||
"Ascii Scene Export(*.ase);;"
|
|
||||||
"3D Studio(*.3ds);;"
|
|
||||||
"Wavefront OBJ(*.obj);;"
|
|
||||||
"Collada(*.dae)");
|
|
||||||
if (f.isEmpty()) return;
|
if (f.isEmpty()) return;
|
||||||
prev_path = f;
|
prev_path = f;
|
||||||
loadFile(f);
|
loadFile(f);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ private:
|
|||||||
void changeEvent(QEvent * e);
|
void changeEvent(QEvent * e);
|
||||||
void timerEvent(QTimerEvent * );
|
void timerEvent(QTimerEvent * );
|
||||||
|
|
||||||
|
QString extensions;
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QString prev_path;
|
QString prev_path;
|
||||||
//GLPrimitiveCube * box;
|
//GLPrimitiveCube * box;
|
||||||
|
|||||||
Reference in New Issue
Block a user