This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
IndoorMap/mapview/3D/floorplan/FloorplanRenderer.h
k-a-z-u bce771d6d6 worked on 3D viz
scaling, moving by finger
some fixes / improvement
2018-02-06 17:35:10 +01:00

73 lines
1.6 KiB
C++

#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 "../misc/Renderable3D.h"
#include "../misc/Shader.h"
#include "../misc/TriangleData.h"
#include <Indoor/wifi/estimate/ray3/ModelFactory.h>
#include "RenderTriangle.h"
class FloorplanRenderer {
public:
/** ctor */
FloorplanRenderer() {
;
}
/** render the given grid using GL commands */
void renderSolid(const RenderSettings& rs, const RenderTriangle& rt) {
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices().data());
rs.shader->setNormals(rt.getNormals().data());
rs.shader->setVertexColor(rt.getRGBA().data());
glDrawArrays(GL_TRIANGLES, 0, rt.getVertices().size()/3);
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
rs.shader->release();
}
/** render the given grid using GL commands */
void renderTransp(const RenderSettings& rs, const RenderTriangle& rt) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
rs.shader->bind();
rs.shader->setModelMatrix(QMatrix4x4());
rs.shader->setVertices(rt.getVertices().data());
rs.shader->setNormals(rt.getNormals().data());
rs.shader->setVertexColor(rt.getRGBA().data());
glDrawArrays(GL_TRIANGLES, 0, rt.getVertices().size()/3);
rs.shader->unsetVertices();
rs.shader->unsetNormals();
rs.shader->unsetVertexColor();
rs.shader->release();
glDisable(GL_BLEND);
}
};
#endif // FLOORPLANRENDERER_H