62 lines
1.2 KiB
C++
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
|