Compare commits
24 Commits
Version_1.
...
developeme
Author | SHA1 | Date | |
---|---|---|---|
![]() |
54b87b5de7 | ||
![]() |
68387fe7a7 | ||
![]() |
44732057b6 | ||
2d34492517 | |||
3f2713bd16 | |||
c2f7118ed6 | |||
c6d82f5f55 | |||
![]() |
33fafb29a8 | ||
6141263f45 | |||
e59dd980bd | |||
1e71ebed47 | |||
d908894265 | |||
![]() |
bddc7ea852 | ||
![]() |
0372a4ad8c | ||
![]() |
e768ae9af8 | ||
![]() |
b089fcdaf6 | ||
![]() |
cdda1922fa | ||
![]() |
031c620f52 | ||
![]() |
7a41f2d9bf | ||
![]() |
b2efa83e17 | ||
![]() |
7e87b14fe1 | ||
![]() |
da0b7e3c5f | ||
![]() |
fa75e17d58 | ||
![]() |
49585945c3 |
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -19,7 +19,9 @@
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea</set>
|
||||
@@ -32,10 +34,68 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<widget class="QDockWidget" name="dockWidget">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetFloatable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Asset library</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="dirDropDownList">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="fileTreeWidget">
|
||||
<property name="autoExpandDelay">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="../Resources/Resources.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>358</height>
|
||||
<width>584</width>
|
||||
<height>645</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -290,77 +290,15 @@
|
||||
<string>Light</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="light_R_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAmbCoeff">
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
<string>Ambientcoefficient:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAttFac">
|
||||
<property name="text">
|
||||
<string>Attenuationfactor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QSpinBox" name="light_G_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QSpinBox" name="light_B_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSlider" name="light_R_S">
|
||||
<item row="1" column="5">
|
||||
<widget class="QSlider" name="light_G_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
@@ -372,55 +310,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<widget class="QSlider" name="light_B_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QRadioButton" name="radioDirectLight">
|
||||
<property name="text">
|
||||
<string>Directional light</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="attFac">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="ambCoef">
|
||||
<property name="enabled">
|
||||
@@ -446,8 +335,44 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QSlider" name="light_G_S">
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="attFac">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QRadioButton" name="radioDirectLight">
|
||||
<property name="text">
|
||||
<string>Directional light</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<widget class="QSlider" name="light_B_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
@@ -459,17 +384,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAmbCoeff">
|
||||
<property name="text">
|
||||
<string>Ambientcoefficient:</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="light_R_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7" colspan="2">
|
||||
<widget class="QCheckBox" name="checkHeadlight">
|
||||
<property name="text">
|
||||
<string>Headlight</string>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -480,6 +407,79 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSlider" name="light_R_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QSpinBox" name="light_G_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAttFac">
|
||||
<property name="text">
|
||||
<string>Attenuationfactor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QSpinBox" name="light_B_SB">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7" colspan="2">
|
||||
<widget class="QCheckBox" name="checkHeadlight">
|
||||
<property name="text">
|
||||
<string>Headlight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -489,7 +489,21 @@
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="3" colspan="3">
|
||||
<widget class="QCheckBox" name="checkBackfaceCulling">
|
||||
<property name="text">
|
||||
<string>Backface Culling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="labelZoomSpeed">
|
||||
<property name="text">
|
||||
<string>Zoom speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -502,14 +516,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelZoomSpeed">
|
||||
<property name="text">
|
||||
<string>Zoom speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="1" column="5">
|
||||
<widget class="QSpinBox" name="spinZSpeed">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
@@ -525,29 +532,41 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBackfaceCulling">
|
||||
<item row="2" column="3" colspan="4">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Backface Culling</string>
|
||||
<string>Directory Drop Down List:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3" colspan="4">
|
||||
<widget class="QListWidget" name="dirListWidget"/>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>*** "BF1_ModTools" Goes To "C:/BF1_ModTools/Assets/Shipped Worlds/"
|
||||
"BF2_ModTools" Goes To "C:/BF2_ModTools/assets/Sides/"</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QPushButton" name="removeItem">
|
||||
<property name="text">
|
||||
<string>--</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QPushButton" name="addItem">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include <QByteArray>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
struct Material;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
@@ -26,11 +25,14 @@ private:
|
||||
int m_curSeverity;
|
||||
|
||||
FileInfoWindow* m_infoWindow;
|
||||
QStringList m_filters;
|
||||
|
||||
// functions
|
||||
private:
|
||||
void setupWidgets();
|
||||
void openFile();
|
||||
void updateAssetTree(QString);
|
||||
void openFileDialog();
|
||||
void openFile(QString);
|
||||
void takeScreenShot();
|
||||
void aboutTool();
|
||||
|
||||
@@ -42,6 +44,12 @@ public slots:
|
||||
void printMessage(QString message, int severity);
|
||||
void setFileInfo(QString name, QVector<Material>* materials, int vertices, int triangle);
|
||||
|
||||
// private slots
|
||||
private slots:
|
||||
void setupAssetLibrary();
|
||||
void on_fileTreeWidget_doubleClicked();
|
||||
void on_dirDropDownList_currentTextChanged(const QString &arg1);
|
||||
|
||||
// signals
|
||||
signals:
|
||||
void loadFile(QString);
|
||||
|
@@ -23,19 +23,19 @@ private:
|
||||
QOpenGLShaderProgram m_program;
|
||||
GeometryEngine *m_dataEngine;
|
||||
|
||||
QVector4D m_backgroundColorOn = { 0.02f, 0.02f, 0.02f, 1.0f };
|
||||
QVector4D m_backgroundColorOff = { 0.5f, 0.8f, 1.0f, 1.0f };
|
||||
QVector4D m_backgroundColorOn;
|
||||
QVector4D m_backgroundColorOff;
|
||||
|
||||
bool m_wireframe = false;
|
||||
bool m_lightOn = false;
|
||||
bool m_backfaceCulling = false;
|
||||
bool m_wireframe;
|
||||
bool m_lightOn;
|
||||
bool m_backfaceCulling;
|
||||
|
||||
struct {
|
||||
QVector4D position = { 1,1,1,0 };
|
||||
QVector3D intensities = { 1.0,1.0,1.0 };
|
||||
float attenuationFactor = 0.0f;
|
||||
float ambientCoefficient = 0.005f;
|
||||
bool headlight = false;
|
||||
QVector4D position;
|
||||
QVector3D intensities;
|
||||
float attenuationFactor;
|
||||
float ambientCoefficient;
|
||||
bool headlight;
|
||||
} m_light;
|
||||
|
||||
struct {
|
||||
@@ -51,6 +51,7 @@ private:
|
||||
|
||||
// functions
|
||||
private:
|
||||
void setDefaultValues();
|
||||
void initShaders();
|
||||
void resetView();
|
||||
void updateLightPosition();
|
||||
@@ -89,5 +90,10 @@ public slots:
|
||||
void setHeadlight(bool value);
|
||||
void setBackfaceCulling(bool value);
|
||||
|
||||
// signals
|
||||
signals:
|
||||
void lightChanged(bool value);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
79
QtMeshViewer/Header/SettingsManager.h
Normal file
79
QtMeshViewer/Header/SettingsManager.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include <QVector3D>
|
||||
#include <QVector4D>
|
||||
|
||||
|
||||
class SettingsManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
SettingsManager(QObject *parent = Q_NULLPTR);
|
||||
|
||||
public:
|
||||
SettingsManager(SettingsManager const&) = delete;
|
||||
void operator=(SettingsManager const&) = delete;
|
||||
|
||||
~SettingsManager();
|
||||
|
||||
static SettingsManager* getInstance(QObject *parent = Q_NULLPTR);
|
||||
|
||||
// attributes
|
||||
private:
|
||||
QFile m_file;
|
||||
QStringList m_listOfDirs;
|
||||
|
||||
QVector3D m_bgColorOn = { 5, 5, 5 };
|
||||
QVector3D m_bgColorOff = { 128, 204, 255 };
|
||||
QVector3D m_lightColor = { 255,255,255 };
|
||||
bool m_bfCulling = false;
|
||||
bool m_light = false;
|
||||
bool m_headlight = false;
|
||||
bool m_autoColor = true;
|
||||
float m_attenuation = 0.0f;
|
||||
float m_ambient = 0.005f;
|
||||
int m_lightType = 1; // 1 = direct, 2 = point
|
||||
|
||||
// functions
|
||||
private:
|
||||
void readFromFile();
|
||||
void writeToFile();
|
||||
|
||||
public:
|
||||
QVector3D getBgColorOn() const;
|
||||
QVector3D getBgColorOff() const;
|
||||
bool isBfCulling() const;
|
||||
bool isLight() const;
|
||||
|
||||
QStringList getListOfDirs();
|
||||
|
||||
int getLightType() const;
|
||||
QVector3D getLightColor() const;
|
||||
float getAttenuation() const;
|
||||
float getAmbient() const;
|
||||
bool isHeadlight() const;
|
||||
bool isAutoColor() const;
|
||||
|
||||
|
||||
// slots
|
||||
public:
|
||||
void setBgColorOn(QVector3D value);
|
||||
void setBgColorOff(QVector3D value);
|
||||
void setBfCulling(bool value);
|
||||
void setLight(bool value);
|
||||
|
||||
void setLightType(int value);
|
||||
void setLightColor(QVector3D value);
|
||||
void setAttenuation(double value);
|
||||
void setAmbient(double value);
|
||||
void setHeadlight(bool value);
|
||||
void setAutoColor(int value);
|
||||
|
||||
void updateDirectories(QString path);
|
||||
|
||||
// signals
|
||||
signals:
|
||||
void dirsChanged();
|
||||
};
|
@@ -9,7 +9,7 @@ class SettingsWindow : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsWindow(QVector3D bgOffColor, QVector3D bgOnColor, QVector3D lightColor, bool autoColor, double ambCoef, double attFac, int lightType, QWidget * parent = Q_NULLPTR);
|
||||
SettingsWindow(QWidget * parent = Q_NULLPTR);
|
||||
~SettingsWindow();
|
||||
|
||||
private:
|
||||
@@ -24,6 +24,9 @@ private slots:
|
||||
void backgroundColorOnChanged();
|
||||
void lightColorChanged();
|
||||
|
||||
void on_addItem_clicked();
|
||||
void on_removeItem_clicked();
|
||||
|
||||
signals:
|
||||
void updateBGColorOff(QVector3D value);
|
||||
void updateBGColorOn(QVector3D value);
|
||||
@@ -33,5 +36,7 @@ signals:
|
||||
void sendHeadlight(bool value);
|
||||
void sendBackfaceCulling(bool value);
|
||||
void sendZommSpeed(int percent);
|
||||
void changeLightType(int value);
|
||||
void pathChanged(QString path);
|
||||
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,3 @@
|
||||
#version 450
|
||||
#ifdef GL_ES
|
||||
// Set default precision to medium
|
||||
precision mediump int;
|
||||
@@ -70,8 +69,8 @@ void main()
|
||||
mat3 tbn = transpose(mat3(surfaceTangent, surfaceBitangent, surfaceNormal));
|
||||
normal = texture2D(tx1, v_surfaceUV).rgb;
|
||||
normal = normalize(normal * 2.0 -1.0);
|
||||
surfaceToLight = tbn * surfaceToLight;
|
||||
surfaceToCamera = tbn * surfaceToCamera;
|
||||
surfaceToLight = normalize(tbn * surfaceToLight);
|
||||
surfaceToCamera = normalize(tbn * surfaceToCamera);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +97,7 @@ void main()
|
||||
float specularWeight = 1;
|
||||
if(material.hasSpecularmap)
|
||||
specularWeight = surfaceColor.a;
|
||||
vec3 specColor = specularWeight * material.specularColor;
|
||||
vec3 specColor = specularWeight * 1/255 * material.specularColor;
|
||||
|
||||
vec3 specular = specularCoefficient * specColor * light.intensities;
|
||||
|
||||
|
@@ -1,4 +1,3 @@
|
||||
#version 450
|
||||
#ifdef GL_ES
|
||||
// Set default precision to medium
|
||||
precision mediump int;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "..\Header\OglViewerWidget.h"
|
||||
#include "..\Header\FileInterface.h"
|
||||
#include "..\Header\OutputDevice.h"
|
||||
#include "..\Header\SettingsManager.h"
|
||||
#include <QSurfaceFormat>
|
||||
#include <QSignalMapper>
|
||||
#include <QToolButton>
|
||||
@@ -10,6 +11,9 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPalette>
|
||||
#include <QResizeEvent>
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
#define WINDOW_NAME "Mesh Viewer"
|
||||
|
||||
@@ -41,6 +45,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
// set default text to file info
|
||||
m_fileInfo = "Filename: -\nMaterials: -\nVertices: -\nTriangle: -<detail>No file is open";
|
||||
|
||||
ui->dirDropDownList->addItem("BF1_ModTools", "C:/BF1_ModTools/Assets/Shipped Worlds/");
|
||||
ui->dirDropDownList->addItem("BF2_ModTools", "C:/BF2_ModTools/assets/Sides/");
|
||||
|
||||
// add widgets to the window
|
||||
setupWidgets();
|
||||
|
||||
@@ -49,6 +56,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
styleSheet.open(QIODevice::ReadOnly);
|
||||
this->setStyleSheet(styleSheet.readAll());
|
||||
|
||||
// setup dropdown
|
||||
setupAssetLibrary();
|
||||
connect(SettingsManager::getInstance(), &SettingsManager::dirsChanged, this, &MainWindow::setupAssetLibrary);
|
||||
|
||||
printMessage("MeshViewer by Anakin", 0);
|
||||
}
|
||||
|
||||
@@ -59,10 +70,8 @@ MainWindow::~MainWindow()
|
||||
delete m_infoWindow;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// functions
|
||||
|
||||
void MainWindow::setupWidgets()
|
||||
{
|
||||
// Ogl Viewer
|
||||
@@ -71,11 +80,11 @@ void MainWindow::setupWidgets()
|
||||
connect(this, &MainWindow::loadFile, viewer, &OglViewerWidget::loadFile);
|
||||
|
||||
// open file
|
||||
QToolButton *openFile = new QToolButton(this);
|
||||
openFile->setObjectName("openFile");
|
||||
openFile->setToolTip("open file");
|
||||
connect(openFile, &QToolButton::pressed, this, &MainWindow::openFile);
|
||||
ui->mainToolBar->addWidget(openFile);
|
||||
QToolButton *openFileDialog = new QToolButton(this);
|
||||
openFileDialog->setObjectName("openFile");
|
||||
openFileDialog->setToolTip("open file");
|
||||
connect(openFileDialog, &QToolButton::pressed, this, &MainWindow::openFileDialog);
|
||||
ui->mainToolBar->addWidget(openFileDialog);
|
||||
|
||||
// screenshot
|
||||
QToolButton *screenshot = new QToolButton(this);
|
||||
@@ -158,12 +167,31 @@ void MainWindow::setupWidgets()
|
||||
m_output->setAlignment(Qt::AlignTop);
|
||||
m_output->setText(m_fileInfo.left(m_fileInfo.indexOf("<detail>")));
|
||||
m_output->raise();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
void MainWindow::updateAssetTree(QString path)
|
||||
{
|
||||
|
||||
ui->fileTreeWidget->clear();
|
||||
QDirIterator itterator(path, QStringList() << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH",
|
||||
QDir::Files, QDirIterator::Subdirectories);
|
||||
|
||||
while (itterator.hasNext()) {
|
||||
QTreeWidgetItem* sub = new QTreeWidgetItem(ui->fileTreeWidget);
|
||||
sub->setData(0, Qt::DisplayRole, itterator.fileName());
|
||||
sub->setData(1, Qt::DisplayRole, itterator.fileInfo().absoluteFilePath());
|
||||
itterator.next();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openFileDialog()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");
|
||||
openFile(fileName);
|
||||
}
|
||||
|
||||
void MainWindow::openFile(QString fileName)
|
||||
{
|
||||
if(!fileName.isEmpty())
|
||||
emit loadFile(fileName);
|
||||
}
|
||||
@@ -205,6 +233,35 @@ void MainWindow::resizeEvent(QResizeEvent * e)
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// slots
|
||||
|
||||
void MainWindow::setupAssetLibrary()
|
||||
{
|
||||
// get all directories and put them in the dropdown.
|
||||
while (ui->dirDropDownList->count() != 0)
|
||||
ui->dirDropDownList->removeItem(0);
|
||||
|
||||
QStringList tmp_list = SettingsManager::getInstance()->getListOfDirs();
|
||||
for (QString &it : tmp_list)
|
||||
ui->dirDropDownList->addItem(it, it);
|
||||
|
||||
// choose the current path and display it.
|
||||
if (ui->dirDropDownList->currentData().isValid())
|
||||
updateAssetTree(ui->dirDropDownList->currentData().toString());
|
||||
}
|
||||
|
||||
void MainWindow::on_fileTreeWidget_doubleClicked()
|
||||
{
|
||||
QString clickedFile = ui->fileTreeWidget->currentItem()->text(1);
|
||||
openFile(clickedFile);
|
||||
}
|
||||
|
||||
void MainWindow::on_dirDropDownList_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
QString selectedDir;
|
||||
selectedDir = ui->dirDropDownList->itemData(ui->dirDropDownList->currentIndex()).toString();
|
||||
printMessage(arg1 + " : " + selectedDir, 0);
|
||||
updateAssetTree(selectedDir);
|
||||
}
|
||||
|
||||
void MainWindow::printMessage(QString message, int severity)
|
||||
{
|
||||
if (!ui->statusBar->currentMessage().isEmpty() && severity < m_curSeverity)
|
||||
|
@@ -707,7 +707,6 @@ void MshFile::analyseSegmChunks(Model * dataDestination, QList<ChunkHeader*>& ch
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
//TODO: buffer size == 1; k = 2;
|
||||
// polygon normal wasn't calculated before
|
||||
if (new_segment->vertices[tmp_buffer[k]].polygonNormal == QVector3D(0, 0, 0))
|
||||
{
|
||||
@@ -921,7 +920,7 @@ void MshFile::loadTexture(QOpenGLTexture *& destination, QString filepath, QStri
|
||||
if (!loadSuccess)
|
||||
{
|
||||
OutputDevice::getInstance()->print("WARNING: texture not found or corrupted: " + filename, 1);
|
||||
//TODO: use the correct diffuse color or return with null
|
||||
//TODO: cloth use the wrong diffuse color. should be null
|
||||
img = QImage(1, 1, QImage::Format_RGB32);
|
||||
img.fill(QColor(m_materials->back().diffuseColor[0] * 255, m_materials->back().diffuseColor[1] * 255, m_materials->back().diffuseColor[2] * 255));
|
||||
filename += " *";
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "..\Header\FreeCamera.h"
|
||||
#include "..\Header\OrbitCamera.h"
|
||||
#include "..\Header\MoveCamera.h"
|
||||
#include "..\Header\SettingsManager.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QDropEvent>
|
||||
#include <QMimeData>
|
||||
@@ -24,7 +25,8 @@ OglViewerWidget::OglViewerWidget(QWidget *parent)
|
||||
setAcceptDrops(true);
|
||||
|
||||
// settings window
|
||||
m_settings = new SettingsWindow(m_backgroundColorOff.toVector3D() * 255, m_backgroundColorOn.toVector3D() * 255, m_light.intensities * 255, true, m_light.ambientCoefficient, m_light.attenuationFactor, 1, this);
|
||||
setDefaultValues();
|
||||
m_settings = new SettingsWindow(this);
|
||||
|
||||
connect(m_settings, &SettingsWindow::updateBGColorOff, this, &OglViewerWidget::setBGColorOff);
|
||||
connect(m_settings, &SettingsWindow::updateBGColorOn, this, &OglViewerWidget::setBGColorOn);
|
||||
@@ -52,6 +54,30 @@ OglViewerWidget::~OglViewerWidget()
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// functions
|
||||
|
||||
void OglViewerWidget::setDefaultValues()
|
||||
{
|
||||
SettingsManager* sm = SettingsManager::getInstance(this);
|
||||
|
||||
m_backgroundColorOn = QVector4D(sm->getBgColorOn() / 255, 1.0f);
|
||||
m_backgroundColorOff = QVector4D(sm->getBgColorOff() / 255, 1.0f);
|
||||
|
||||
m_wireframe = false;
|
||||
m_lightOn = sm->isLight();
|
||||
m_backfaceCulling = sm->isBfCulling();
|
||||
|
||||
if (sm->getLightType() == 1) // directional
|
||||
m_light.position = { 0.0,0.0,0.0,0.0 };
|
||||
else // point
|
||||
m_light.position = { 0.0,0.0,0.0,1.0 };
|
||||
m_light.intensities = sm->getLightColor() / 255;
|
||||
m_light.attenuationFactor = sm->getAttenuation();
|
||||
m_light.ambientCoefficient = sm->getAmbient();
|
||||
m_light.headlight = sm->isHeadlight();
|
||||
|
||||
connect(this, &OglViewerWidget::lightChanged, sm, &SettingsManager::setLight);
|
||||
|
||||
}
|
||||
|
||||
void OglViewerWidget::initShaders()
|
||||
{
|
||||
// Compile vertex shader
|
||||
@@ -371,6 +397,8 @@ void OglViewerWidget::toggleLight()
|
||||
m_backgroundColorOff[3] = 1.0;
|
||||
}
|
||||
|
||||
emit lightChanged(m_lightOn);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
243
QtMeshViewer/Source/SettingsManager.cpp
Normal file
243
QtMeshViewer/Source/SettingsManager.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
#include "..\Header\SettingsManager.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// constructor/destructor
|
||||
|
||||
SettingsManager::SettingsManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_file.setFileName("meshviewer.config");
|
||||
readFromFile();
|
||||
}
|
||||
|
||||
SettingsManager::~SettingsManager()
|
||||
{
|
||||
writeToFile();
|
||||
}
|
||||
|
||||
SettingsManager* SettingsManager::getInstance(QObject *parent)
|
||||
{
|
||||
static SettingsManager* instance = new SettingsManager(parent);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// functions
|
||||
|
||||
void SettingsManager::readFromFile()
|
||||
{
|
||||
if (m_file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
|
||||
QByteArray stream = m_file.readAll();
|
||||
QList<QByteArray> lines = stream.split('\n');
|
||||
|
||||
for (auto& it : lines)
|
||||
{
|
||||
if (it.startsWith("<bgOn>"))
|
||||
{
|
||||
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_bgColorOn[i] = values[i].toFloat();
|
||||
}
|
||||
else if (it.startsWith("<bgOff>"))
|
||||
{
|
||||
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_bgColorOff[i] = values[i].toFloat();
|
||||
}
|
||||
else if (it.startsWith("<liCo>"))
|
||||
{
|
||||
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_lightColor[i] = values[i].toFloat();
|
||||
}
|
||||
else if (it.startsWith("<bfCul>"))
|
||||
{
|
||||
m_bfCulling = it.right(it.size() - it.indexOf('>') - 1).toInt();
|
||||
}
|
||||
else if (it.startsWith("<liOn>"))
|
||||
{
|
||||
m_light = it.right(it.size() - it.indexOf('>') - 1).toInt();
|
||||
}
|
||||
else if (it.startsWith("<heLi>"))
|
||||
{
|
||||
m_headlight = it.right(it.size() - it.indexOf('>') - 1).toInt();
|
||||
}
|
||||
else if (it.startsWith("<auCo>"))
|
||||
{
|
||||
m_autoColor = it.right(it.size() - it.indexOf('>') - 1).toInt();
|
||||
}
|
||||
else if (it.startsWith("<liTy>"))
|
||||
{
|
||||
m_lightType = it.right(it.size() - it.indexOf('>') - 1).toInt();
|
||||
}
|
||||
else if (it.startsWith("<atFa>"))
|
||||
{
|
||||
m_attenuation = it.right(it.size() - it.indexOf('>') - 1).toFloat();
|
||||
}
|
||||
else if (it.startsWith("<amCo>"))
|
||||
{
|
||||
m_ambient = it.right(it.size() - it.indexOf('>') - 1).toFloat();
|
||||
}
|
||||
else if (it.startsWith("<qkList>"))
|
||||
{
|
||||
m_listOfDirs = QString(it.right(it.size() - it.indexOf('>') - 1)).split(";");
|
||||
}
|
||||
|
||||
}
|
||||
m_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsManager::writeToFile()
|
||||
{
|
||||
m_file.open(QIODevice::WriteOnly);
|
||||
|
||||
m_file.write(QString("<bgOn>%1;%2;%3\n").arg(m_bgColorOn.x()).arg(m_bgColorOn.y()).arg(m_bgColorOn.z()).toUtf8());
|
||||
m_file.write(QString("<bgOff>%1;%2;%3\n").arg(m_bgColorOff.x()).arg(m_bgColorOff.y()).arg(m_bgColorOff.z()).toUtf8());
|
||||
m_file.write(QString("<liCo>%1;%2;%3\n").arg(m_lightColor.x()).arg(m_lightColor.y()).arg(m_lightColor.z()).toUtf8());
|
||||
|
||||
m_file.write(QString("<bfCul>%1\n").arg(m_bfCulling).toUtf8());
|
||||
m_file.write(QString("<liOn>%1\n").arg(m_light).toUtf8());
|
||||
m_file.write(QString("<heLi>%1\n").arg(m_headlight).toUtf8());
|
||||
m_file.write(QString("<auCo>%1\n").arg(m_autoColor).toUtf8());
|
||||
|
||||
m_file.write(QString("<liTy>%1\n").arg(m_lightType).toUtf8());
|
||||
m_file.write(QString("<atFa>%1\n").arg(m_attenuation).toUtf8());
|
||||
m_file.write(QString("<amCo>%1\n").arg(m_ambient).toUtf8());
|
||||
if(!m_listOfDirs.isEmpty())
|
||||
m_file.write(QString("<qkList>%1\n").arg(m_listOfDirs.join(";")).toUtf8());
|
||||
|
||||
m_file.close();
|
||||
}
|
||||
|
||||
// getter ///////////////////////////////////////////////////////////////
|
||||
|
||||
QStringList SettingsManager::getListOfDirs()
|
||||
{
|
||||
return m_listOfDirs;
|
||||
}
|
||||
|
||||
QVector3D SettingsManager::getBgColorOn() const
|
||||
{
|
||||
return m_bgColorOn;
|
||||
}
|
||||
|
||||
QVector3D SettingsManager::getBgColorOff() const
|
||||
{
|
||||
return m_bgColorOff;
|
||||
}
|
||||
|
||||
bool SettingsManager::isBfCulling() const
|
||||
{
|
||||
return m_bfCulling;
|
||||
}
|
||||
|
||||
bool SettingsManager::isLight() const
|
||||
{
|
||||
return m_light;
|
||||
}
|
||||
|
||||
int SettingsManager::getLightType() const
|
||||
{
|
||||
return m_lightType;
|
||||
}
|
||||
|
||||
QVector3D SettingsManager::getLightColor() const
|
||||
{
|
||||
return m_lightColor;
|
||||
}
|
||||
|
||||
float SettingsManager::getAttenuation() const
|
||||
{
|
||||
return m_attenuation;
|
||||
}
|
||||
|
||||
float SettingsManager::getAmbient() const
|
||||
{
|
||||
return m_ambient;
|
||||
}
|
||||
|
||||
bool SettingsManager::isHeadlight() const
|
||||
{
|
||||
return m_headlight;
|
||||
}
|
||||
|
||||
bool SettingsManager::isAutoColor() const
|
||||
{
|
||||
return m_autoColor;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// slots
|
||||
|
||||
void SettingsManager::setBgColorOn(QVector3D value)
|
||||
{
|
||||
m_bgColorOn = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setBgColorOff(QVector3D value)
|
||||
{
|
||||
m_bgColorOff = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setBfCulling(bool value)
|
||||
{
|
||||
m_bfCulling = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setLight(bool value)
|
||||
{
|
||||
m_light = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setLightType(int value)
|
||||
{
|
||||
m_lightType = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setLightColor(QVector3D value)
|
||||
{
|
||||
m_lightColor = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setAttenuation(double value)
|
||||
{
|
||||
m_attenuation = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setAmbient(double value)
|
||||
{
|
||||
m_ambient = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setHeadlight(bool value)
|
||||
{
|
||||
m_headlight = value;
|
||||
}
|
||||
|
||||
void SettingsManager::setAutoColor(int value)
|
||||
{
|
||||
if (value == 0)
|
||||
m_autoColor = false;
|
||||
else
|
||||
m_autoColor = true;
|
||||
}
|
||||
|
||||
void SettingsManager::updateDirectories(QString path)
|
||||
{
|
||||
if (m_listOfDirs.contains(path))
|
||||
m_listOfDirs.removeAll(path);
|
||||
else
|
||||
m_listOfDirs.append(path);
|
||||
|
||||
emit dirsChanged();
|
||||
}
|
@@ -1,10 +1,12 @@
|
||||
#include "..\Header\SettingsWindow.h"
|
||||
|
||||
#include "..\Header\SettingsManager.h"
|
||||
#include <QFileDialog>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// constructor/destructor
|
||||
|
||||
SettingsWindow::SettingsWindow(QVector3D bgOffColor, QVector3D bgOnColor, QVector3D lightColor, bool autoColor, double ambCoef, double attFac, int lightType, QWidget * parent)
|
||||
SettingsWindow::SettingsWindow(QWidget * parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::SettingsWindow)
|
||||
{
|
||||
@@ -15,25 +17,47 @@ SettingsWindow::SettingsWindow(QVector3D bgOffColor, QVector3D bgOnColor, QVecto
|
||||
setupConnections();
|
||||
|
||||
// set default values
|
||||
ui->lightOff_R_SB->setValue((int)bgOffColor[0]);
|
||||
ui->lightOff_G_SB->setValue((int)bgOffColor[1]);
|
||||
ui->lightOff_B_SB->setValue((int)bgOffColor[2]);
|
||||
SettingsManager* sm = SettingsManager::getInstance(this);
|
||||
|
||||
ui->lightOn_R_SB->setValue((int)bgOnColor[0]);
|
||||
ui->lightOn_G_SB->setValue((int)bgOnColor[1]);
|
||||
ui->lightOn_B_SB->setValue((int)bgOnColor[2]);
|
||||
// set dirList for passing to Main and then fill settings manager dir list window
|
||||
QStringList tmp_directories = sm->getListOfDirs();
|
||||
for (auto &it : tmp_directories)
|
||||
ui->dirListWidget->insertItem(0, it);
|
||||
|
||||
ui->light_R_SB->setValue((int)lightColor[0]);
|
||||
ui->light_G_SB->setValue((int)lightColor[1]);
|
||||
ui->light_B_SB->setValue((int)lightColor[2]);
|
||||
ui->lightOff_R_SB->setValue((int)(sm->getBgColorOff()[0]));
|
||||
ui->lightOff_G_SB->setValue((int)(sm->getBgColorOff()[1]));
|
||||
ui->lightOff_B_SB->setValue((int)(sm->getBgColorOff()[2]));
|
||||
|
||||
ui->ambCoef->setValue(ambCoef);
|
||||
ui->attFac->setValue(attFac);
|
||||
ui->lightOn_R_SB->setValue((int)(sm->getBgColorOn()[0]));
|
||||
ui->lightOn_G_SB->setValue((int)(sm->getBgColorOn()[1]));
|
||||
ui->lightOn_B_SB->setValue((int)(sm->getBgColorOn()[2]));
|
||||
|
||||
ui->checkAutoColor->setChecked(autoColor);
|
||||
if (lightType == 1)
|
||||
ui->light_R_SB->setValue((int)(sm->getLightColor()[0]));
|
||||
ui->light_G_SB->setValue((int)(sm->getLightColor()[1]));
|
||||
ui->light_B_SB->setValue((int)(sm->getLightColor()[2]));
|
||||
|
||||
ui->ambCoef->setValue(sm->getAmbient());
|
||||
ui->attFac->setValue(sm->getAttenuation());
|
||||
|
||||
ui->checkBackfaceCulling->setChecked(sm->isBfCulling());
|
||||
ui->checkAutoColor->setChecked(sm->isAutoColor());
|
||||
ui->checkHeadlight->setChecked(sm->isHeadlight());
|
||||
|
||||
if (sm->getLightType() == 1)
|
||||
ui->radioDirectLight->setChecked(true);
|
||||
else
|
||||
ui->radioPointLight->setChecked(true);
|
||||
|
||||
connect(this, &SettingsWindow::updateBGColorOff, sm, &SettingsManager::setBgColorOff);
|
||||
connect(this, &SettingsWindow::updateBGColorOn, sm, &SettingsManager::setBgColorOn);
|
||||
connect(this, &SettingsWindow::updateLightColor, sm, &SettingsManager::setLightColor);
|
||||
connect(this, &SettingsWindow::updateAttFac, sm, &SettingsManager::setAttenuation);
|
||||
connect(this, &SettingsWindow::updateAmbCoef, sm, &SettingsManager::setAmbient);
|
||||
connect(this, &SettingsWindow::sendHeadlight, sm, &SettingsManager::setHeadlight);
|
||||
connect(this, &SettingsWindow::sendBackfaceCulling, sm, &SettingsManager::setBfCulling);
|
||||
connect(ui->checkAutoColor, &QCheckBox::stateChanged, sm, &SettingsManager::setAutoColor);
|
||||
connect(this, &SettingsWindow::changeLightType, sm, &SettingsManager::setLightType);
|
||||
connect(this, &SettingsWindow::pathChanged, sm, &SettingsManager::updateDirectories);
|
||||
}
|
||||
|
||||
SettingsWindow::~SettingsWindow()
|
||||
@@ -133,10 +157,12 @@ void SettingsWindow::radioToggled()
|
||||
{
|
||||
ui->attFac->setValue(0.0);
|
||||
ui->attFac->setEnabled(false);
|
||||
emit changeLightType(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->attFac->setEnabled(true);
|
||||
emit changeLightType(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,3 +187,22 @@ void SettingsWindow::lightColorChanged()
|
||||
ui->lightOn_B_S->setValue((int)(ui->light_B_S->value() / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::on_addItem_clicked()
|
||||
{
|
||||
QString dirName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",
|
||||
QFileDialog::ShowDirsOnly |
|
||||
QFileDialog::DontResolveSymlinks);
|
||||
if (!SettingsManager::getInstance()->getListOfDirs().contains(dirName))
|
||||
{
|
||||
ui->dirListWidget->insertItem(0, dirName);
|
||||
emit pathChanged(dirName);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::on_removeItem_clicked()
|
||||
{
|
||||
QListWidgetItem* tmp = ui->dirListWidget->takeItem(ui->dirListWidget->currentRow());
|
||||
emit pathChanged(tmp->text());
|
||||
delete tmp;
|
||||
}
|
||||
|
@@ -12,10 +12,4 @@ So far it is just me. If you wanna help me, let me know :D
|
||||
Feel free to use my code the way you like. But remember i used some public libraries. Make sure you read their
|
||||
licence, too.
|
||||
|
||||
### To Do
|
||||
- normal map,
|
||||
- list all msh in a directory
|
||||
- glow/emissive
|
||||
- optional display bones, shadow, collision
|
||||
- change pose
|
||||
- animation
|
||||
|
||||
|
Binary file not shown.
BIN
preview.jpg
BIN
preview.jpg
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 46 KiB |
Reference in New Issue
Block a user