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/navMesh/NavMeshRenderer.h
k-a-z-u 2f37baf497 re-added grid-rendering to the editor
rebuild grid/navMesh 3D data only if needed
2018-07-03 10:53:03 +02:00

62 lines
1.2 KiB
C++

#ifndef NAVMESHRENDERER_H
#define NAVMESHRENDERER_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"
class NavMeshModel;
class NavMeshRenderer {
private:
// settings
//GridRendererColorMode colorMode = GridRendererColorMode::SHOW_NODE_IMPORTANCE;
bool showEdges = false;
struct Color {
float r,g,b;
Color() : r(1), g(0), b(0) {;}
Color(float r, float g, float b) : r(r), g(g), b(b) {;}
};
// /** node color depending on the node's type. see ctor */
// Color colors[200];
TriangleData triangles;
TriangleData outlines;
int lastBuildID = 0; // to check whether the model has changed
public:
/** ctor */
NavMeshRenderer();
// void setNodeColorMode(const GridRendererColorMode mode) {this->colorMode = mode;}
void setShowEdges(const bool show) {this->showEdges = show;}
/** render the given grid using GL commands */
void render(const RenderSettings& rs, NavMeshModel* model);
private:
void rebuildIfNeeded(NavMeshModel* model);
};
#endif // NAVMESHRENDERER_H