Fix build error on vc2017
parent
e43fd40888
commit
534c472b53
|
@ -36,12 +36,12 @@ void ModelMeshBinder::exportMeshAsObj(const QString &filename)
|
||||||
if (file.open(QIODevice::WriteOnly)) {
|
if (file.open(QIODevice::WriteOnly)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
stream << "# " << Ds3FileReader::m_applicationName << endl;
|
stream << "# " << Ds3FileReader::m_applicationName << endl;
|
||||||
for (std::vector<const QVector3D>::iterator it = m_mesh->vertices().begin() ; it != m_mesh->vertices().end(); ++it) {
|
for (std::vector<QVector3D>::const_iterator it = m_mesh->vertices().begin() ; it != m_mesh->vertices().end(); ++it) {
|
||||||
stream << "v " << (*it).x() << " " << (*it).y() << " " << (*it).z() << endl;
|
stream << "v " << (*it).x() << " " << (*it).y() << " " << (*it).z() << endl;
|
||||||
}
|
}
|
||||||
for (std::vector<const std::vector<int>>::iterator it = m_mesh->faces().begin() ; it != m_mesh->faces().end(); ++it) {
|
for (std::vector<std::vector<int>>::const_iterator it = m_mesh->faces().begin() ; it != m_mesh->faces().end(); ++it) {
|
||||||
stream << "f";
|
stream << "f";
|
||||||
for (std::vector<const int>::iterator subIt = (*it).begin() ; subIt != (*it).end(); ++subIt) {
|
for (std::vector<int>::const_iterator subIt = (*it).begin() ; subIt != (*it).end(); ++subIt) {
|
||||||
stream << " " << (1 + *subIt);
|
stream << " " << (1 + *subIt);
|
||||||
}
|
}
|
||||||
stream << endl;
|
stream << endl;
|
||||||
|
@ -107,12 +107,14 @@ void ModelMeshBinder::paint()
|
||||||
if (m_showWireframes) {
|
if (m_showWireframes) {
|
||||||
if (m_renderEdgeVertexCount > 0) {
|
if (m_renderEdgeVertexCount > 0) {
|
||||||
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vaoEdge);
|
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vaoEdge);
|
||||||
glDrawArrays(GL_LINES, 0, m_renderEdgeVertexCount);
|
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
|
||||||
|
f->glDrawArrays(GL_LINES, 0, m_renderEdgeVertexCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_renderTriangleVertexCount > 0) {
|
if (m_renderTriangleVertexCount > 0) {
|
||||||
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vaoTriangle);
|
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vaoTriangle);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, m_renderTriangleVertexCount);
|
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
|
||||||
|
f->glDrawArrays(GL_TRIANGLES, 0, m_renderTriangleVertexCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,10 @@ QImage ModelOfflineRender::toImage(const QSize &size)
|
||||||
|
|
||||||
program->setUniformValue(program->lightPosLoc(), QVector3D(0, 0, 70));
|
program->setUniformValue(program->lightPosLoc(), QVector3D(0, 0, 70));
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
m_context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glEnable(GL_DEPTH_TEST);
|
m_context->functions()->glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_CULL_FACE);
|
m_context->functions()->glEnable(GL_CULL_FACE);
|
||||||
glEnable(GL_LINE_SMOOTH);
|
m_context->functions()->glEnable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
camera.setToIdentity();
|
camera.setToIdentity();
|
||||||
camera.translate(0, 0, -2.1);
|
camera.translate(0, 0, -2.1);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
// Modifed from http://doc.qt.io/qt-5/qtopengl-hellogl2-glwidget-cpp.html
|
// Modifed from http://doc.qt.io/qt-5/qtopengl-hellogl2-glwidget-cpp.html
|
||||||
|
|
||||||
bool ModelWidget::m_transparent = true;
|
bool ModelWidget::m_transparent = false;
|
||||||
|
|
||||||
ModelWidget::ModelWidget(QWidget *parent)
|
ModelWidget::ModelWidget(QWidget *parent)
|
||||||
: QOpenGLWidget(parent),
|
: QOpenGLWidget(parent),
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "skeletondocument.h"
|
#include "skeletondocument.h"
|
||||||
#include "turnaroundloader.h"
|
#include "turnaroundloader.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
class SkeletonGraphicsSelectionItem : public QGraphicsRectItem
|
class SkeletonGraphicsSelectionItem : public QGraphicsRectItem
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
QString valueOfKeyInMapOrEmpty(const std::map<QString, QString> &map, const QString &key);
|
QString valueOfKeyInMapOrEmpty(const std::map<QString, QString> &map, const QString &key);
|
||||||
bool isTrueValueString(const QString &str);
|
bool isTrueValueString(const QString &str);
|
||||||
|
|
Loading…
Reference in New Issue