72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#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
|