Merge branch 'master' into develop_kimkulling

pull/1871/head
Kim Kulling 2018-04-06 10:32:35 +02:00
commit a3cb1ef55e
6 changed files with 84 additions and 7 deletions

View File

@ -71,7 +71,7 @@ static const aiImporterDesc desc = {
0,
0,
0,
"3ds prj"
"3ds prj 3DS PRJ"
};
@ -127,7 +127,7 @@ Discreet3DSImporter::~Discreet3DSImporter() {
// Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
std::string extension = GetExtension(pFile);
if(extension == "3ds" || extension == "prj" ) {
if(extension == "3ds" || extension == "3DS" || extension == "prj"|| extension == "PRJ" ) {
return true;
}

View File

@ -560,6 +560,30 @@ void CGLView::Enable_Textures(const bool pEnable)
}
}
void CGLView::Enable_Axes(const bool pEnable){
if(pEnable)
{
this->mAxesEnabled = true;
}
else
{
this->mAxesEnabled = false;
}
}
void CGLView::Enable_Reload_Textures(const bool pEnable)
{
if(pEnable)
{
this->mReloadTexturesEnabled = true;
// this->mScene->ImportTextures(this->mScene->pScenePath);
}
else
{
this->mReloadTexturesEnabled = false;
}
}
/********************************************************************/
/*********************** Override functions ************************/
/********************************************************************/
@ -609,6 +633,7 @@ void CGLView::drawCoordSystem() {
// Z, -Z
qglColor(QColor(Qt::blue)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, 100000.0);
qglColor(QColor(Qt::yellow)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, -100000.0);
qglColor(QColor(Qt::white));
glEnd();
}
@ -629,7 +654,10 @@ void CGLView::paintGL()
if ( mLightingEnabled ) {
glDisable( GL_LIGHTING );///TODO: display list
}
drawCoordSystem();
if (this->mAxesEnabled == true)
{
drawCoordSystem();
}
glDisable(GL_COLOR_MATERIAL);
if(mLightingEnabled) glEnable(GL_LIGHTING);

View File

@ -75,7 +75,9 @@ private:
};
public:
bool mAxesEnabled = true;
// Textures
bool mReloadTexturesEnabled = false; // If true then textures will reload when the window is activated.
/// \enum ELightType
/// Type of light source.
enum class ELightType { Directional, Point, Spot };
@ -155,7 +157,6 @@ private:
GLdouble mCamera_Viewport_AspectRatio;///< Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
// Lighting
bool mLightingEnabled = false;///< If true then OpenGL lighting is enabled (glEnable(GL_LIGHTING)), if false - disabled.
// Textures
///TODO: map is goooood, but not for case when one image can be used in different materials with difference in: texture transformation, targeting of the
/// texture (ambient or emission, or even height map), texture properties.
QMap<QString, GLuint> mTexture_IDMap;///< Map image filenames to textures ID's.
@ -306,6 +307,12 @@ public:
/// \param [in] pEnable - if true then enable textures, false - disable textures.
void Enable_Textures(const bool pEnable);
void Enable_Axes(const bool pEnable);
/// \fn void Enable_Textures(const bool pEnable)
/// Control textures drawing.
/// \param [in] pEnable - if true then enable textures, false - disable textures.
void Enable_Reload_Textures(const bool pEnable);
/********************************************************************/
/******************** Lighting control functions ********************/
/********************************************************************/

View File

@ -48,6 +48,7 @@ QTime time_begin = QTime::currentTime();
ui->cbxLighting->setChecked(true); mGLView->Lighting_Enable();
ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false);
ui->cbxTextures->setChecked(true); mGLView->Enable_Textures(true);
ui->cbxReloadTextures->setChecked(true); mGLView->Enable_Reload_Textures(false);
//
// Fill info labels
//
@ -194,6 +195,13 @@ GLfloat step;
/********************************************************************/
/********************** Constructor/Destructor **********************/
/********************************************************************/
bool MainWindow::event(QEvent *e)
{
if (e->type() == QEvent::WindowActivate && this->mGLView->mReloadTexturesEnabled == true) {
qInfo() << "Window Activated";
}
return QWidget::event(e);
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow),
@ -364,6 +372,18 @@ void MainWindow::on_cbxBBox_clicked(bool checked)
mGLView->updateGL();
}
void MainWindow::on_cbxDrawAxes_clicked(bool checked)
{
mGLView->Enable_Axes(checked);
mGLView->updateGL();
}
void MainWindow::on_cbxReloadTextures_clicked(bool checked)
{
mGLView->Enable_Reload_Textures(checked);
mGLView->updateGL();
}
void MainWindow::on_cbxTextures_clicked(bool checked)
{
mGLView->Enable_Textures(checked);

View File

@ -90,7 +90,7 @@ protected:
/// \param [in] pEvent - pointer to event data.
void keyPressEvent(QKeyEvent* pEvent) override;
bool event(QEvent*);
public:
/********************************************************************/
@ -133,4 +133,6 @@ private slots:
void on_lstCamera_clicked(const QModelIndex &index);
void on_cbxBBox_clicked(bool checked);
void on_cbxTextures_clicked(bool checked);
void on_cbxDrawAxes_clicked(bool checked);
void on_cbxReloadTextures_clicked(bool checked);
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>641</width>
<height>734</height>
<height>778</height>
</rect>
</property>
<property name="windowTitle">
@ -501,6 +501,23 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbxDrawAxes">
<property name="text">
<string>Show Axes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="cbxReloadTextures">
<property name="text">
<string>Live Reload Textures</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -513,4 +530,7 @@
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
<slots>
<signal>installEventFilter()</signal>
</slots>
</ui>