Fix build error on vc2017

master
huxingyi 2018-04-12 01:34:00 -07:00
parent e43fd40888
commit 534c472b53
5 changed files with 19 additions and 11 deletions

View File

@ -36,12 +36,12 @@ void ModelMeshBinder::exportMeshAsObj(const QString &filename)
if (file.open(QIODevice::WriteOnly)) {
QTextStream stream(&file);
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;
}
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";
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 << endl;
@ -107,12 +107,14 @@ void ModelMeshBinder::paint()
if (m_showWireframes) {
if (m_renderEdgeVertexCount > 0) {
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) {
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vaoTriangle);
glDrawArrays(GL_TRIANGLES, 0, m_renderTriangleVertexCount);
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glDrawArrays(GL_TRIANGLES, 0, m_renderTriangleVertexCount);
}
}

View File

@ -68,10 +68,10 @@ QImage ModelOfflineRender::toImage(const QSize &size)
program->setUniformValue(program->lightPosLoc(), QVector3D(0, 0, 70));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_LINE_SMOOTH);
m_context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_context->functions()->glEnable(GL_DEPTH_TEST);
m_context->functions()->glEnable(GL_CULL_FACE);
m_context->functions()->glEnable(GL_LINE_SMOOTH);
camera.setToIdentity();
camera.translate(0, 0, -2.1);

View File

@ -9,7 +9,7 @@
// 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)
: QOpenGLWidget(parent),

View File

@ -13,6 +13,7 @@
#include "skeletondocument.h"
#include "turnaroundloader.h"
#include "theme.h"
#include "util.h"
class SkeletonGraphicsSelectionItem : public QGraphicsRectItem
{

View File

@ -2,6 +2,11 @@
#define UTIL_H
#include <QString>
#include <map>
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
QString valueOfKeyInMapOrEmpty(const std::map<QString, QString> &map, const QString &key);
bool isTrueValueString(const QString &str);