Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
7b739ab8
Commit
7b739ab8
authored
Jan 29, 2017
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use OutputDevice to set fileinfo,
use new connect function,
parent
98302664
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
26 deletions
+19
-26
QtMeshViewer/Header/GeometryEngine.h
QtMeshViewer/Header/GeometryEngine.h
+0
-5
QtMeshViewer/Header/OglViewerWidget.h
QtMeshViewer/Header/OglViewerWidget.h
+0
-4
QtMeshViewer/Header/OutputDevice.h
QtMeshViewer/Header/OutputDevice.h
+6
-1
QtMeshViewer/Source/GeometryEngine.cpp
QtMeshViewer/Source/GeometryEngine.cpp
+1
-5
QtMeshViewer/Source/MainWindow.cpp
QtMeshViewer/Source/MainWindow.cpp
+1
-0
QtMeshViewer/Source/OglViewerWidget.cpp
QtMeshViewer/Source/OglViewerWidget.cpp
+11
-11
No files found.
QtMeshViewer/Header/GeometryEngine.h
View file @
7b739ab8
...
...
@@ -37,16 +37,11 @@ private:
public:
void
drawGeometry
(
QOpenGLShaderProgram
*
program
,
bool
wireframe
);
// slots
public
slots
:
void
loadFile
(
QString
filePath
);
// signals
signals:
void
requestResetView
();
void
requestUpdate
();
void
sendFileInfo
(
QString
name
,
QVector
<
Material
>*
materials
,
int
vertices
,
int
triangle
);
};
QtMeshViewer/Header/OglViewerWidget.h
View file @
7b739ab8
...
...
@@ -58,7 +58,6 @@ private:
// functions
private:
void
initShaders
();
void
setConnections
();
void
resetView
();
void
updateLightPosition
();
...
...
@@ -89,8 +88,5 @@ public slots:
void
setAttFac
(
double
value
);
void
setAmbCoef
(
double
value
);
// signals
signals:
void
loadFile
(
QString
);
};
QtMeshViewer/Header/OutputDevice.h
View file @
7b739ab8
#pragma once
#include <QObject>
struct
Material
;
class
OutputDevice
:
public
QObject
{
Q_OBJECT
...
...
@@ -20,8 +22,11 @@ public:
};
void
print
(
QString
message
,
int
severity
)
{
emit
sendMessage
(
message
,
severity
);
};
void
setFileInfo
(
QString
name
,
QVector
<
Material
>*
materials
,
int
vertices
,
int
triangle
)
{
emit
sendFileInfo
(
name
,
materials
,
vertices
,
triangle
);
};
signals:
void
sendMessage
(
QString
message
,
int
severity
);
void
sendFileInfo
(
QString
name
,
QVector
<
Material
>*
materials
,
int
vertices
,
int
triangle
);
};
\ No newline at end of file
QtMeshViewer/Source/GeometryEngine.cpp
View file @
7b739ab8
...
...
@@ -142,10 +142,6 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
}
}
/////////////////////////////////////////////////////////////////////////
// slots
void
GeometryEngine
::
loadFile
(
QString
filePath
)
{
// cleanup old stuff and recreate buffers
...
...
@@ -215,7 +211,7 @@ void GeometryEngine::loadFile(QString filePath)
emit
requestUpdate
();
OutputDevice
::
getInstance
()
->
print
(
"done.."
,
0
);
emit
send
FileInfo
(
filePath
.
right
(
filePath
.
size
()
-
filePath
.
lastIndexOf
(
QRegExp
(
"/|
\\\\
"
))
-
1
),
m_materials
,
vertexData
.
size
(),
indexData
.
size
()
/
3
);
OutputDevice
::
getInstance
()
->
set
FileInfo
(
filePath
.
right
(
filePath
.
size
()
-
filePath
.
lastIndexOf
(
QRegExp
(
"/|
\\\\
"
))
-
1
),
m_materials
,
vertexData
.
size
(),
indexData
.
size
()
/
3
);
}
catch
(
std
::
invalid_argument
e
)
{
...
...
QtMeshViewer/Source/MainWindow.cpp
View file @
7b739ab8
...
...
@@ -31,6 +31,7 @@ MainWindow::MainWindow(QWidget *parent)
setWindowIcon
(
QIcon
(
":/images/icon.ico"
));
connect
(
OutputDevice
::
getInstance
(
this
),
&
OutputDevice
::
sendMessage
,
this
,
&
MainWindow
::
printMessage
);
connect
(
OutputDevice
::
getInstance
(
this
),
&
OutputDevice
::
sendFileInfo
,
this
,
&
MainWindow
::
setFileInfo
);
// setup opengl things
QSurfaceFormat
format
;
...
...
QtMeshViewer/Source/OglViewerWidget.cpp
View file @
7b739ab8
#include "..\Header\OglViewerWidget.h"
#include "..\Header\OutputDevice.h"
#include "..\Header\MainWindow.h"
#include <QMouseEvent>
#include <QDropEvent>
#include <QMimeData>
...
...
@@ -17,6 +18,7 @@ OglViewerWidget::OglViewerWidget(QWidget *parent)
setFocus
();
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
);
connect
(
m_settings
,
&
SettingsWindow
::
updateBGColorOff
,
this
,
&
OglViewerWidget
::
setBGColorOff
);
...
...
@@ -60,15 +62,6 @@ void OglViewerWidget::initShaders()
close
();
}
void
OglViewerWidget
::
setConnections
()
{
connect
(
m_dataEngine
,
&
GeometryEngine
::
requestResetView
,
this
,
&
OglViewerWidget
::
resetView
);
connect
(
parentWidget
(),
SIGNAL
(
loadFile
(
QString
)),
m_dataEngine
,
SLOT
(
loadFile
(
QString
)));
connect
(
this
,
SIGNAL
(
loadFile
(
QString
)),
m_dataEngine
,
SLOT
(
loadFile
(
QString
)));
connect
(
m_dataEngine
,
SIGNAL
(
requestUpdate
()),
this
,
SLOT
(
update
()));
connect
(
m_dataEngine
,
SIGNAL
(
sendFileInfo
(
QString
,
QVector
<
Material
>*
,
int
,
int
)),
parentWidget
(),
SLOT
(
setFileInfo
(
QString
,
QVector
<
Material
>*
,
int
,
int
)));
}
void
OglViewerWidget
::
resetView
()
{
m_rotation
=
QQuaternion
();
...
...
@@ -107,7 +100,14 @@ void OglViewerWidget::initializeGL()
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
m_dataEngine
=
new
GeometryEngine
(
this
);
setConnections
();
connect
(
m_dataEngine
,
&
GeometryEngine
::
requestResetView
,
this
,
&
OglViewerWidget
::
resetView
);
connect
(
m_dataEngine
,
&
GeometryEngine
::
requestUpdate
,
this
,
static_cast
<
void
(
OglViewerWidget
::*
)(
void
)
>
(
&
OglViewerWidget
::
update
));
//TODO: better solution
MainWindow
*
parent
=
dynamic_cast
<
MainWindow
*>
(
parentWidget
());
if
(
parent
!=
NULL
)
connect
(
parent
,
&
MainWindow
::
loadFile
,
[
this
](
QString
value
)
{
m_dataEngine
->
loadFile
(
value
);
});
}
void
OglViewerWidget
::
resizeGL
(
int
w
,
int
h
)
...
...
@@ -327,7 +327,7 @@ void OglViewerWidget::dragEnterEvent(QDragEnterEvent *e)
void
OglViewerWidget
::
dropEvent
(
QDropEvent
*
e
)
{
emit
loadFile
(
e
->
mimeData
()
->
urls
().
first
().
toLocalFile
());
m_dataEngine
->
loadFile
(
e
->
mimeData
()
->
urls
().
first
().
toLocalFile
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment