mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-150 GCS/ModelView: Create a fallback default setting on the ModelView plugin
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1987 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
253d831fc9
commit
28c3dcf771
BIN
ground/src/plugins/modelview/models/black.jpg
Normal file
BIN
ground/src/plugins/modelview/models/black.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
48
ground/src/plugins/modelview/models/warning_sign.mtl
Normal file
48
ground/src/plugins/modelview/models/warning_sign.mtl
Normal file
@ -0,0 +1,48 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 14.10.2010 00:38:26
|
||||
|
||||
newmtl red
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 0.0000 0.0000
|
||||
Kd 1.0000 0.0000 0.0000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl white
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl black
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.0000 0.0000 0.0000
|
||||
Kd 0.0000 0.0000 0.0000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl wire_000000000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0000 0.0000 0.0000
|
||||
Kd 0.0000 0.0000 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
21424
ground/src/plugins/modelview/models/warning_sign.obj
Normal file
21424
ground/src/plugins/modelview/models/warning_sign.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,24 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = ModelViewGadget
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../libs/glc_lib/glc_lib.pri)
|
||||
include(modelview_dependencies.pri)
|
||||
INCLUDEPATH += ../../libs/glc_lib
|
||||
HEADERS += modelviewplugin.h \
|
||||
modelviewgadgetconfiguration.h \
|
||||
modelviewgadget.h \
|
||||
modelviewgadgetwidget.h \
|
||||
modelviewgadgetfactory.h \
|
||||
modelviewgadgetoptionspage.h
|
||||
SOURCES += modelviewplugin.cpp \
|
||||
modelviewgadgetconfiguration.cpp \
|
||||
modelviewgadget.cpp \
|
||||
modelviewgadgetfactory.cpp \
|
||||
modelviewgadgetwidget.cpp \
|
||||
modelviewgadgetoptionspage.cpp
|
||||
OTHER_FILES += ModelViewGadget.pluginspec
|
||||
FORMS += modelviewoptionspage.ui
|
||||
TEMPLATE = lib
|
||||
TARGET = ModelViewGadget
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../libs/glc_lib/glc_lib.pri)
|
||||
include(modelview_dependencies.pri)
|
||||
INCLUDEPATH += ../../libs/glc_lib
|
||||
HEADERS += modelviewplugin.h \
|
||||
modelviewgadgetconfiguration.h \
|
||||
modelviewgadget.h \
|
||||
modelviewgadgetwidget.h \
|
||||
modelviewgadgetfactory.h \
|
||||
modelviewgadgetoptionspage.h
|
||||
SOURCES += modelviewplugin.cpp \
|
||||
modelviewgadgetconfiguration.cpp \
|
||||
modelviewgadget.cpp \
|
||||
modelviewgadgetfactory.cpp \
|
||||
modelviewgadgetwidget.cpp \
|
||||
modelviewgadgetoptionspage.cpp
|
||||
OTHER_FILES += ModelViewGadget.pluginspec
|
||||
FORMS += modelviewoptionspage.ui
|
||||
|
||||
RESOURCES += \
|
||||
modelview.qrc
|
||||
|
7
ground/src/plugins/modelview/modelview.qrc
Normal file
7
ground/src/plugins/modelview/modelview.qrc
Normal file
@ -0,0 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/modelview">
|
||||
<file>models/black.jpg</file>
|
||||
<file>models/warning_sign.mtl</file>
|
||||
<file>models/warning_sign.obj</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -48,11 +48,12 @@ ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent)
|
||||
|
||||
CreateScene();
|
||||
|
||||
m_Light.setPosition(4000.0, 40000.0, 80000.0);
|
||||
m_Light.setPosition(4000.0, -40000.0, 80000.0);
|
||||
m_Light.setAmbientColor(Qt::lightGray);
|
||||
|
||||
m_GlView.cameraHandle()->setDefaultUpVector(glc::Z_AXIS);
|
||||
m_GlView.cameraHandle()->setFrontView();
|
||||
m_GlView.setToOrtho(true); // orthogonal view
|
||||
|
||||
QColor repColor;
|
||||
repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0);
|
||||
@ -141,23 +142,27 @@ void ModelViewGadgetWidget::resizeGL(int width, int height)
|
||||
// Create GLC_Object to display
|
||||
void ModelViewGadgetWidget::CreateScene()
|
||||
{
|
||||
// put a black background if the 3D model is invalid or if the background image is also invalid
|
||||
if (acFilename == ":/modelview/models/warning_sign.obj" or !QFile::exists(bgFilename))
|
||||
bgFilename= ":/modelview/models/black.jpg";
|
||||
|
||||
try
|
||||
{
|
||||
m_GlView.loadBackGroundImage(bgFilename);
|
||||
}
|
||||
catch(GLC_Exception e)
|
||||
{
|
||||
qDebug("ModelView background image file loading failed.");
|
||||
qDebug("ModelView: background image file loading failed.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if(QFile::exists(acFilename))
|
||||
{
|
||||
QFile aircraft(acFilename);
|
||||
QFile aircraft(acFilename);
|
||||
m_World= GLC_Factory::instance()->createWorldFromFile(aircraft);
|
||||
m_ModelBoundingBox= m_World.boundingBox();
|
||||
m_GlView.reframe(m_ModelBoundingBox); // center 3d models in the scene
|
||||
m_GlView.reframe(m_ModelBoundingBox); // center 3D model in the scene
|
||||
m_GlView.setDistMinAndMax(m_World.boundingBox());
|
||||
loadError = false;
|
||||
if (!mvInitGLSuccess)
|
||||
@ -168,7 +173,7 @@ void ModelViewGadgetWidget::CreateScene()
|
||||
}
|
||||
catch(GLC_Exception e)
|
||||
{
|
||||
qDebug("ModelView aircraft texture file loading failed.");
|
||||
qDebug("ModelView: aircraft file loading failed.");
|
||||
loadError = true;
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,23 @@ class ModelViewGadgetWidget : public QGLWidget
|
||||
public:
|
||||
ModelViewGadgetWidget(QWidget *parent = 0);
|
||||
~ModelViewGadgetWidget();
|
||||
void setAcFilename(QString acf) { acFilename = acf; }
|
||||
void setBgFilename(QString bgf) { bgFilename = bgf; }
|
||||
void setAcFilename(QString acf)
|
||||
{
|
||||
if(QFile::exists(acf))
|
||||
acFilename = acf;
|
||||
else
|
||||
{
|
||||
acFilename= acf= ":/modelview/models/warning_sign.obj";
|
||||
m_GlView.cameraHandle()->setFrontView(); // set to front camera to see/read the warning sign
|
||||
}
|
||||
}
|
||||
void setBgFilename(QString bgf)
|
||||
{
|
||||
if (QFile::exists(bgFilename))
|
||||
bgFilename = bgf;
|
||||
else
|
||||
bgFilename= ":/modelview/models/black.jpg"; // will put a black background if there's no background
|
||||
}
|
||||
void setVboEnable(bool eVbo) { vboEnable = eVbo; }
|
||||
void reloadScene();
|
||||
void updateAttitude(int value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user