This commit is contained in:
Turingon 2024-06-11 13:02:20 +02:00
parent 1e81615e73
commit b9a6c6c41f
32 changed files with 442 additions and 83 deletions

View file

@ -23,3 +23,4 @@ QMAKE_CXX.LIBDIRS = \
/lib
QMAKE_LICHECK_TIMESTAMP = "Thu May 16"
QMAKE_LICHECK_TIMESTAMP = "Sat May 18"
QMAKE_LICHECK_TIMESTAMP = "Fri May 31"

View file

@ -76,8 +76,10 @@ OBJECTS = cartesiangridtohorizontalslicefilter.o \
moc_mainwindow.o \
moc_opengldisplaywidget.o
DIST = lines_fshader.glsl \
lines_fshader_contour.glsl \
lines_fshader_texture.glsl \
lines_vshader.glsl \
lines_vshader_contour.glsl \
lines_vshader_texture.glsl \
uhhlogo.png \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/mkspecs/features/spec_pre.prf \
@ -1043,7 +1045,11 @@ moc_opengldisplaywidget.cpp: opengldisplaywidget.h \
horizontalslicetoimagemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QImage \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QString \
horizontalslicetocontourlinemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QVector3D \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QVector \
horizontalslicerenderer.h \
horizontalcontourlinesrenderer.h \
moc_predefs.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/bin/moc
/home/luxdragon/Qt5.15/5.15.13/gcc_64/bin/moc $(DEFINES) --include /home/luxdragon/Documents/Uni/DV/Tornado-Visualization/datenvisualisierung_sose2024/moc_predefs.h -I/home/luxdragon/Qt5.15/5.15.13/gcc_64/mkspecs/linux-g++ -I/home/luxdragon/Documents/Uni/DV/Tornado-Visualization/datenvisualisierung_sose2024 -I/home/luxdragon/Qt5.15/5.15.13/gcc_64/include -I/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtWidgets -I/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui -I/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore -I/usr/include/c++/11 -I/usr/include/x86_64-linux-gnu/c++/11 -I/usr/include/c++/11/backward -I/usr/lib/gcc/x86_64-linux-gnu/11/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include opengldisplaywidget.h -o moc_opengldisplaywidget.cpp
@ -1071,7 +1077,105 @@ flowdatasource.o: flowdatasource.cpp flowdatasource.h \
tornadoSrc.c
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o flowdatasource.o flowdatasource.cpp
horizontalcontourlinesrenderer.o: horizontalcontourlinesrenderer.cpp horizontalcontourlinesrenderer.h
horizontalcontourlinesrenderer.o: horizontalcontourlinesrenderer.cpp horizontalcontourlinesrenderer.h \
horizontalslicetocontourlinemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QVector3D \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qvector3d.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qtguiglobal.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qglobal.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qconfig-bootstrapped.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qconfig.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qtcore-config.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsystemdetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qprocessordetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcompilerdetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qtypeinfo.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsysinfo.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qlogging.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qflags.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qbasicatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_bootstrap.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qgenericatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_cxx11.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_msvc.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qglobalstatic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmutex.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qnumeric.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qversiontagging.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qtgui-config.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qpoint.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qnamespace.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmetatype.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qbytearray.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qrefcount.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qarraydata.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qvarlengtharray.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcontainerfwd.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qalgorithms.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcontainertools_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qhashfunctions.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstring.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qchar.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringliteral.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringalgorithms.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringview.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringbuilder.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qpair.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobjectdefs.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobjectdefs_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QVector \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qvector.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qiterator.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLShaderProgram \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglshaderprogram.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopengl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qt_windows.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopengles2ext.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglext.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qvector2d.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qvector4d.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qmatrix4x4.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qquaternion.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qgenericmatrix.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qdebug.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qhash.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qlist.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qbytearraylist.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringlist.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qregexp.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringmatcher.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmap.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qtextstream.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qiodevice.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobject.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcoreevent.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qscopedpointer.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobject_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qlocale.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qvariant.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qshareddata.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qset.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcontiguouscache.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsharedpointer.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsharedpointer_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qdatastream.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qrect.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmargins.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsize.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLBuffer \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglbuffer.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLVertexArrayObject \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglvertexarrayobject.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QObject \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLFunctions \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglfunctions.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglcontext.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QScopedPointer \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QSurfaceFormat \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qsurfaceformat.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopenglversionfunctions.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLContext
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o horizontalcontourlinesrenderer.o horizontalcontourlinesrenderer.cpp
horizontalslicerenderer.o: horizontalslicerenderer.cpp horizontalslicerenderer.h \
@ -1190,7 +1294,55 @@ horizontalslicerenderer.o: horizontalslicerenderer.cpp horizontalslicerenderer.h
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qopengltexture.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o horizontalslicerenderer.o horizontalslicerenderer.cpp
horizontalslicetocontourlinemapper.o: horizontalslicetocontourlinemapper.cpp horizontalslicetocontourlinemapper.h
horizontalslicetocontourlinemapper.o: horizontalslicetocontourlinemapper.cpp horizontalslicetocontourlinemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QVector3D \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qvector3d.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qtguiglobal.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qglobal.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qconfig-bootstrapped.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qconfig.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qtcore-config.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsystemdetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qprocessordetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcompilerdetection.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qtypeinfo.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qsysinfo.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qlogging.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qflags.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qbasicatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_bootstrap.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qgenericatomic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_cxx11.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qatomic_msvc.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qglobalstatic.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmutex.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qnumeric.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qversiontagging.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/qtgui-config.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qpoint.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qnamespace.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qmetatype.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qbytearray.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qrefcount.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qarraydata.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qvarlengtharray.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcontainerfwd.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qalgorithms.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qcontainertools_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qhashfunctions.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstring.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qchar.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringliteral.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringalgorithms.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringview.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qstringbuilder.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qpair.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobjectdefs.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qobjectdefs_impl.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QVector \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qvector.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/qiterator.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o horizontalslicetocontourlinemapper.o horizontalslicetocontourlinemapper.cpp
horizontalslicetoimagemapper.o: horizontalslicetoimagemapper.cpp horizontalslicetoimagemapper.h \
@ -1523,7 +1675,11 @@ mainwindow.o: mainwindow.cpp mainwindow.h \
horizontalslicetoimagemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QImage \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QString \
horizontalslicerenderer.h
horizontalslicetocontourlinemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QVector3D \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QVector \
horizontalslicerenderer.h \
horizontalcontourlinesrenderer.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
opengldisplaywidget.o: opengldisplaywidget.cpp opengldisplaywidget.h \
@ -1656,7 +1812,11 @@ opengldisplaywidget.o: opengldisplaywidget.cpp opengldisplaywidget.h \
horizontalslicetoimagemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QImage \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QString \
horizontalslicetocontourlinemapper.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QVector3D \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtCore/QVector \
horizontalslicerenderer.h \
horizontalcontourlinesrenderer.h \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QMouseEvent \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QKeyEvent \
/home/luxdragon/Qt5.15/5.15.13/gcc_64/include/QtGui/QOpenGLFunctions \

View file

@ -49,7 +49,9 @@ HEADERS += \
DISTFILES += \
lines_fshader.glsl \
lines_fshader_contour.glsl \
lines_fshader_texture.glsl \
lines_vshader.glsl \
lines_vshader_contour.glsl \
lines_vshader_texture.glsl \
uhhlogo.png

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 9.0.2, 2024-05-18T21:04:50. -->
<!-- Written by QtCreator 9.0.2, 2024-06-06T23:39:16. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View file

@ -1,6 +1,106 @@
#include "horizontalcontourlinesrenderer.h"
#include <QOpenGLFunctions>
#include <QOpenGLContext>
#include <iostream>
HorizontalContourLinesRenderer::HorizontalContourLinesRenderer()
: vertexBuffer(QOpenGLBuffer::VertexBuffer)
{
initOpenGLShaders();
initContours();
std::cout << "CONTOUR MAPPER RENDERER CALLED";
}
HorizontalContourLinesRenderer::~HorizontalContourLinesRenderer()
{
vertexBuffer.destroy();
std::cout << "CONTOUR RENDERER DESTRUCTOR CALLED\n";
}
void HorizontalContourLinesRenderer::setContourMapper(HorizontalSliceToContourLineMapper* mappery) {
mapper = mappery;
}
void HorizontalContourLinesRenderer::initOpenGLShaders()
{
// For the contours
if (!shaderProgram.addShaderFromSourceFile(QOpenGLShader::Vertex,
"lines_vshader_contour.glsl"))
{
std::cout << "Vertex shader error:\n"
<< shaderProgram.log().toStdString() << "\n" << std::flush;
return;
}
if (!shaderProgram.addShaderFromSourceFile(QOpenGLShader::Fragment,
"lines_fshader_contour.glsl"))
{
std::cout << "Fragment shader error:\n"
<< shaderProgram.log().toStdString() << "\n" << std::flush;
return;
}
if (!shaderProgram.link())
{
std::cout << "Shader link error:\n"
<< shaderProgram.log().toStdString() << "\n" << std::flush;
return;
}
}
void HorizontalContourLinesRenderer::initContours()
{
vertexBuffer.create(); // Make sure to destroy it in the destructor!
QOpenGLVertexArrayObject::Binder vaoBinder(&vertexArrayObject);
if (vertexArrayObject.isCreated())
{
vertexBuffer.bind();
shaderProgram.setAttributeBuffer("vertexPosition", GL_FLOAT, 0, 3, sizeof(QVector3D));
shaderProgram.enableAttributeArray("vertexPosition");
vertexBuffer.release();
}
}
void HorizontalContourLinesRenderer::draw(QMatrix4x4 mvpMatrix)
{
QVector<QVector3D> vectors = mapper->mapSliceToContourLineSegments(); //THIS CAUSES THE CRASH
vertexBuffer.bind();
vertexBuffer.allocate(vectors.constData(), vectors.size() * sizeof(QVector3D)); //the .constData() is from a forum post, very strange, idk what it does... hmm but where can we use data()?
vertexBuffer.release();
QOpenGLVertexArrayObject::Binder vaoBinder(&vertexArrayObject);
if (vertexArrayObject.isCreated())
{
vertexBuffer.bind();
shaderProgram.setAttributeBuffer("vertexPosition", GL_FLOAT, 0, 3, sizeof(QVector3D));
shaderProgram.enableAttributeArray("vertexPosition");
vertexBuffer.release();
}
// Tell OpenGL to use the shader program of this class.
shaderProgram.bind();
// Bind the vertex array object that links to the bounding box vertices.
vertexArrayObject.bind();
// Set the model-view-projection matrix as a uniform value.
shaderProgram.setUniformValue("mvpMatrix", mvpMatrix);
// Issue OpenGL draw commands.
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glLineWidth(3);
f->glDrawArrays(GL_LINES, 0, vectors.size()); // GL_LINES verbindet Vektore paarenweise, wahrend GL_LINE_STRIP jeden Vektor mit seinen 2 Nachbarn im Array verbindet
// Release objects until next render cycle.
vertexArrayObject.release();
shaderProgram.release();
}

View file

@ -1,11 +1,24 @@
#ifndef HORIZONTALCONTOURLINESRENDERER_H
#define HORIZONTALCONTOURLINESRENDERER_H
#include "horizontalslicetocontourlinemapper.h"
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
class HorizontalContourLinesRenderer
{
public:
HorizontalContourLinesRenderer();
virtual ~HorizontalContourLinesRenderer();
void initOpenGLShaders();
void setContourMapper(HorizontalSliceToContourLineMapper *mappery);
void initContours();
void draw(QMatrix4x4 mvpMatrix);
private:
HorizontalSliceToContourLineMapper* mapper;
QOpenGLShaderProgram shaderProgram;
QOpenGLBuffer vertexBuffer;
QOpenGLVertexArrayObject vertexArrayObject;
};
#endif // HORIZONTALCONTOURLINESRENDERER_H

View file

@ -3,90 +3,138 @@
HorizontalSliceToContourLineMapper::HorizontalSliceToContourLineMapper(){
std::cout << "CONTOUR MAPPER CONSTRUCTOR CALLED - creating " << this << std::endl;
}
HorizontalSliceToContourLineMapper::~HorizontalSliceToContourLineMapper() {
delete isolist;
std::cout << "Destructor called! \n";
std::cout << "CONTOUR MAPPER DESTRUCTOR CALLED - deleting " << this << std::endl;
//delete[] isolist;
}
void HorizontalSliceToContourLineMapper::getSlice(float *source, int x, int y) {
void HorizontalSliceToContourLineMapper::getSlice(float *source, int x, int y, int z) {
slice = source;
xs = x;
ys = y;
iz = z;
}
void HorizontalSliceToContourLineMapper::setIso(float *isos, float num_of_isos) {
isolist = isos;
numIsos = num_of_isos;
}
int HorizontalSliceToContourLineMapper::marchingSquaresNum(float isoline, float a, float b,float c,float d) {
int SquareNum = 0;
if (isoline<a) {
SquareNum +=1;
} else if (isoline<b) {
SquareNum +=2;
} else if (isoline<c) {
SquareNum +=4;
} else if (isoline<d) {
SquareNum +=8;
void HorizontalSliceToContourLineMapper::setIso(float* isos, int nums) {
isolist = new float[nums];
for (int i=0; i<nums; i++) {
isolist[i] = isos[i];
}
return SquareNum;
numIsos = nums;
}
QVector3D* HorizontalSliceToContourLineMapper::mapSliceToContourLineSegments() {
QVector3D* vectors = new QVector3D[2*(xs-1)*(ys-1)*numIsos];
QVector3D vector = QVector3D(0.1,0.2,0.3);
int squareNum = 0;
char HorizontalSliceToContourLineMapper::marchingSquaresNum(float isoline, float v0, float v1,float v2,float v3) {
// Char used to reduce memory usage, since number small
char result = 0;
if (isoline<v0) {
result +=1;
} if (isoline<v1) {
result +=2;
} if (isoline<v2) {
result +=4;
} if (isoline<v3) {
result +=8;
}
return result;
}
for (int i=0; i<numIsos; i++) {
float c = isolist[i];
QVector<QVector3D> HorizontalSliceToContourLineMapper::mapSliceToContourLineSegments() {
QVector<QVector3D> vectors;
QVector3D vector1;
QVector3D vector2;
char squareCase = 0;
float v0, v1, v2, v3, iso;
float z_value = float(iz)/(xs-1);
float x_value, y_value;
for (int i = 0; i < numIsos; i++) {
std::cout << "iso: " << isolist[i]; //float
for (int y=0; y< ys-1; y++) {
for (int x=0; x< xs-1; x++) {
squareNum = marchingSquaresNum(isolist[i], slice[3*(y*xs+x)], slice[3*(y*xs+x+1)], slice[3*((y+1)*xs+x)], slice[3*((y+1)*xs+x+1)]);
v3 = slice[3*((y+1)*xs+x)]; //top left
v2 = slice[3*((y+1)*xs+x+1)]; //top right
v1 = slice[3*(y*xs+x)]; //botom left
v0 = slice[3*(y*xs+x+1)]; //bottom right
iso = isolist[i];
squareCase = marchingSquaresNum(iso, v0, v1, v2, v3);
// Viet found the amazing way of reducing the number of cases
// We use if-instructions because Switch doesn't allow for the or operation
// Lookuptable is nonetheless very mechanical
if (squareCase==1 || squareCase==14) {
x_value = float(x)/(xs-1);
y_value = float(y)/(ys-1)+(iso-v0)/((ys-1)*(v3-v0));
vector1 = QVector3D(x_value,y_value,z_value);
x_value = float(x)/(xs-1)+(iso-v0)/((xs-1)*(v1-v0));
y_value = float(y)/(ys-1);
vector2 = QVector3D(x_value, y_value,z_value);
} else if (squareCase==2 || squareCase==13) {
x_value = float(x)/(xs-1);
y_value = float(y)/(ys-1)+(iso-v1)/((ys-1)*(v2-v1));
vector1 = QVector3D(x_value,y_value,z_value);
x_value = float(x)/(xs-1)+(iso-v1)/((xs-1)*(v0-v1));
y_value = float(y)/(ys-1);
vector2 = QVector3D(x_value, y_value,z_value);
} else if (squareCase==3 || squareCase==12) {
x_value = float(x)/(xs-1);
y_value = float(y)/(ys-1)+(iso-v1)/((ys-1)*(v2-v1));
vector1 = QVector3D(x_value,y_value,z_value);
x_value = float(x)/(xs-1);
y_value = float(y)/(ys-1)+(iso-v0)/((ys-1)*(v3-v0));
vector2 = QVector3D(x_value,y_value,z_value);
} else if (squareCase==4 || squareCase==11) {
x_value = float(x)/(xs-1);
y_value = float(y)/(ys-1)+(iso-v1)/((ys-1)*(v2-v1));
vector1 = QVector3D(x_value, y_value, z_value);
x_value = float(x)/(xs-1)+(iso-v2)/((xs-1)*(v3-v2));
y_value = float(y)/(ys-1);
vector2 = QVector3D(x_value,y_value,z_value);
} else if (squareCase==5 || squareCase==10) {
//Special case requires checking is the centre is positive
if (0.25*(v0+v1+v2+v3)>v2) {
vector1 = QVector3D(float(x)/(xs-1),float(y)/(ys-1)+(iso-v1)/((ys-1)*(v2-v1)),z_value);
vector2 = QVector3D(float(x)/(xs-1)+(iso-v2)/((xs-1)*(v3-v2)),float(y)/(ys-1),z_value);
vectors << vector1 << vector2;
vector1 = QVector3D(float(x)/(xs-1),float(y)/(ys-1)+(iso-v0)/((ys-1)*(v3-v0)),z_value);
vector2 = QVector3D(float(x)/(xs-1)+(iso-v0)/((xs-1)*(v1-v0)),float(y)/(ys-1),z_value);
} else {
vector1 = QVector3D(float(x)/(xs-1)+(iso-v2)/((xs-1)*(v3-v2)),float(y)/(ys-1),z_value);
vector2 = QVector3D(float(x)/(xs-1),float(y)/(ys-1)+(iso-v0)/((ys-1)*(v3-v0)),z_value);
vectors << vector1 << vector2;
vector1 = QVector3D(float(x)/(xs-1),float(y)/(ys-1)+(iso-v2)/((ys-1)*(v3-v2)),z_value);
vector2 = QVector3D(float(x)/(xs-1)+(iso-v1)/((xs-1)*(v2-v1)),float(y)/(ys-1),z_value);
}
} else if (squareCase==6 || squareCase==9) {
vector1 = QVector3D(float(x)/(xs-1)+(iso-v0)/((xs-1)*(v1-v0)),float(y)/(ys-1),z_value);
vector2 = QVector3D(float(x)/(xs-1)+(iso-v2)/((xs-1)*(v3-v2)),float(y)/(ys-1),z_value);
} else if (squareCase==7 || squareCase==8) {
vector1 = QVector3D(float(x)/(xs-1)+(iso-v2)/((xs-1)*(v3-v2)),float(y)/(ys-1),z_value);
vector2 = QVector3D(float(x)/(xs-1),float(y)/(ys-1)+(iso-v0)/((ys-1)*(v3-v0)),z_value);
} else {
continue;
}
vectors << vector1 << vector2;
}
}
}
return vectors;
}
//QImage HorizontalSliceToImageMapper::mapSliceToImage() {
// //std::cout << xs << " hier kommt noch ys:" << ys << std::endl;
// QImage image(xs, ys, QImage::Format_RGB32);
// QRgb colour;
// int value;
// if (!magnitudeBool) {
// for (int i = 0; i < ys; i++) {
// for (int j = 0; j < xs; j++) {
// value = int(255*slice[3*(j*xs+i)]);
// //std::cout << slice[3*(i*xs+j)] << " ";
// //std::cout << value << std::endl;
// if (value >= 0) {
// colour = qRgb(3*value, 20, 0);
// } else {
// colour = qRgb(0, 20, -3*value);
// }
// image.setPixel(j, i, colour);
// }
// }
// } else {
// for (int i = 0; i < ys; i++) {
// for (int j = 0; j < xs; j++) {
// value = int(HorizontalSliceToImageMapper::totalWindSpeed(255*slice[3*(j*xs+i)+2], 255*slice[3*(j*xs+i)+1], 255*slice[3*(j*xs+i)]));
// //std::cout << value << std::endl;
// //always positive so no need for extra checks
// colour = qRgb(3*value, 20, 20);
// image.setPixel(j, i, colour);
// }
// }
// }
// // FOR DEBUG
// if (image.isNull()) {
// std::cout << "IMAGE LOADING ERROR IN MAPPER";
// }
// return image;
//}

View file

@ -1,6 +1,7 @@
#ifndef HORIZONTALSLICETOCONTOURLINEMAPPER_H
#define HORIZONTALSLICETOCONTOURLINEMAPPER_H
#include <QVector3D>
#include <QVector>
class HorizontalSliceToContourLineMapper
@ -8,17 +9,17 @@ class HorizontalSliceToContourLineMapper
public:
HorizontalSliceToContourLineMapper();
~HorizontalSliceToContourLineMapper();
void getSlice(float *source, int x, int y);
QVector3D* mapSliceToContourLineSegments();
void setIso(float *isos, float num_of_isos);
int marchingSquaresNum(float isoline, float a, float b, float c, float d);
void getSlice(float *source, int x, int y, int z);
QVector<QVector3D> mapSliceToContourLineSegments();
char marchingSquaresNum(float isoline, float a, float b, float c, float d);
void setIso(float *isos, int nums);
private:
int xs;
int ys;
int iz;
int numIsos;
float *slice;
float *isolist;
};
#endif // HORIZONTALSLICETOCONTOURLINEMAPPER_H

View file

@ -39,8 +39,8 @@ QImage HorizontalSliceToImageMapper::mapSliceToImage() {
int value;
if (!magnitudeBool) {
for (int i = 0; i < ys; i++) {
for (int j = 0; j < xs; j++) {
for (int i = 0; i < xs; i++) {
for (int j = 0; j < ys; j++) {
value = int(255*slice[3*(j*xs+i)]);
//std::cout << slice[3*(i*xs+j)] << " ";
//std::cout << value << std::endl;
@ -53,8 +53,8 @@ QImage HorizontalSliceToImageMapper::mapSliceToImage() {
}
}
} else {
for (int i = 0; i < ys; i++) {
for (int j = 0; j < xs; j++) {
for (int i = 0; i < xs; i++) {
for (int j = 0; j < ys; j++) {
value = int(HorizontalSliceToImageMapper::totalWindSpeed(255*slice[3*(j*xs+i)+2], 255*slice[3*(j*xs+i)+1], 255*slice[3*(j*xs+i)]));
//std::cout << value << std::endl;
//always positive so no need for extra checks

View file

@ -0,0 +1,8 @@
#version 330
layout(location = 0) out vec4 fragColor;
void main()
{
fragColor = vec4(1, 1, 1, 1); // blanka koloro
}

View file

@ -0,0 +1,8 @@
#version 330
uniform mat4 mvpMatrix; // model-view-projection matrix
in vec4 vertexPosition;
void main()
{
gl_Position = mvpMatrix * vertexPosition; // same kiel antaux
}

View file

@ -8,6 +8,7 @@ void main()
// Calculate vertex position in screen space.
gl_Position = mvpMatrix * vertexPosition;
// Originally texCoord = vertexPosition.xy, but this yields a flipped image
texCoord = vec2(vertexPosition.x, 1.0 - vertexPosition.y);
//texCoord = vec2(vertexPosition.x, 1.0 - vertexPosition.y);
texCoord = vertexPosition.xy;
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'opengldisplaywidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.3)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.13)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
@ -13,7 +13,7 @@
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'opengldisplaywidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.15.3. It"
#error "This file was generated using the moc from 5.15.13. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

View file

@ -26,6 +26,7 @@ OpenGLDisplayWidget::~OpenGLDisplayWidget()
delete filter;
delete mapper;
delete renderer;
delete contourrenderer;
// ....
}
@ -92,6 +93,7 @@ void OpenGLDisplayWidget::paintGL()
renderer->drawBoundingBox(mvpMatrix);
renderer->drawFrame(mvpMatrix);
renderer->drawImage(mvpMatrix);
contourrenderer->draw(mvpMatrix);
// ....
}
@ -224,7 +226,7 @@ void OpenGLDisplayWidget::initVisualizationPipeline()
// Initialize filter modules.
filter = new CartesianGridToHorizontalSliceFilter();
filter->setDataSource(grid->returnSource());
filter->setSlice(10);
filter->setSlice(3);
filter->setWindComponent(0); // The x-component
// Initialize mapper modules.
@ -232,8 +234,19 @@ void OpenGLDisplayWidget::initVisualizationPipeline()
mapper->getSlice(filter->passSlice(16,16), 16, 16);
contourmapper = new HorizontalSliceToContourLineMapper(); //Mapper causes the program to crash
contourmapper->getSlice(filter->passSlice(16,16), 16, 16, 3);
float *isos = new float[1];
isos[0] = 0.1;
//isos[1] = 0;
//isos[2] = -0.1;
contourmapper->setIso(isos, 1);
delete[] isos;
// Initialize rendering modules.
//bboxRenderer = new DataVolumeBoundingBoxRenderer();
renderer = new HorizontalSliceRenderer();
contourrenderer = new HorizontalContourLinesRenderer();
renderer->setMapper(mapper);
contourrenderer->setContourMapper(contourmapper);
}

View file

@ -6,7 +6,9 @@
#include "flowdatasource.h"
#include "cartesiangridtohorizontalslicefilter.h"
#include "horizontalslicetoimagemapper.h"
#include "horizontalslicetocontourlinemapper.h"
#include "horizontalslicerenderer.h"
#include "horizontalcontourlinesrenderer.h"
class OpenGLDisplayWidget : public QOpenGLWidget
@ -52,8 +54,10 @@ private:
FlowDataSource *grid;
CartesianGridToHorizontalSliceFilter *filter;
HorizontalSliceToImageMapper *mapper;
HorizontalSliceToContourLineMapper *contourmapper;
//DataVolumeBoundingBoxRenderer *bboxRenderer;
HorizontalSliceRenderer *renderer;
HorizontalContourLinesRenderer *contourrenderer;
// ....
// Initialize the pipeline (create instances of data source, mapping,