added more cpp files for faster compile speeds

removed many obsolte elements
many improvements and fixes
This commit is contained in:
2018-07-20 15:00:43 +02:00
parent 7ee4e122e8
commit 5d002c3f2b
43 changed files with 1257 additions and 1361 deletions

View File

@@ -236,10 +236,12 @@ bool MapView3D::event(QEvent* event) {
bool MapView3D::gestureEvent(QGestureEvent* event) {
if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) {
(void) swipe;
//swipeTriggered(static_cast<QSwipeGesture *>(swipe));
} else if (QGesture *pan = event->gesture(Qt::PanGesture))
} else if (QGesture *pan = event->gesture(Qt::PanGesture)) {
panTriggered(static_cast<QPanGesture *>(pan));
return true;
}
if (QGesture *pinch = event->gesture(Qt::PinchGesture)) {
pinchTriggered(static_cast<QPinchGesture *>(pinch));
return true;
@@ -248,6 +250,7 @@ bool MapView3D::gestureEvent(QGestureEvent* event) {
}
void MapView3D::pinchTriggered(QPinchGesture* gesture) {
(void) gesture;
update();
}

View File

@@ -0,0 +1,82 @@
#include "FloorplanRenderer.h"
#include <unordered_set>
#include <Indoor/navMesh/NavMesh.h>
#include <Indoor/navMesh/NavMeshTriangle.h>
#include <Indoor/navMesh/NavMeshType.h>
#include <QPainter>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include "../misc/Renderable3D.h"
#include "../misc/Shader.h"
#include "../misc/TriangleData.h"
#include <Indoor/wifi/estimate/ray3/ModelFactory.h>
#include "RenderTriangle.h"
/** ctor */
FloorplanRenderer::FloorplanRenderer() {
;
}
void FloorplanRenderer::renderSolid(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe) {
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices());
rs.shader->setNormals(rt.getNormals());
rs.shader->setVertexColor(rt.getRGBA());
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
if (wireframe) {
RenderTriangle rt2 = rt.toWireframe(false);
rs.shader->setColor(0,0,0,128);
rs.shader->setVertices(rt2.getVertices());
//rs.shader->setVertexColor(rt2.getRGBA());
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
rs.shader->unsetVertices();
//rs.shader->unsetVertexColor();
}
rs.shader->release();
}
void FloorplanRenderer::renderTransp(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe) {
rs.funcs->glEnable(GL_BLEND);
rs.funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices());
rs.shader->setNormals(rt.getNormals());
rs.shader->setVertexColor(rt.getRGBA());
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
if (wireframe) {
RenderTriangle rt2 = rt.toWireframe(false);
rs.shader->setColor(0,0,0,128);
rs.shader->setVertices(rt2.getVertices());
//rs.shader->setVertexColor(rt2.getRGBA());
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
rs.shader->unsetVertices();
//rs.shader->unsetVertexColor();
}
rs.shader->release();
rs.funcs->glDisable(GL_BLEND);
}

View File

@@ -1,91 +1,22 @@
#ifndef FLOORPLANRENDERER_H
#define FLOORPLANRENDERER_H
#include <unordered_set>
#include <Indoor/navMesh/NavMesh.h>
#include <Indoor/navMesh/NavMeshTriangle.h>
#include <Indoor/navMesh/NavMeshType.h>
#include <QPainter>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include "../misc/Renderable3D.h"
#include "../misc/Shader.h"
#include "../misc/TriangleData.h"
#include <Indoor/wifi/estimate/ray3/ModelFactory.h>
#include "RenderTriangle.h"
class RenderTriangle;
class FloorplanRenderer {
public:
/** ctor */
FloorplanRenderer() {
;
}
FloorplanRenderer();
/** render the given grid using GL commands */
void renderSolid(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe) {
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices());
rs.shader->setNormals(rt.getNormals());
rs.shader->setVertexColor(rt.getRGBA());
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
if (wireframe) {
RenderTriangle rt2 = rt.toWireframe(false);
rs.shader->setColor(0,0,0,128);
rs.shader->setVertices(rt2.getVertices());
//rs.shader->setVertexColor(rt2.getRGBA());
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
rs.shader->unsetVertices();
//rs.shader->unsetVertexColor();
}
rs.shader->release();
}
void renderSolid(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe);
/** render the given grid using GL commands */
void renderTransp(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe) {
rs.funcs->glEnable(GL_BLEND);
rs.funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices());
rs.shader->setNormals(rt.getNormals());
rs.shader->setVertexColor(rt.getRGBA());
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
if (wireframe) {
RenderTriangle rt2 = rt.toWireframe(false);
rs.shader->setColor(0,0,0,128);
rs.shader->setVertices(rt2.getVertices());
//rs.shader->setVertexColor(rt2.getRGBA());
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
rs.shader->unsetVertices();
//rs.shader->unsetVertexColor();
}
rs.shader->release();
rs.funcs->glDisable(GL_BLEND);
}
void renderTransp(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe);
};

View File

@@ -56,7 +56,7 @@ void NavMeshRenderer::rebuildIfNeeded(NavMeshModel* model) {
case (int) NM::NavMeshType::STAIR_SKEWED: color = Point3(0.4, 0.4, 0.4); break;
}
const float o = 0.001f;
//const float o = 0.001f;
outlines.addLine(tria->getP1(), tria->getP2(), color.x, color.y, color.z, 1);
outlines.addLine(tria->getP2(), tria->getP3(), color.x, color.y, color.z, 1);
outlines.addLine(tria->getP3(), tria->getP1(), color.x, color.y, color.z, 1);