73 lines
1.6 KiB
C++
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
|