Merge branch 'master' of https://git.frank-ebner.de/FHWS/IndoorMap
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.pro.user
|
||||
@@ -4,9 +4,9 @@
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui opengl
|
||||
QT += core gui
|
||||
|
||||
CONFIG += c++11 -g3 -O0
|
||||
CONFIG += c++17 -g3 -O0
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets svg
|
||||
|
||||
@@ -16,13 +16,21 @@ TEMPLATE = app
|
||||
DEFINES += WITH_ASSERTIONS
|
||||
DEFINES += WITH_DEBUG_LOG
|
||||
|
||||
unix {
|
||||
LIBS += -lstdc++fs
|
||||
}
|
||||
|
||||
win32 {
|
||||
DEFINES += _USE_MATH_DEFINES
|
||||
CONFIG += console
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
../
|
||||
|
||||
|
||||
|
||||
SOURCES += \
|
||||
lib/gpc/gpc.cpp \
|
||||
main.cpp \
|
||||
MainWindow.cpp \
|
||||
MainController.cpp \
|
||||
@@ -172,7 +180,7 @@ HEADERS += MainWindow.h \
|
||||
mapview/3D/grid/GridModel.h \
|
||||
mapview/3D/grid/GridRenderer.h \
|
||||
mapview/3D/grid/MyNode.h \
|
||||
mapview/3D/navMesh/NavMeshModel.h \
|
||||
mapview/3D/navMesh/NavMeshModel.h \
|
||||
mapview/3D/navMesh/NavMeshRenderer.h \
|
||||
mapview/3D/navMesh/QNavMeshSettings.h \
|
||||
mapview/3D/misc/TriangleData.h \
|
||||
|
||||
@@ -103,7 +103,12 @@ MainController::MainController() {
|
||||
connect(mw, &MainWindow::onGridNodeColorType, [&] () {mw->getMapView3D()->getGridRenderer()->setNodeColorMode(GridRendererColorMode::SHOW_NODE_TYPE);} );
|
||||
connect(mw, &MainWindow::onGridShowEdges, [&] (const bool show) {mw->getMapView3D()->getGridRenderer()->setShowEdges(show);} );
|
||||
|
||||
Ray3D::OBJPool::get().init("/mnt/vm/paper/diss/code/IndoorMap/res/mdl/");
|
||||
//Ray3D::OBJPool::get().init("/mnt/vm/paper/diss/code/IndoorMap/res/mdl/");
|
||||
//Ray3D::OBJPool::get().init("/apps/paper/diss/code/IndoorMap/res/mdl/");
|
||||
Ray3D::OBJPool::get().init({
|
||||
"/mnt/vm/paper/diss/code/IndoorMap/res/mdl/",
|
||||
"/apps/paper/diss/code/IndoorMap/res/mdl/",
|
||||
});
|
||||
|
||||
//mapModel->load("../IndoorMap/maps/SHL36_noel.xml");
|
||||
//mapModel->load("../IndoorMap/maps/SHL38_no_elev.xml");
|
||||
@@ -117,6 +122,7 @@ MainController::MainController() {
|
||||
//mapModel->load("/mnt/vm/paper/diss/data/maps/walkmodel_stairs3.xml");
|
||||
mapModel->load("/mnt/vm/paper/diss/data/maps/walkmodel_2D_1.xml");
|
||||
|
||||
//mapModel->load("/mnt/vm/paper/diss/data/maps/walkmodel_stairs3.xml");
|
||||
//mapModel->load("/mnt/vm/paper/diss/data/maps/SHL42_nm.xml");
|
||||
//mapModel->load("/apps/paper/diss/data/maps/SHL41_nm.xml");
|
||||
|
||||
|
||||
2
main.cpp
2
main.cpp
@@ -3,6 +3,8 @@
|
||||
#include "MainController.h"
|
||||
#include <QApplication>
|
||||
|
||||
#include <experimental/filesystem>
|
||||
#include <iostream>
|
||||
//#include "exp.h"
|
||||
//#include "ray.h"
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@ public:
|
||||
/** get a list of all nodes that are selectable / moveable */
|
||||
virtual std::vector<MoveableNode> getMoveableNodes() const = 0;
|
||||
|
||||
/** the given node was moved */
|
||||
/** the given node is currently moved */
|
||||
virtual void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) = 0;
|
||||
|
||||
/** the given node was previously moved */
|
||||
virtual void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) = 0;
|
||||
|
||||
/** the given node was selected */
|
||||
virtual void onNodeSelect(MapView2D* v, const int userIdx) {
|
||||
|
||||
@@ -84,6 +84,11 @@ public:
|
||||
if (userIdx == 0) {ap->pos.x = newPos.x; ap->pos.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
(void) v;
|
||||
|
||||
@@ -77,6 +77,12 @@ public:
|
||||
if (userIdx == 0) {b->pos.x = newPos.x; b->pos.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
virtual void onFocus() override {
|
||||
;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,12 @@ public:
|
||||
if (userIdx == 0) {elevator->center.x = newPos.x; elevator->center.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
(void) v;
|
||||
|
||||
@@ -82,6 +82,12 @@ public:
|
||||
if (userIdx == 0) {fpl->posOnFloor = newPos;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
virtual void onFocus() override {
|
||||
;
|
||||
}
|
||||
|
||||
@@ -128,12 +128,16 @@ std::vector<MoveableNode> MV2DElementFloorObstacleDoor::getMoveableNodes() const
|
||||
return nodes;
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleDoor::onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) {
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleDoor::onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) {
|
||||
switch (userIdx) {
|
||||
case 0: fo->from = newPos; break;
|
||||
case 1: fo->to = newPos; break;
|
||||
}
|
||||
emit v->onElementChange(this);
|
||||
// emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
bool MV2DElementFloorObstacleDoor::keyPressEvent(MapView2D* v, QKeyEvent *e) {
|
||||
|
||||
@@ -41,9 +41,10 @@ public:
|
||||
/** get a list of all nodes that are selectable / moveable */
|
||||
virtual std::vector<MoveableNode> getMoveableNodes() const override;
|
||||
|
||||
/** the given node was moved */
|
||||
virtual void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) override;
|
||||
|
||||
virtual void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override;
|
||||
|
||||
virtual bool keyPressEvent(MapView2D* v, QKeyEvent *e) override;
|
||||
|
||||
};
|
||||
|
||||
@@ -129,6 +129,13 @@ public:
|
||||
if (userIdx == 1) {fo->to.x = newPos.x; fo->to.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MV2DELEMENTFLOOROBSTACLELINE_H
|
||||
|
||||
@@ -102,6 +102,11 @@ void MV2DElementFloorObstacleObject::onNodeMove(MapView2D* v, const int userIdx,
|
||||
if (userIdx == 0) {fo->pos.x = newPos.x; fo->pos.y = newPos.y;}
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
void MV2DElementFloorObstacleObject::mousePressed(MapView2D* v, const Point2 p) {
|
||||
(void) v;
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
|
||||
virtual void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) override;
|
||||
|
||||
virtual void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override;
|
||||
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override;
|
||||
|
||||
virtual void mouseMove(MapView2D* v, const Point2 p) override;
|
||||
|
||||
@@ -103,12 +103,19 @@ public:
|
||||
}
|
||||
|
||||
/** the given node was moved */
|
||||
virtual void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
void onNodeMove(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) v;
|
||||
fo.poly.points[userIdx].x = newPos.x;
|
||||
fo.poly.points[userIdx].y = newPos.y;
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
|
||||
// virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
// (void) v;
|
||||
// (void) p;
|
||||
|
||||
@@ -81,6 +81,11 @@ public:
|
||||
if (userIdx == 0) {gtp->pos.x = newPos.x; gtp->pos.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
/** mouse pressed at the given point */
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
|
||||
@@ -81,6 +81,11 @@ public:
|
||||
if (userIdx == 0) {poi->pos = newPos;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
/** mouse pressed at the given point */
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
|
||||
@@ -77,6 +77,11 @@ public:
|
||||
if (userIdx == 0) {reg->posOnMap_m.x = newPos.x; reg->posOnMap_m.y = newPos.y;}
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
virtual void mousePressed(MapView2D* v, const Point2 p) override {
|
||||
(void) v;
|
||||
|
||||
@@ -307,6 +307,12 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void onNodeMoved(MapView2D* v, const int userIdx, const Point2 newPos) override {
|
||||
(void) userIdx;
|
||||
(void) newPos;
|
||||
emit v->onElementChange(this);
|
||||
}
|
||||
|
||||
void onNodeSelect(MapView2D* v, const int userIdx) override {
|
||||
HasMoveableNodes::onNodeSelect(v, userIdx);
|
||||
emit v->onElementChange(this);
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
if (focus) {pen.setColor(Qt::black);}
|
||||
if (mat == Material::CONCRETE) {;}
|
||||
if (mat == Material::GLASS) {pen.setStyle(Qt::PenStyle::DotLine);}
|
||||
if (mat == Material::METAL) {pen.setColor(QColor(50, 50, 50));}
|
||||
if (type == ObstacleType::HANDRAIL) {pen.setStyle(Qt::PenStyle::DashLine);}
|
||||
if (type == ObstacleType::UNKNOWN) {pen.setColor(Qt::red);}
|
||||
if (type == ObstacleType::PILLAR) {pen.setColor(Qt::red);}
|
||||
|
||||
@@ -120,9 +120,10 @@ private:
|
||||
// // left mouse button?
|
||||
// if (e->button() == Qt::MouseButton::LeftButton) {
|
||||
// // element has selectedable nodes? try to select one
|
||||
// if (dynamic_cast<HasMoveableNodes*>(me)) {
|
||||
// if (selectNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
|
||||
// }
|
||||
if (dynamic_cast<HasMoveableNodes*>(me)) {
|
||||
//if (selectNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
|
||||
if (nodeMoved(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
|
||||
}
|
||||
// }
|
||||
|
||||
// otherwise: let the element itself process all events
|
||||
@@ -173,6 +174,21 @@ private:
|
||||
|
||||
}
|
||||
|
||||
/** moved the currently selected node (now done). true if successful */
|
||||
bool nodeMoved(MapView2D* v, Point2 p, HasMoveableNodes* elem) {
|
||||
|
||||
// no node selected? -> done
|
||||
if (elem->getSelectedNode() == -1) {return false;}
|
||||
|
||||
// snap the node
|
||||
const Point2 pSnapped = v->getScaler().snap(p);
|
||||
|
||||
// moved (done)
|
||||
elem->onNodeMoved(v, elem->getSelectedNode(), pSnapped);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@@ -232,7 +248,7 @@ private:
|
||||
|
||||
const float g = m->getScaler().sm(15); // increase each BBox by 15 px (needed mainly for hor/ver lines)
|
||||
|
||||
#warning "which elements to select? among all currently visible? or only among the selected layer?"
|
||||
#pragma message "which elements to select? among all currently visible? or only among the selected layer?"
|
||||
// get all elements with bounding-box matchings
|
||||
std::vector<MapModelElement*> possible;
|
||||
// for (MapModelElement* el : m->getModel()->getSelectedLayerElements()) {
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
#define MV3DELEMENTFLOOROUTLINE_H
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include <Indoor/geo/GPCPolygon2.h>
|
||||
|
||||
#include "misc/Cube.h"
|
||||
#include "MV3DElement.h"
|
||||
|
||||
#include "../../lib/gpc/gpc.h"
|
||||
#include "misc/Polygon.h"
|
||||
#include "misc/Outline.h"
|
||||
|
||||
class MV3DElementFloorOutline : public MV3DElement {
|
||||
@@ -17,7 +16,7 @@ class MV3DElementFloorOutline : public MV3DElement {
|
||||
|
||||
struct Temp {
|
||||
Point2 cacheSum;
|
||||
Polygon* pol = nullptr;
|
||||
GPCPolygon2* pol = nullptr;
|
||||
std::vector<std::vector<Point3>> trias;
|
||||
};
|
||||
|
||||
@@ -80,7 +79,7 @@ protected:
|
||||
std::vector<gpc_polygon> add;
|
||||
std::vector<gpc_polygon> rem;
|
||||
if (tmp.pol) {delete tmp.pol;}
|
||||
tmp.pol = new Polygon();
|
||||
tmp.pol = new GPCPolygon2();
|
||||
|
||||
// all to-be-added polygons (filter!)
|
||||
for (Floorplan::FloorOutlinePolygon* poly : polys) {
|
||||
|
||||
@@ -58,7 +58,7 @@ protected:
|
||||
rs.shader->setColor(1.0, 0.55, 0.55);
|
||||
rs.shader->setVertices(data.getVertices().data());
|
||||
rs.shader->setNormals(data.getNormals().data());
|
||||
glDrawArrays(GL_TRIANGLES, 0, data.getVertices().size()/3);
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, data.getVertices().size()/3);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
rs.shader->release();
|
||||
|
||||
@@ -112,12 +112,16 @@ MapView3D::MapView3D(QWidget *parent) : QOpenGLWidget(parent) {
|
||||
grabGesture(Qt::PinchGesture);
|
||||
|
||||
auto format = QSurfaceFormat();
|
||||
//format.setVersion(4,3);
|
||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
||||
format.setVersion(3, 4);
|
||||
format.setSamples(2);
|
||||
//format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
format.setProfile(QSurfaceFormat::CompatibilityProfile);
|
||||
format.setOption(QSurfaceFormat::DebugContext);
|
||||
|
||||
setFormat(format);
|
||||
setFormat(format);
|
||||
|
||||
auto ver = format.version();
|
||||
std::cout << "OpenGL Context Version: " << ver.first << "." << ver.second << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +130,32 @@ void MapView3D::initializeGL() {
|
||||
//setFormat(QGLFormat(QGL::SampleBuffers));
|
||||
|
||||
QOpenGLWidget::initializeGL();
|
||||
initializeOpenGLFunctions();
|
||||
|
||||
logger = new QOpenGLDebugLogger(this);
|
||||
if (logger->initialize()) {
|
||||
connect(logger, &QOpenGLDebugLogger::messageLogged, [] (const QOpenGLDebugMessage& debugMessage) {
|
||||
std::cout << debugMessage.message().toStdString() << std::endl;
|
||||
});
|
||||
logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
|
||||
}
|
||||
|
||||
// Print device info
|
||||
const GLubyte* vendor = glGetString(GL_VENDOR);
|
||||
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||
const GLubyte* version = glGetString(GL_VERSION);
|
||||
|
||||
std::cout << "Device info: ";
|
||||
if (vendor) {
|
||||
std::cout << (const char*) vendor << " ";
|
||||
}
|
||||
if (renderer) {
|
||||
std::cout << (const char*) renderer << " ";
|
||||
}
|
||||
if (version) {
|
||||
std::cout << (const char*) version << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
// this should be the default!!
|
||||
glCullFace(GL_BACK);
|
||||
@@ -134,8 +164,7 @@ void MapView3D::initializeGL() {
|
||||
|
||||
// additional settings
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClearColor(0.9, 0.9, 1.0, 1.0);
|
||||
|
||||
glClearColor(0.5, 0.5, 0.5, 1.0);
|
||||
}
|
||||
|
||||
void MapView3D::paintGL() {
|
||||
@@ -293,7 +322,7 @@ void MapView3D::layerChange() {
|
||||
|
||||
void MapView3D::draw() {
|
||||
|
||||
static RenderSettings rs = RenderSettings(new Shader());
|
||||
static RenderSettings rs = RenderSettings(new Shader(), this);
|
||||
|
||||
// view
|
||||
QMatrix4x4 V;
|
||||
@@ -305,7 +334,7 @@ void MapView3D::draw() {
|
||||
V.rotate(rot.z, 0.0, 0.0, 1.0);
|
||||
V.translate(center.x, center.y, center.z);
|
||||
|
||||
float far = 200; // TODO
|
||||
float farPlane = 200; // TODO
|
||||
|
||||
// projection
|
||||
QMatrix4x4 P;
|
||||
@@ -316,14 +345,14 @@ void MapView3D::draw() {
|
||||
float h = height() / 30;
|
||||
viewport.size.x = w;
|
||||
viewport.size.y = h;
|
||||
P.perspective(45.0f, aspect, 0.01, far);
|
||||
P.perspective(45.0f, aspect, 0.01, farPlane);
|
||||
} else {
|
||||
// default size: 50 * 50/aspect meters
|
||||
float w = 50.0f;
|
||||
float h = 50.0f * height() / width();
|
||||
viewport.size.x = w;
|
||||
viewport.size.y = h;
|
||||
P.ortho(-w, +w, -h, +h, 0.1f, +far);
|
||||
P.ortho(-w, +w, -h, +h, 0.1f, +farPlane);
|
||||
}
|
||||
|
||||
rs.shader->bind();
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "../../fixC11.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtOpenGL>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include <Indoor/geo/Point3.h>
|
||||
|
||||
@@ -16,13 +17,15 @@ class NavMeshModel;
|
||||
class FloorplanRenderer;
|
||||
class FloorplanRendererModel;
|
||||
|
||||
class MapView3D : public QOpenGLWidget {
|
||||
class MapView3D : public QOpenGLWidget, protected QOpenGLFunctions {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
bool usePerspectiveProjection = false;
|
||||
bool useWireframe = false;
|
||||
|
||||
QOpenGLDebugLogger* logger = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
MapView3D(QWidget* parent = 0);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include "../misc/Renderable3D.h"
|
||||
#include "../misc/Shader.h"
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
rs.shader->setVertices(rt.getVertices());
|
||||
rs.shader->setNormals(rt.getNormals());
|
||||
rs.shader->setVertexColor(rt.getRGBA());
|
||||
glDrawArrays(GL_TRIANGLES, 0, rt.count());
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
rs.shader->unsetVertexColor();
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
rs.shader->setColor(0,0,0,128);
|
||||
rs.shader->setVertices(rt2.getVertices());
|
||||
//rs.shader->setVertexColor(rt2.getRGBA());
|
||||
glDrawArrays(GL_LINES, 0, rt2.count());
|
||||
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
|
||||
rs.shader->unsetVertices();
|
||||
//rs.shader->unsetVertexColor();
|
||||
}
|
||||
@@ -56,8 +57,8 @@ public:
|
||||
/** render the given grid using GL commands */
|
||||
void renderTransp(const RenderSettings& rs, const RenderTriangle& rt, bool wireframe) {
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.funcs->glEnable(GL_BLEND);
|
||||
rs.funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
rs.shader->bind();
|
||||
rs.shader->setModelMatrix(QMatrix4x4());
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
rs.shader->setVertices(rt.getVertices());
|
||||
rs.shader->setNormals(rt.getNormals());
|
||||
rs.shader->setVertexColor(rt.getRGBA());
|
||||
glDrawArrays(GL_TRIANGLES, 0, rt.count());
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, rt.count());
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
rs.shader->unsetVertexColor();
|
||||
@@ -75,14 +76,14 @@ public:
|
||||
rs.shader->setColor(0,0,0,128);
|
||||
rs.shader->setVertices(rt2.getVertices());
|
||||
//rs.shader->setVertexColor(rt2.getRGBA());
|
||||
glDrawArrays(GL_LINES, 0, rt2.count());
|
||||
rs.funcs->glDrawArrays(GL_LINES, 0, rt2.count());
|
||||
rs.shader->unsetVertices();
|
||||
//rs.shader->unsetVertexColor();
|
||||
}
|
||||
|
||||
rs.shader->release();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
rs.funcs->glDisable(GL_BLEND);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -89,27 +89,37 @@ public:
|
||||
|
||||
void rebuild(Floorplan::IndoorMap* im) {
|
||||
|
||||
<<<<<<< HEAD
|
||||
// rebuild the mesh
|
||||
Ray3D::ModelFactory fac(im);
|
||||
fac.exportDoors = showDoors;
|
||||
mesh = fac.getMesh();
|
||||
|
||||
=======
|
||||
>>>>>>> 45592899ee7de1a99f3086205788ff43398fad41
|
||||
triaTransp.clear();
|
||||
triaSolid.clear();
|
||||
|
||||
for (const Ray3D::Obstacle3D& obs : mesh.elements) {
|
||||
const int matID = getMaterial(obs);
|
||||
const Material& mat = mats[matID];
|
||||
for (const Triangle3& tria : obs.triangles) {
|
||||
const Point3 n = cross(tria.p2-tria.p1, tria.p3-tria.p1).normalized();
|
||||
if (mat.a != 255) {
|
||||
triaTransp.addTriangle(tria.p1, tria.p2, tria.p3, n, mat.r/255.0f, mat.g/255.0f, mat.b/255.0f, mat.a/255.0f);
|
||||
} else {
|
||||
triaSolid.addTriangle(tria.p1, tria.p2, tria.p3, n, mat.r/255.0f, mat.g/255.0f, mat.b/255.0f, mat.a/255.0f);
|
||||
// rebuild the mesh
|
||||
try {
|
||||
Ray3D::ModelFactory fac(im);
|
||||
mesh = fac.getMesh();
|
||||
for (const Ray3D::Obstacle3D& obs : mesh.elements) {
|
||||
const int matID = getMaterial(obs);
|
||||
const Material& mat = mats[matID];
|
||||
for (const Triangle3& tria : obs.triangles) {
|
||||
const Point3 n = cross(tria.p2-tria.p1, tria.p3-tria.p1).normalized();
|
||||
if (mat.a != 255) {
|
||||
triaTransp.addTriangle(tria.p1, tria.p2, tria.p3, n, mat.r/255.0f, mat.g/255.0f, mat.b/255.0f, mat.a/255.0f);
|
||||
} else {
|
||||
triaSolid.addTriangle(tria.p1, tria.p2, tria.p3, n, mat.r/255.0f, mat.g/255.0f, mat.b/255.0f, mat.a/255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(const std::exception& e) {
|
||||
std::cout << "Can't create 3D view. Failed to get mesh from model factory with error: '" << e.what() << "'" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -10,17 +10,17 @@ class RenderTriangle {
|
||||
struct Vertex{
|
||||
float x,y,z;
|
||||
Vertex(const float x, const float y, const float z) : x(x), y(y), z(z) {;}
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
struct Normal {
|
||||
float x,y,z;
|
||||
Normal(const float x, const float y, const float z) : x(x), y(y), z(z) {;}
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
struct RGBA {
|
||||
float r,g,b,a;
|
||||
RGBA(const float r, const float g, const float b, const float a) : r(r), g(g), b(b), a(a) {;}
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
std::vector<Vertex> vertices;
|
||||
std::vector<Normal> normals;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "Cube.h"
|
||||
#include "Shader.h"
|
||||
#include <QtOpenGL>
|
||||
|
||||
static float cube_vertices[] = {
|
||||
|
||||
@@ -76,7 +75,7 @@ void Cube::render(const RenderSettings& rs) {
|
||||
|
||||
rs.shader->setVertices(cube_vertices);
|
||||
rs.shader->setNormals(cube_normals);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 12*3);
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, 12*3);
|
||||
//glDrawElements(GL_TRIANGLES, +12, GL_INT, cube_vertex_indices);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
|
||||
@@ -54,7 +54,7 @@ void Handrail::render(const RenderSettings& rs) {
|
||||
}
|
||||
|
||||
rs.shader->setVertices(vertices.data());
|
||||
glDrawArrays(GL_LINES, 0, vertices.size() / 3);
|
||||
rs.funcs->glDrawArrays(GL_LINES, 0, vertices.size() / 3);
|
||||
rs.shader->unsetVertices();
|
||||
|
||||
rs.shader->release();
|
||||
|
||||
@@ -26,7 +26,7 @@ void Outline::render(const RenderSettings& rs) {
|
||||
rs.shader->setColor(color.x, color.y, color.z);
|
||||
rs.shader->setVertices(triangles.getVertices().data());
|
||||
rs.shader->setNormals(triangles.getNormals().data());
|
||||
glDrawArrays(GL_TRIANGLES, 0, triangles.getVertices().size() / 3);
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, triangles.getVertices().size() / 3);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
|
||||
|
||||
@@ -1,110 +1,112 @@
|
||||
#ifndef POLYGON_H
|
||||
#define POLYGON_H
|
||||
// Duplicated file with Indoor/wifi/estimate/ray3/ModelFactoryHelper.h
|
||||
|
||||
//#ifndef POLYGON_H
|
||||
//#define POLYGON_H
|
||||
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
#include "../../../lib/gpc/gpc.h"
|
||||
//#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
//#include "../../../lib/gpc/gpc.h"
|
||||
|
||||
class Polygon {
|
||||
//class Polygon_ {
|
||||
|
||||
struct GPCPolygon : gpc_polygon {
|
||||
GPCPolygon() {
|
||||
// contour = (gpc_vertex_list*) calloc(0, 1024);
|
||||
// contour->num_vertices = 0;
|
||||
// contour->vertex = (gpc_vertex*) calloc(0, 1024);
|
||||
// hole = (int*) calloc(0, 1024);
|
||||
num_contours = 0;
|
||||
contour = nullptr;
|
||||
hole = nullptr;
|
||||
}
|
||||
~GPCPolygon() {
|
||||
if (contour) {
|
||||
gpc_free_polygon(this);
|
||||
//free(contour->vertex); contour->vertex = nullptr;
|
||||
}
|
||||
free(contour); contour = nullptr;
|
||||
free(hole); hole = nullptr;
|
||||
// struct GPCPolygon : gpc_polygon {
|
||||
// GPCPolygon() {
|
||||
//// contour = (gpc_vertex_list*) calloc(0, 1024);
|
||||
//// contour->num_vertices = 0;
|
||||
//// contour->vertex = (gpc_vertex*) calloc(0, 1024);
|
||||
//// hole = (int*) calloc(0, 1024);
|
||||
// num_contours = 0;
|
||||
// contour = nullptr;
|
||||
// hole = nullptr;
|
||||
// }
|
||||
// ~GPCPolygon() {
|
||||
// if (contour) {
|
||||
// gpc_free_polygon(this);
|
||||
// //free(contour->vertex); contour->vertex = nullptr;
|
||||
// }
|
||||
// free(contour); contour = nullptr;
|
||||
// free(hole); hole = nullptr;
|
||||
|
||||
}
|
||||
GPCPolygon& operator = (const GPCPolygon& o) = delete;
|
||||
GPCPolygon& operator = (GPCPolygon& o) {
|
||||
this->contour = o.contour;
|
||||
this->hole = o.hole;
|
||||
this->num_contours = o.num_contours;
|
||||
o.contour = nullptr;
|
||||
o.hole = nullptr;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
// }
|
||||
// GPCPolygon& operator = (const GPCPolygon& o) = delete;
|
||||
// GPCPolygon& operator = (GPCPolygon& o) {
|
||||
// this->contour = o.contour;
|
||||
// this->hole = o.hole;
|
||||
// this->num_contours = o.num_contours;
|
||||
// o.contour = nullptr;
|
||||
// o.hole = nullptr;
|
||||
// return *this;
|
||||
// }
|
||||
// };
|
||||
|
||||
private:
|
||||
//private:
|
||||
|
||||
GPCPolygon state;
|
||||
// GPCPolygon state;
|
||||
|
||||
public:
|
||||
//public:
|
||||
|
||||
void add(const Floorplan::Polygon2& poly) {
|
||||
GPCPolygon cur = toGPC(poly);
|
||||
//GPCPolygon out;
|
||||
gpc_polygon_clip(GPC_UNION, &state, &cur, &state);
|
||||
//state = out;
|
||||
}
|
||||
// void add(const Floorplan::Polygon2& poly) {
|
||||
// GPCPolygon cur = toGPC(poly);
|
||||
// //GPCPolygon out;
|
||||
// gpc_polygon_clip(GPC_UNION, &state, &cur, &state);
|
||||
// //state = out;
|
||||
// }
|
||||
|
||||
void remove(const Floorplan::Polygon2& poly) {
|
||||
GPCPolygon cur = toGPC(poly);
|
||||
//GPCPolygon out;
|
||||
gpc_polygon_clip(GPC_DIFF, &state, &cur, &state);
|
||||
//state = out;
|
||||
}
|
||||
// void remove(const Floorplan::Polygon2& poly) {
|
||||
// GPCPolygon cur = toGPC(poly);
|
||||
// //GPCPolygon out;
|
||||
// gpc_polygon_clip(GPC_DIFF, &state, &cur, &state);
|
||||
// //state = out;
|
||||
// }
|
||||
|
||||
std::vector<std::vector<Point3>> get(float z) {
|
||||
// std::vector<std::vector<Point3>> get(float z) {
|
||||
|
||||
gpc_tristrip res;
|
||||
res.num_strips = 0;
|
||||
res.strip = nullptr;
|
||||
// gpc_tristrip res;
|
||||
// res.num_strips = 0;
|
||||
// res.strip = nullptr;
|
||||
|
||||
//res.strip = (gpc_vertex_list*) malloc(1024);
|
||||
gpc_polygon_to_tristrip(&state, &res);
|
||||
// //res.strip = (gpc_vertex_list*) malloc(1024);
|
||||
// gpc_polygon_to_tristrip(&state, &res);
|
||||
|
||||
std::vector<std::vector<Point3>> trias;
|
||||
// std::vector<std::vector<Point3>> trias;
|
||||
|
||||
for (int i = 0; i < res.num_strips; ++i) {
|
||||
gpc_vertex_list lst = res.strip[i];
|
||||
std::vector<Point3> tria;
|
||||
for (int j = 0; j < lst.num_vertices; ++j) {
|
||||
gpc_vertex& vert = lst.vertex[j];
|
||||
Point3 p3(vert.x, vert.y, z);
|
||||
tria.push_back(p3);
|
||||
}
|
||||
trias.push_back(tria);
|
||||
}
|
||||
// for (int i = 0; i < res.num_strips; ++i) {
|
||||
// gpc_vertex_list lst = res.strip[i];
|
||||
// std::vector<Point3> tria;
|
||||
// for (int j = 0; j < lst.num_vertices; ++j) {
|
||||
// gpc_vertex& vert = lst.vertex[j];
|
||||
// Point3 p3(vert.x, vert.y, z);
|
||||
// tria.push_back(p3);
|
||||
// }
|
||||
// trias.push_back(tria);
|
||||
// }
|
||||
|
||||
gpc_free_tristrip(&res);
|
||||
// gpc_free_tristrip(&res);
|
||||
|
||||
return std::move(trias);
|
||||
// return std::move(trias);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
private:
|
||||
//private:
|
||||
|
||||
GPCPolygon toGPC(Floorplan::Polygon2 poly) {
|
||||
// GPCPolygon toGPC(Floorplan::Polygon2 poly) {
|
||||
|
||||
std::vector<gpc_vertex> verts;
|
||||
for (Point2 p2 : poly.points) {
|
||||
gpc_vertex vert; vert.x = p2.x; vert.y = p2.y;
|
||||
verts.push_back(vert);
|
||||
}
|
||||
// std::vector<gpc_vertex> verts;
|
||||
// for (Point2 p2 : poly.points) {
|
||||
// gpc_vertex vert; vert.x = p2.x; vert.y = p2.y;
|
||||
// verts.push_back(vert);
|
||||
// }
|
||||
|
||||
GPCPolygon gpol;
|
||||
gpc_vertex_list list;
|
||||
list.num_vertices = verts.size();
|
||||
list.vertex = verts.data();
|
||||
gpc_add_contour(&gpol, &list, 0);
|
||||
// GPCPolygon gpol;
|
||||
// gpc_vertex_list list;
|
||||
// list.num_vertices = verts.size();
|
||||
// list.vertex = verts.data();
|
||||
// gpc_add_contour(&gpol, &list, 0);
|
||||
|
||||
return gpol;
|
||||
// return gpol;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
};
|
||||
//};
|
||||
|
||||
#endif // POLYGON_H
|
||||
//#endif // POLYGON_H
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#ifndef RENDERABLE3D_H
|
||||
#define RENDERABLE3D_H
|
||||
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
class Shader;
|
||||
|
||||
struct RenderSettings {
|
||||
Shader* shader = nullptr;
|
||||
RenderSettings(Shader* shader) : shader(shader) {;}
|
||||
Shader* shader = nullptr;
|
||||
QOpenGLFunctions* funcs = nullptr;
|
||||
|
||||
RenderSettings(Shader* shader, QOpenGLFunctions* f) : shader(shader), funcs(f) {;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,23 +22,24 @@ Shader::Shader() {
|
||||
)");
|
||||
|
||||
addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, R"(
|
||||
uniform vec4 color;
|
||||
uniform lowp vec4 color;
|
||||
uniform bool useNormal;
|
||||
uniform bool useVertexColor;
|
||||
varying highp vec3 v_normal;
|
||||
varying lowp vec4 v_color;
|
||||
varying lowp vec4 v_vertex;
|
||||
void main() {
|
||||
vec3 lightPos = vec3(0,0,0); // camera
|
||||
mediump vec3 lightPos = vec3(0,0,0); // camera
|
||||
//vec3 lightVec = normalize(vec3(0,0,1));
|
||||
vec3 lightVec = normalize(lightPos - v_vertex.xyz);
|
||||
float intensity = useNormal ? 0.3 + 0.7 * dot( normalize(v_normal), lightVec ) : 1.0; // light at camera pos
|
||||
vec4 col = useVertexColor ? v_color : color;
|
||||
mediump vec3 lightVec = normalize(lightPos - v_vertex.xyz);
|
||||
lowp float intensity = useNormal ? 0.3 + 0.7 * dot( normalize(v_normal), lightVec ) : 1.0; // light at camera pos
|
||||
lowp vec4 col = useVertexColor ? v_color : color;
|
||||
gl_FragColor.rgb = col.rgb * intensity;
|
||||
gl_FragColor.a = col.a;
|
||||
}
|
||||
)");
|
||||
|
||||
|
||||
//bindAttributeLocation("vertices", 0);
|
||||
|
||||
if (!link()) {
|
||||
@@ -50,6 +51,7 @@ Shader::Shader() {
|
||||
|
||||
|
||||
void Shader::setModelMatrix(const QMatrix4x4& m) {
|
||||
//vao.bind();;
|
||||
setUniformValue(getUniform("M"), m);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,20 +69,20 @@ void Window::render(const RenderSettings& rs) {
|
||||
|
||||
rs.shader->setColor(0.75, 0.85, 1.0, 0.35);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
rs.funcs->glEnable(GL_BLEND);
|
||||
rs.funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glDisable(GL_CULL_FACE);
|
||||
|
||||
rs.shader->setModelMatrix(mat);
|
||||
|
||||
rs.shader->setVertices(window_vertices);
|
||||
rs.shader->setNormals(window_normals);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 12);
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, 12);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetNormals();
|
||||
|
||||
//glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
rs.funcs->glDisable(GL_BLEND);
|
||||
|
||||
rs.shader->release();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include "../misc/Renderable3D.h"
|
||||
#include "../misc/Shader.h"
|
||||
@@ -88,7 +89,7 @@ public:
|
||||
|
||||
rs.shader->setVertices(data.getVertices().data());
|
||||
rs.shader->setVertexColor(data.getRGBA().data());
|
||||
glDrawArrays(GL_TRIANGLES, 0, data.getVertices().size()/3);
|
||||
rs.funcs->glDrawArrays(GL_TRIANGLES, 0, data.getVertices().size()/3);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetVertexColor();
|
||||
|
||||
@@ -132,7 +133,7 @@ public:
|
||||
|
||||
rs.shader->setVertices(data.getVertices().data());
|
||||
rs.shader->setVertexColor(data.getRGBA().data());
|
||||
glDrawArrays(GL_LINES, 0, data.getVertices().size()/3);
|
||||
rs.funcs->glDrawArrays(GL_LINES, 0, data.getVertices().size()/3);
|
||||
rs.shader->unsetVertices();
|
||||
rs.shader->unsetVertexColor();
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ QComboBox* getMaterials() {
|
||||
case Material::DRYWALL: cmbMaterial->addItem("Drywall", i); break;
|
||||
case Material::WOOD: cmbMaterial->addItem("Wood", i); break;
|
||||
case Material::GLASS: cmbMaterial->addItem("Glass", i); break;
|
||||
case Material::METAL: cmbMaterial->addItem("Metal", i); break;
|
||||
case Material::_END: throw 1;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +129,6 @@ void ElementParamWidget::refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// has outline method?
|
||||
{
|
||||
MMFloorOutlinePolygon* elem = dynamic_cast<MMFloorOutlinePolygon*>(el);
|
||||
|
||||
164
res/mdl/dude1.obj
Normal file
164
res/mdl/dude1.obj
Normal file
@@ -0,0 +1,164 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'dude1.blend'
|
||||
# www.blender.org
|
||||
v 0.050000 0.225000 0.750000
|
||||
v 0.050000 0.225000 1.450000
|
||||
v -0.050000 0.225000 0.750000
|
||||
v -0.050000 0.225000 1.450000
|
||||
v 0.050000 0.325000 0.750000
|
||||
v 0.050000 0.325000 1.450000
|
||||
v -0.050000 0.325000 0.750000
|
||||
v -0.050000 0.325000 1.450000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 2//1 3//1 1//1
|
||||
f 4//2 7//2 3//2
|
||||
f 8//3 5//3 7//3
|
||||
f 6//4 1//4 5//4
|
||||
f 7//5 1//5 3//5
|
||||
f 4//6 6//6 8//6
|
||||
f 2//1 4//1 3//1
|
||||
f 4//2 8//2 7//2
|
||||
f 8//3 6//3 5//3
|
||||
f 6//4 2//4 1//4
|
||||
f 7//5 5//5 1//5
|
||||
f 4//6 2//6 6//6
|
||||
v 0.050000 -0.325000 0.750000
|
||||
v 0.050000 -0.325000 1.450000
|
||||
v -0.050000 -0.325000 0.750000
|
||||
v -0.050000 -0.325000 1.450000
|
||||
v 0.050000 -0.225000 0.750000
|
||||
v 0.050000 -0.225000 1.450000
|
||||
v -0.050000 -0.225000 0.750000
|
||||
v -0.050000 -0.225000 1.450000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 10//7 11//7 9//7
|
||||
f 12//8 15//8 11//8
|
||||
f 16//9 13//9 15//9
|
||||
f 14//10 9//10 13//10
|
||||
f 15//11 9//11 11//11
|
||||
f 12//12 14//12 16//12
|
||||
f 10//7 12//7 11//7
|
||||
f 12//8 16//8 15//8
|
||||
f 16//9 14//9 13//9
|
||||
f 14//10 10//10 9//10
|
||||
f 15//11 13//11 9//11
|
||||
f 12//12 10//12 14//12
|
||||
v 0.100000 -0.100000 1.550000
|
||||
v 0.100000 -0.100000 1.750000
|
||||
v -0.100000 -0.100000 1.550000
|
||||
v -0.100000 -0.100000 1.750000
|
||||
v 0.100000 0.100000 1.550000
|
||||
v 0.100000 0.100000 1.750000
|
||||
v -0.100000 0.100000 1.550000
|
||||
v -0.100000 0.100000 1.750000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 18//13 19//13 17//13
|
||||
f 20//14 23//14 19//14
|
||||
f 24//15 21//15 23//15
|
||||
f 22//16 17//16 21//16
|
||||
f 23//17 17//17 19//17
|
||||
f 20//18 22//18 24//18
|
||||
f 18//13 20//13 19//13
|
||||
f 20//14 24//14 23//14
|
||||
f 24//15 22//15 21//15
|
||||
f 22//16 18//16 17//16
|
||||
f 23//17 21//17 17//17
|
||||
f 20//18 18//18 22//18
|
||||
v 0.150000 -0.200000 0.900000
|
||||
v 0.150000 -0.200000 1.500000
|
||||
v -0.150000 -0.200000 0.900000
|
||||
v -0.150000 -0.200000 1.500000
|
||||
v 0.150000 0.200000 0.900000
|
||||
v 0.150000 0.200000 1.500000
|
||||
v -0.150000 0.200000 0.900000
|
||||
v -0.150000 0.200000 1.500000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 26//19 27//19 25//19
|
||||
f 28//20 31//20 27//20
|
||||
f 32//21 29//21 31//21
|
||||
f 30//22 25//22 29//22
|
||||
f 31//23 25//23 27//23
|
||||
f 28//24 30//24 32//24
|
||||
f 26//19 28//19 27//19
|
||||
f 28//20 32//20 31//20
|
||||
f 32//21 30//21 29//21
|
||||
f 30//22 26//22 25//22
|
||||
f 31//23 29//23 25//23
|
||||
f 28//24 26//24 30//24
|
||||
v 0.075000 0.025000 0.000000
|
||||
v 0.075000 0.025000 0.850000
|
||||
v -0.075000 0.025000 0.000000
|
||||
v -0.075000 0.025000 0.850000
|
||||
v 0.075000 0.175000 0.000000
|
||||
v 0.075000 0.175000 0.850000
|
||||
v -0.075000 0.175000 0.000000
|
||||
v -0.075000 0.175000 0.850000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 34//25 35//25 33//25
|
||||
f 36//26 39//26 35//26
|
||||
f 40//27 37//27 39//27
|
||||
f 38//28 33//28 37//28
|
||||
f 39//29 33//29 35//29
|
||||
f 36//30 38//30 40//30
|
||||
f 34//25 36//25 35//25
|
||||
f 36//26 40//26 39//26
|
||||
f 40//27 38//27 37//27
|
||||
f 38//28 34//28 33//28
|
||||
f 39//29 37//29 33//29
|
||||
f 36//30 34//30 38//30
|
||||
v 0.075000 -0.175000 0.000000
|
||||
v 0.075000 -0.175000 0.850000
|
||||
v -0.075000 -0.175000 0.000000
|
||||
v -0.075000 -0.175000 0.850000
|
||||
v 0.075000 -0.025000 0.000000
|
||||
v 0.075000 -0.025000 0.850000
|
||||
v -0.075000 -0.025000 0.000000
|
||||
v -0.075000 -0.025000 0.850000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 42//31 43//31 41//31
|
||||
f 44//32 47//32 43//32
|
||||
f 48//33 45//33 47//33
|
||||
f 46//34 41//34 45//34
|
||||
f 47//35 41//35 43//35
|
||||
f 44//36 46//36 48//36
|
||||
f 42//31 44//31 43//31
|
||||
f 44//32 48//32 47//32
|
||||
f 48//33 46//33 45//33
|
||||
f 46//34 42//34 41//34
|
||||
f 47//35 45//35 41//35
|
||||
f 44//36 42//36 46//36
|
||||
164
res/mdl/dude2.obj
Normal file
164
res/mdl/dude2.obj
Normal file
@@ -0,0 +1,164 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'dude2.blend'
|
||||
# www.blender.org
|
||||
v -0.255778 0.216248 0.761661
|
||||
v 0.038929 0.242032 1.396077
|
||||
v -0.346064 0.208349 0.803923
|
||||
v -0.051357 0.234133 1.438339
|
||||
v -0.264493 0.315867 0.761661
|
||||
v 0.030214 0.341651 1.396077
|
||||
v -0.354779 0.307968 0.803923
|
||||
v -0.060072 0.333752 1.438339
|
||||
vn 0.0872 -0.9962 -0.0000
|
||||
vn -0.9029 -0.0790 0.4226
|
||||
vn -0.0872 0.9962 0.0000
|
||||
vn 0.9029 0.0790 -0.4226
|
||||
vn -0.4210 -0.0368 -0.9063
|
||||
vn 0.4210 0.0368 0.9063
|
||||
s off
|
||||
f 2//1 3//1 1//1
|
||||
f 4//2 7//2 3//2
|
||||
f 7//3 6//3 5//3
|
||||
f 6//4 1//4 5//4
|
||||
f 7//5 1//5 3//5
|
||||
f 4//6 6//6 8//6
|
||||
f 2//1 4//1 3//1
|
||||
f 4//2 8//2 7//2
|
||||
f 7//3 8//3 6//3
|
||||
f 6//4 2//4 1//4
|
||||
f 7//5 5//5 1//5
|
||||
f 4//6 2//6 6//6
|
||||
v 0.357916 -0.307968 0.803923
|
||||
v 0.063209 -0.333752 1.438339
|
||||
v 0.267630 -0.315867 0.761661
|
||||
v -0.027077 -0.341651 1.396077
|
||||
v 0.349200 -0.208349 0.803923
|
||||
v 0.054493 -0.234133 1.438339
|
||||
v 0.258915 -0.216248 0.761661
|
||||
v -0.035792 -0.242032 1.396077
|
||||
vn 0.0872 -0.9962 -0.0000
|
||||
vn -0.9029 -0.0790 -0.4226
|
||||
vn -0.0872 0.9962 0.0000
|
||||
vn 0.9029 0.0790 0.4226
|
||||
vn 0.4210 0.0368 -0.9063
|
||||
vn -0.4210 -0.0368 0.9063
|
||||
s off
|
||||
f 10//7 11//7 9//7
|
||||
f 12//8 15//8 11//8
|
||||
f 15//9 14//9 13//9
|
||||
f 14//10 9//10 13//10
|
||||
f 15//11 9//11 11//11
|
||||
f 16//12 10//12 14//12
|
||||
f 10//7 12//7 11//7
|
||||
f 12//8 16//8 15//8
|
||||
f 15//9 16//9 14//9
|
||||
f 14//10 10//10 9//10
|
||||
f 15//11 13//11 9//11
|
||||
f 16//12 12//12 10//12
|
||||
v 0.100000 -0.100000 1.550000
|
||||
v 0.100000 -0.100000 1.750000
|
||||
v -0.100000 -0.100000 1.550000
|
||||
v -0.100000 -0.100000 1.750000
|
||||
v 0.100000 0.100000 1.550000
|
||||
v 0.100000 0.100000 1.750000
|
||||
v -0.100000 0.100000 1.550000
|
||||
v -0.100000 0.100000 1.750000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 18//13 19//13 17//13
|
||||
f 20//14 23//14 19//14
|
||||
f 24//15 21//15 23//15
|
||||
f 22//16 17//16 21//16
|
||||
f 23//17 17//17 19//17
|
||||
f 20//18 22//18 24//18
|
||||
f 18//13 20//13 19//13
|
||||
f 20//14 24//14 23//14
|
||||
f 24//15 22//15 21//15
|
||||
f 22//16 18//16 17//16
|
||||
f 23//17 21//17 17//17
|
||||
f 20//18 18//18 22//18
|
||||
v 0.166860 -0.186166 0.900000
|
||||
v 0.166860 -0.186166 1.500000
|
||||
v -0.131998 -0.212312 0.900000
|
||||
v -0.131998 -0.212312 1.500000
|
||||
v 0.131998 0.212312 0.900000
|
||||
v 0.131998 0.212312 1.500000
|
||||
v -0.166860 0.186166 0.900000
|
||||
v -0.166860 0.186166 1.500000
|
||||
vn 0.0872 -0.9962 0.0000
|
||||
vn -0.9962 -0.0872 0.0000
|
||||
vn -0.0872 0.9962 0.0000
|
||||
vn 0.9962 0.0872 0.0000
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
vn -0.0000 0.0000 1.0000
|
||||
s off
|
||||
f 26//19 27//19 25//19
|
||||
f 28//20 31//20 27//20
|
||||
f 32//21 29//21 31//21
|
||||
f 30//22 25//22 29//22
|
||||
f 31//23 25//23 27//23
|
||||
f 28//24 30//24 32//24
|
||||
f 26//19 28//19 27//19
|
||||
f 28//20 32//20 31//20
|
||||
f 32//21 30//21 29//21
|
||||
f 30//22 26//22 25//22
|
||||
f 31//23 29//23 25//23
|
||||
f 28//24 26//24 30//24
|
||||
v 0.210243 0.025000 0.019480
|
||||
v 0.062642 0.025000 0.856567
|
||||
v 0.062522 0.025000 -0.006567
|
||||
v -0.085079 0.025000 0.830520
|
||||
v 0.210243 0.175000 0.019480
|
||||
v 0.062642 0.175000 0.856567
|
||||
v 0.062522 0.175000 -0.006567
|
||||
v -0.085079 0.175000 0.830520
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -0.9848 0.0000 -0.1736
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.9848 0.0000 0.1736
|
||||
vn 0.1736 0.0000 -0.9848
|
||||
vn -0.1736 0.0000 0.9848
|
||||
s off
|
||||
f 34//25 35//25 33//25
|
||||
f 36//26 39//26 35//26
|
||||
f 40//27 37//27 39//27
|
||||
f 38//28 33//28 37//28
|
||||
f 39//29 33//29 35//29
|
||||
f 36//30 38//30 40//30
|
||||
f 34//25 36//25 35//25
|
||||
f 36//26 40//26 39//26
|
||||
f 40//27 38//27 37//27
|
||||
f 38//28 34//28 33//28
|
||||
f 39//29 37//29 33//29
|
||||
f 36//30 34//30 38//30
|
||||
v -0.075060 -0.175000 -0.006567
|
||||
v 0.072541 -0.175000 0.830520
|
||||
v -0.222781 -0.175000 0.019480
|
||||
v -0.075180 -0.175000 0.856567
|
||||
v -0.075060 -0.025000 -0.006567
|
||||
v 0.072541 -0.025000 0.830520
|
||||
v -0.222781 -0.025000 0.019480
|
||||
v -0.075180 -0.025000 0.856567
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn -0.9848 0.0000 0.1736
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.9848 0.0000 -0.1736
|
||||
vn -0.1736 0.0000 -0.9848
|
||||
vn 0.1736 0.0000 0.9848
|
||||
s off
|
||||
f 42//31 43//31 41//31
|
||||
f 44//32 47//32 43//32
|
||||
f 48//33 45//33 47//33
|
||||
f 46//34 41//34 45//34
|
||||
f 47//35 41//35 43//35
|
||||
f 44//36 46//36 48//36
|
||||
f 42//31 44//31 43//31
|
||||
f 44//32 48//32 47//32
|
||||
f 48//33 46//33 45//33
|
||||
f 46//34 42//34 41//34
|
||||
f 47//35 45//35 41//35
|
||||
f 44//36 42//36 46//36
|
||||
@@ -41,8 +41,11 @@ public:
|
||||
_parent = static_cast<MapLayer*>(parent.internalPointer());
|
||||
}
|
||||
|
||||
return createIndex(row, column, _parent->getSubLayers().at(row));
|
||||
|
||||
if (_parent->getSubLayers().size() > 0) {
|
||||
return createIndex(row, column, _parent->getSubLayers().at(row));
|
||||
} else {
|
||||
return createIndex(0, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
virtual QModelIndex parent(const QModelIndex& child) const override {
|
||||
|
||||
Reference in New Issue
Block a user