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
96b7d6f7
Commit
96b7d6f7
authored
Jan 28, 2017
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text in FileInfoWindow can be marked and copied,
code cleaning
parent
121f5c47
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
433 additions
and
423 deletions
+433
-423
QtMeshViewer/Form Files/FileInfoWindow.ui
QtMeshViewer/Form Files/FileInfoWindow.ui
+3
-0
QtMeshViewer/Header/FileInfoWindow.h
QtMeshViewer/Header/FileInfoWindow.h
+12
-5
QtMeshViewer/Header/FileInterface.h
QtMeshViewer/Header/FileInterface.h
+3
-7
QtMeshViewer/Header/GeometryEngine.h
QtMeshViewer/Header/GeometryEngine.h
+13
-5
QtMeshViewer/Header/MainWindow.h
QtMeshViewer/Header/MainWindow.h
+13
-9
QtMeshViewer/Header/OglViewerWidget.h
QtMeshViewer/Header/OglViewerWidget.h
+39
-41
QtMeshViewer/Header/SettingsWindow.h
QtMeshViewer/Header/SettingsWindow.h
+1
-0
QtMeshViewer/Header/tga.h
QtMeshViewer/Header/tga.h
+3
-4
QtMeshViewer/Resources/StyleSheet.txt
QtMeshViewer/Resources/StyleSheet.txt
+6
-0
QtMeshViewer/Source/FileInfoWindow.cpp
QtMeshViewer/Source/FileInfoWindow.cpp
+0
-29
QtMeshViewer/Source/GeometryEngine.cpp
QtMeshViewer/Source/GeometryEngine.cpp
+90
-92
QtMeshViewer/Source/MainWindow.cpp
QtMeshViewer/Source/MainWindow.cpp
+89
-73
QtMeshViewer/Source/OglViewerWidget.cpp
QtMeshViewer/Source/OglViewerWidget.cpp
+151
-153
QtMeshViewer/Source/SettingsWindow.cpp
QtMeshViewer/Source/SettingsWindow.cpp
+10
-3
QtMeshViewer/main.cpp
QtMeshViewer/main.cpp
+0
-2
No files found.
QtMeshViewer/Form Files/FileInfoWindow.ui
View file @
96b7d6f7
...
...
@@ -47,6 +47,9 @@ Triangles: -</string>
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
</set>
</property>
<property
name=
"textInteractionFlags"
>
<set>
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
</set>
</property>
</widget>
</item>
</layout>
...
...
QtMeshViewer/Header/FileInfoWindow.h
View file @
96b7d6f7
#pragma once
#include <QWidget>
#include <QString>
#include "ui_FileInfoWindow.h"
class
FileInfoWindow
:
public
QWidget
...
...
@@ -8,13 +7,21 @@ class FileInfoWindow : public QWidget
Q_OBJECT
public:
FileInfoWindow
(
QWidget
*
parent
=
Q_NULLPTR
);
~
FileInfoWindow
();
FileInfoWindow
(
QWidget
*
parent
=
Q_NULLPTR
)
:
QWidget
(
parent
)
,
ui
(
new
Ui
::
FileInfoWindow
)
{
ui
->
setupUi
(
this
);
setWindowFlags
(
Qt
::
Tool
|
Qt
::
NoDropShadowWindowHint
);
ui
->
scrollArea
->
widget
()
->
setStyleSheet
(
"background-color: #ffffff"
);
};
~
FileInfoWindow
()
{
delete
ui
;
};
private:
Ui
::
FileInfoWindow
*
ui
;
public:
void
setBasicText
(
QString
text
);
void
setDetailText
(
QString
text
);
void
setBasicText
(
QString
text
)
{
ui
->
basic
->
setText
(
text
);
}
;
void
setDetailText
(
QString
text
)
{
ui
->
detail
->
setText
(
text
);
}
;
};
\ No newline at end of file
QtMeshViewer/Header/FileInterface.h
View file @
96b7d6f7
#pragma once
#include <QObject>
#include <QOpenGlTexture>
#include <fstream>
#include <QVector>
#include <QVector2D>
#include <QVector3D>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QOpenGLFunctions>
#include <QOpenGlTexture>
#include <QObject>
#include <QOpenGLTexture>
#include <QRegExp>
#include <..\Header\MainWindow.h>
#include "MainWindow.h"
struct
BoundingBox
{
QQuaternion
rotation
;
...
...
QtMeshViewer/Header/GeometryEngine.h
View file @
96b7d6f7
#pragma once
#include "..\Header\FileInterface.h"
#include <QObject>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
#include <QOpenGLTexture>
#include <QVector>
#include "FileInterface.h"
struct
DrawInformation
{
unsigned
int
offset
;
...
...
@@ -22,20 +22,28 @@ public:
GeometryEngine
(
QObject
*
parent
=
Q_NULLPTR
);
virtual
~
GeometryEngine
();
// attributes
private:
QOpenGLBuffer
m_arrayBuf
;
QOpenGLBuffer
m_indexBuf
;
QVector
<
Material
>*
m_materials
=
Q_NULLPTR
;
QVector
<
DrawInformation
>
m_drawList
;
BoundingBox
m_boundings
;
Material
*
m_defaultMaterial
;
BoundingBox
m_boundings
;
QVector
<
DrawInformation
>
m_drawList
;
// functions
private:
void
clearData
();
public:
void
drawGeometry
(
QOpenGLShaderProgram
*
program
,
bool
wireframe
);
// slots
public
slots
:
void
loadFile
(
QString
filePath
);
void
drawGeometry
(
QOpenGLShaderProgram
*
program
,
bool
wireframe
);
// signals
signals:
void
requestResetView
();
void
sendMessage
(
QString
message
,
int
severity
);
...
...
QtMeshViewer/Header/MainWindow.h
View file @
96b7d6f7
#pragma once
#include <QtWidgets/QMainWindow>
#include <qwidget.h>
#include <QWidget>
#include "ui_MainWindow.h"
#include "FileInfoWindow.h"
#include <QByteArray>
#include <QStringList>
#include <QLabel>
#include "ui_MainWindow.h"
#include "..\Header\FileInfoWindow.h"
struct
Material
;
...
...
@@ -18,27 +17,32 @@ public:
MainWindow
(
QWidget
*
parent
=
Q_NULLPTR
);
~
MainWindow
();
// attributes
private:
Ui
::
MainWindowClass
*
ui
;
int
m_curSeverity
;
void
setupWidgets
();
QByteArray
m_fileInfo
;
QLabel
*
m_output
;
int
m_curSeverity
;
FileInfoWindow
*
m_infoWindow
;
// functions
private:
void
setupWidgets
();
void
openFile
();
void
aboutFile
();
void
aboutTool
();
void
takeScreenShot
();
void
aboutTool
();
protected:
virtual
void
resizeEvent
(
QResizeEvent
*
e
)
Q_DECL_OVERRIDE
;
// slots
public
slots
:
void
printMessage
(
QString
message
,
int
severity
);
void
setFileInfo
(
QString
name
,
QVector
<
Material
>*
materials
,
int
vertices
,
int
triangle
);
// signals
signals:
void
loadFile
(
QString
);
};
QtMeshViewer/Header/OglViewerWidget.h
View file @
96b7d6f7
#pragma once
#include "geometryengine.h"
#include "..\Header\SettingsWindow.h"
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QVector2D>
#include <QBasicTimer>
#include <QOpenGLShaderProgram>
#include <QMatrix4x4>
#include "GeometryEngine.h"
#include "SettingsWindow.h"
class
GeometryEngine
;
...
...
@@ -21,21 +17,16 @@ public:
explicit
OglViewerWidget
(
QWidget
*
parent
=
0
);
~
OglViewerWidget
();
signals:
void
loadFile
(
QString
);
// attributes
private:
struct
{
bool
left
=
false
;
bool
right
=
false
;
QVector2D
position
;
}
m_mouse
;
QOpenGLShaderProgram
m_program
;
GeometryEngine
*
m_dataEngine
;
struct
{
bool
x
=
true
;
bool
y
=
true
;
bool
z
=
tru
e
;
}
m_rotDirections
;
QVector4D
m_backgroundColorOn
=
{
0.02
f
,
0.02
f
,
0.02
f
,
1.0
f
};
QVector4D
m_backgroundColorOff
=
{
0.5
f
,
0.8
f
,
1.0
f
,
1.0
f
}
;
bool
m_wireframe
=
fals
e
;
bool
m_lightOn
=
false
;
struct
{
QVector4D
position
=
{
1
,
1
,
1
,
0
};
...
...
@@ -46,44 +37,49 @@ private:
SettingsWindow
*
m_settings
;
QVector4D
m_backgroundColorOn
=
{
0.02
f
,
0.02
f
,
0.02
f
,
1.0
f
};
QVector4D
m_backgroundColorOff
=
{
0.5
f
,
0.8
f
,
1.0
f
,
1.0
f
};
struct
{
bool
left
=
false
;
bool
right
=
false
;
QVector2D
position
;
}
m_mouse
;
QOpenGLShaderProgram
m_program
;
GeometryEngine
*
m_dataEngine
;
struct
{
bool
x
=
true
;
bool
y
=
true
;
bool
z
=
true
;
}
m_rotDirections
;
QMatrix4x4
m_projection
;
QVector3D
m_translation
;
QQuaternion
m_rotation
;
bool
m_wireframe
=
false
;
bool
m_lightOn
=
false
;
double
m_zSpeed
=
1.0
;
// functions
private:
void
initShaders
();
void
setConnections
();
void
resetView
();
void
updateLightPosition
();
protected:
void
initializeGL
()
Q_DECL_OVERRIDE
;
void
resizeGL
(
int
w
,
int
h
)
Q_DECL_OVERRIDE
;
void
paintGL
()
Q_DECL_OVERRIDE
;
void
mousePressEvent
(
QMouseEvent
*
e
)
Q_DECL_OVERRIDE
;
void
mouseReleaseEvent
(
QMouseEvent
*
e
)
Q_DECL_OVERRIDE
;
void
mouseMoveEvent
(
QMouseEvent
*
e
)
Q_DECL_OVERRIDE
;
void
wheelEvent
(
QWheelEvent
*
e
)
Q_DECL_OVERRIDE
;
void
dragEnterEvent
(
QDragEnterEvent
*
e
)
Q_DECL_OVERRIDE
;
void
dropEvent
(
QDropEvent
*
event
)
Q_DECL_OVERRIDE
;
void
keyPressEvent
(
QKeyEvent
*
e
)
Q_DECL_OVERRIDE
;
void
initializeGL
()
Q_DECL_OVERRIDE
;
void
resizeGL
(
int
w
,
int
h
)
Q_DECL_OVERRIDE
;
void
paintGL
()
Q_DECL_OVERRIDE
;
private:
void
initShaders
();
void
setConnections
();
void
updateLightPosition
();
private
slots
:
void
resetView
();
void
dragEnterEvent
(
QDragEnterEvent
*
e
)
Q_DECL_OVERRIDE
;
void
dropEvent
(
QDropEvent
*
event
)
Q_DECL_OVERRIDE
;
// slots
public
slots
:
void
changeDirection
(
int
direction
);
void
toggleAxis
(
int
axis
);
void
toggleWireframe
();
void
toggleLight
();
void
showSettings
();
...
...
@@ -93,7 +89,9 @@ public slots:
void
setAttFac
(
double
value
);
void
setAmbCoef
(
double
value
);
// signals
signals:
void
sendMessage
(
QString
message
,
int
severity
);
void
loadFile
(
QString
);
};
QtMeshViewer/Header/SettingsWindow.h
View file @
96b7d6f7
...
...
@@ -3,6 +3,7 @@
#include "ui_SettingsWindow.h"
#include <QVector3D>
class
SettingsWindow
:
public
QWidget
{
Q_OBJECT
...
...
QtMeshViewer/Header/tga.h
View file @
96b7d6f7
...
...
@@ -3,7 +3,6 @@
#include <QImage>
#include <QColor>
#include <iostream>
QImage
loadTga
(
QString
filePath
,
bool
&
success
)
{
...
...
@@ -67,7 +66,7 @@ QImage loadTga(QString filePath, bool &success)
int
valb
=
vui8Pixels
.
at
(
y
*
ui32Width
*
ui32BpP
/
8
+
x
*
ui32BpP
/
8
);
QColor
value
(
valr
,
valg
,
valb
);
img
.
setPixel
Color
(
x
,
ui32Width
-
1
-
y
,
value
);
img
.
setPixel
(
x
,
ui32Width
-
1
-
y
,
value
.
rgba
()
);
}
}
}
...
...
@@ -97,7 +96,7 @@ QImage loadTga(QString filePath, bool &success)
else
color
.
setRgb
(
qRgb
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
]));
img
.
setPixel
Color
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
);
img
.
setPixel
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
.
rgba
()
);
tmp_pixelIndex
++
;
}
}
...
...
@@ -117,7 +116,7 @@ QImage loadTga(QString filePath, bool &success)
else
color
.
setRgb
(
qRgb
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
]));
img
.
setPixel
Color
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
);
img
.
setPixel
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
.
rgba
()
);
tmp_pixelIndex
++
;
}
}
...
...
QtMeshViewer/Resources/StyleSheet.txt
View file @
96b7d6f7
QLabel#output {
color : white;
min-width: 400px;
min-height: 50px;
}
QToolButton {
image: url(:/images/toolbar/placeholder.png);
border-style: none;
...
...
QtMeshViewer/Source/FileInfoWindow.cpp
deleted
100644 → 0
View file @
121f5c47
#include "..\Header\FileInfoWindow.h"
#include <QIcon>
FileInfoWindow
::
FileInfoWindow
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
ui
(
new
Ui
::
FileInfoWindow
)
{
ui
->
setupUi
(
this
);
setWindowFlags
(
Qt
::
Tool
|
Qt
::
NoDropShadowWindowHint
);
ui
->
scrollArea
->
widget
()
->
setStyleSheet
(
"background-color: #ffffff"
);
}
FileInfoWindow
::~
FileInfoWindow
()
{
delete
ui
;
}
void
FileInfoWindow
::
setBasicText
(
QString
text
)
{
ui
->
basic
->
setText
(
text
);
}
void
FileInfoWindow
::
setDetailText
(
QString
text
)
{
ui
->
detail
->
setText
(
text
);
}
QtMeshViewer/Source/GeometryEngine.cpp
View file @
96b7d6f7
...
...
@@ -2,20 +2,18 @@
#include "..\Header\MshFile.h"
#include "..\Header\OglViewerWidget.h"
#include "..\Header\MainWindow.h"
#include <cmath>
#include <QRegExp>
/////////////////////////////////////////////////////////////////////////
//
public
constructor/destructor
// constructor/destructor
GeometryEngine
::
GeometryEngine
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_indexBuf
(
QOpenGLBuffer
::
IndexBuffer
)
,
m_defaultMaterial
(
FileInterface
::
getDefaultMaterial
())
{
initializeOpenGLFunctions
();
m_defaultMaterial
=
FileInterface
::
getDefaultMaterial
();
}
GeometryEngine
::~
GeometryEngine
()
...
...
@@ -27,7 +25,7 @@ GeometryEngine::~GeometryEngine()
/////////////////////////////////////////////////////////////////////////
//
private
functions
// functions
void
GeometryEngine
::
clearData
()
{
...
...
@@ -52,94 +50,12 @@ void GeometryEngine::clearData()
m_drawList
.
clear
();
}
/////////////////////////////////////////////////////////////////////////
// public slots
void
GeometryEngine
::
loadFile
(
QString
filePath
)
{
// cleanup old stuff and recreate buffers
clearData
();
m_arrayBuf
.
create
();
m_indexBuf
.
create
();
//reset view
emit
requestResetView
();
emit
sendMessage
(
"loading file.."
,
0
);
try
{
QVector
<
Model
*>*
models
;
QVector
<
VertexData
>
vertexData
;
QVector
<
GLuint
>
indexData
;
// open file and get the information
MshFile
file
(
filePath
,
this
);
models
=
file
.
getModels
();
m_materials
=
file
.
getMaterials
();
m_boundings
=
file
.
getBoundingBox
();
// collect data
unsigned
int
indexOffset
(
0
);
unsigned
int
vertexOffset
(
0
);
for
(
auto
&
modelIterator
:
*
models
)
{
for
(
auto
&
segmentIterator
:
modelIterator
->
segmList
)
{
// get draw information
DrawInformation
new_info
;
new_info
.
offset
=
indexOffset
;
new_info
.
size
=
segmentIterator
->
indices
.
size
();
new_info
.
textureIndex
=
segmentIterator
->
textureIndex
;
new_info
.
modelMatrix
=
modelIterator
->
m4x4Translation
;
new_info
.
modelMatrix
.
rotate
(
modelIterator
->
quadRotation
);
// add offset to indices, no need to do it for the first one (maybe it's very big)
if
(
vertexOffset
!=
0
)
for
(
auto
&
it
:
segmentIterator
->
indices
)
it
+=
vertexOffset
;
// save data
vertexData
+=
segmentIterator
->
vertices
;
indexData
+=
segmentIterator
->
indices
;
if
(
segmentIterator
->
textureIndex
<
(
unsigned
)
m_materials
->
size
()
&&
m_materials
->
at
(
segmentIterator
->
textureIndex
).
transparent
)
m_drawList
.
push_back
(
new_info
);
else
m_drawList
.
push_front
(
new_info
);
// update offset
indexOffset
+=
new_info
.
size
;
vertexOffset
+=
segmentIterator
->
vertices
.
size
();
}
}
// Transfer vertex data to VBO 0
m_arrayBuf
.
bind
();
m_arrayBuf
.
allocate
(
vertexData
.
data
(),
vertexData
.
size
()
*
sizeof
(
VertexData
));
// Transfer index data to VBO 1
m_indexBuf
.
bind
();
m_indexBuf
.
allocate
(
indexData
.
data
(),
indexData
.
size
()
*
sizeof
(
GLuint
));
emit
requestUpdate
();
emit
sendMessage
(
"done.."
,
0
);
emit
sendFileInfo
(
filePath
.
right
(
filePath
.
size
()
-
filePath
.
lastIndexOf
(
QRegExp
(
"/|
\\\\
"
))
-
1
),
m_materials
,
vertexData
.
size
(),
indexData
.
size
()
/
3
);
}
catch
(
std
::
invalid_argument
e
)
{
clearData
();
emit
sendMessage
(
QString
(
e
.
what
()),
2
);
}
}
void
GeometryEngine
::
drawGeometry
(
QOpenGLShaderProgram
*
program
,
bool
wireframe
)
{
if
(
!
m_arrayBuf
.
isCreated
()
||
!
m_indexBuf
.
isCreated
())
return
;
// Setup
// Setup
// Tell OpenGL which VBOs to use
m_arrayBuf
.
bind
();
m_indexBuf
.
bind
();
...
...
@@ -178,7 +94,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
program
->
enableAttributeArray
(
normLocation
);
program
->
setAttributeBuffer
(
normLocation
,
GL_FLOAT
,
offset
,
3
,
sizeof
(
VertexData
));
// Paint
// Paint
for
(
auto
&
it
:
m_drawList
)
{
...
...
@@ -188,7 +104,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
QVector3D
specularColor
;
// bind the correct texture
if
(
it
.
textureIndex
<
(
unsigned
)
m_materials
->
size
()
&&
m_materials
->
at
(
it
.
textureIndex
).
texture0
!=
Q_NULLPTR
)
if
(
it
.
textureIndex
<
(
unsigned
)
m_materials
->
size
()
&&
m_materials
->
at
(
it
.
textureIndex
).
texture0
!=
Q_NULLPTR
)
{
m_materials
->
at
(
it
.
textureIndex
).
texture0
->
bind
();
tmp_transparent
=
m_materials
->
at
(
it
.
textureIndex
).
transparent
;
...
...
@@ -216,12 +132,94 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
program
->
setUniformValue
(
"materialSpecularColor"
,
specularColor
);
// Draw cube geometry using indices from VBO 1
if
(
wireframe
)
if
(
wireframe
)
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
glDrawElements
(
GL_TRIANGLES
,
it
.
size
,
GL_UNSIGNED_INT
,
(
void
*
)(
it
.
offset
*
sizeof
(
GLuint
)));
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
}
}
/////////////////////////////////////////////////////////////////////////
// slots
void
GeometryEngine
::
loadFile
(
QString
filePath
)
{
// cleanup old stuff and recreate buffers
clearData
();
m_arrayBuf
.
create
();
m_indexBuf
.
create
();
//reset view
emit
requestResetView
();
emit
sendMessage
(
"loading file.."
,
0
);
try
{
QVector
<
Model
*>*
models
;
QVector
<
VertexData
>
vertexData
;
QVector
<
GLuint
>
indexData
;
// open file and get the information
MshFile
file
(
filePath
,
this
);
models
=
file
.
getModels
();
m_materials
=
file
.
getMaterials
();
m_boundings
=
file
.
getBoundingBox
();
// collect data
unsigned
int
indexOffset
(
0
);
unsigned
int
vertexOffset
(
0
);
for
(
auto
&
modelIterator
:
*
models
)
{
for
(
auto
&
segmentIterator
:
modelIterator
->
segmList
)
{
// get draw information
DrawInformation
new_info
;
new_info
.
offset
=
indexOffset
;
new_info
.
size
=
segmentIterator
->
indices
.
size
();
new_info
.
textureIndex
=
segmentIterator
->
textureIndex
;
new_info
.
modelMatrix
=
modelIterator
->
m4x4Translation
;
new_info
.
modelMatrix
.
rotate
(
modelIterator
->
quadRotation
);
// add offset to indices, no need to do it for the first one (maybe it's very big)
if
(
vertexOffset
!=
0
)
for
(
auto
&
it
:
segmentIterator
->
indices
)
it
+=
vertexOffset
;
// save data
vertexData
+=
segmentIterator
->
vertices
;
indexData
+=
segmentIterator
->
indices
;
if
(
segmentIterator
->
textureIndex
<
(
unsigned
)
m_materials
->
size
()
&&
m_materials
->
at
(
segmentIterator
->
textureIndex
).
transparent
)
m_drawList
.
push_back
(
new_info
);
else
m_drawList
.
push_front
(
new_info
);
// update offset
indexOffset
+=
new_info
.
size
;
vertexOffset
+=
segmentIterator
->
vertices
.
size
();
}
}
// Transfer vertex data to VBO 0
m_arrayBuf
.
bind
();
m_arrayBuf
.
allocate
(
vertexData
.
data
(),
vertexData
.
size
()
*
sizeof
(
VertexData
));
// Transfer index data to VBO 1
m_indexBuf
.
bind
();
m_indexBuf
.
allocate
(
indexData
.
data
(),
indexData
.
size
()
*
sizeof
(
GLuint
));
emit
requestUpdate
();
emit
sendMessage
(
"done.."
,
0
);
emit
sendFileInfo
(
filePath
.
right
(
filePath
.
size
()
-
filePath
.
lastIndexOf
(
QRegExp
(
"/|
\\\\
"
))
-
1
),
m_materials
,
vertexData
.
size
(),
indexData
.
size
()
/
3
);
}
catch
(
std
::
invalid_argument
e
)
{
clearData
();
emit
sendMessage
(
QString
(
e
.
what
()),
2
);
}
}
QtMeshViewer/Source/MainWindow.cpp
View file @
96b7d6f7
#include "..\Header\MainWindow.h"
#include "..\Header\OglViewerWidget.h"
#include "..\Header\FileInterface.h"
#include <QSurfaceFormat>
#include <QMessageBox>
#include <QFileDialog>
#include <QPalette>
#include <QAction>
#include <QSignalMapper>
#include <QToolButton>
#include <QFile>
#include <QSizePolicy>
#include <QFont>
#include <QFileDialog>
#include <QMessageBox>
#include <QPalette>
#include <QResizeEvent>
#include <QToolButton>
#include "..\Header\FileInterface.h"
#define WINDOW_NAME "Mesh Viewer"