a lot of work on th map-creator
This commit is contained in:
59
mapview/3D/MV3DElementStair.h
Normal file
59
mapview/3D/MV3DElementStair.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef MV3DELEMENTSTAIR_H
|
||||
#define MV3DELEMENTSTAIR_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
#include "misc/Cube.h"
|
||||
#include "MV3DElement.h"
|
||||
|
||||
class MV3DElementStair : public MV3DElement {
|
||||
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::Stair* stair;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MV3DElementStair(Floorplan::Floor* floor, Floorplan::Stair* stair) : floor(floor), stair(stair) {
|
||||
;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/** repaint me */
|
||||
void paintGL() override {
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glColor3f(1.0, 0.55, 0.55);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
const std::vector<Floorplan::StairPart> parts = stair->getParts();
|
||||
const std::vector<Floorplan::Quad3> quads = Floorplan::getQuads(parts, floor);
|
||||
|
||||
for (int i = 0; i < (int) parts.size(); ++i) {
|
||||
|
||||
//const Floorplan::StairPart& part = parts[i];
|
||||
const Floorplan::Quad3& quad = quads[i];
|
||||
|
||||
//const Floorplan::Quad3 quad = part.getQuad(floor);
|
||||
const Point3 p1 = quad.p2-quad.p1;
|
||||
const Point3 p2 = quad.p4-quad.p1;
|
||||
const Point3 n = Math::normal(p1,p2);
|
||||
glNormal3f(n.x, n.z, n.z);
|
||||
glVertex3f(quad.p1.x, quad.p1.z, quad.p1.y);
|
||||
glVertex3f(quad.p2.x, quad.p2.z, quad.p2.y);
|
||||
glVertex3f(quad.p3.x, quad.p3.z, quad.p3.y);
|
||||
glVertex3f(quad.p4.x, quad.p4.z, quad.p4.y);
|
||||
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MV3DELEMENTSTAIR_H
|
||||
Reference in New Issue
Block a user