From 18921bc9d144b2b3f389ac07b807be422d900063 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Tue, 15 Aug 2017 15:15:45 +1000 Subject: [PATCH 1/4] Remove obsolete build options docs --- README.rst | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/README.rst b/README.rst index 265844e3..3540f7e5 100644 --- a/README.rst +++ b/README.rst @@ -171,22 +171,6 @@ Both the LASlib and IlmBase libraries may be built using the separate third party build system in ``thirdparty/external/CMakeLists.txt``. -Build options -~~~~~~~~~~~~~ -To read the .las and .laz file formats, you'll need one of the following: - -* LASlib >= something-recent (known to work with 150406). This is the default - because it's reasonably fast and has no additional library dependencies. -* PDAL >= something-recent (known to work with 0.1.0-3668-gff73c08). You may - select PDAL by setting the build option ``DISPLAZ_USE_PDAL=TRUE``. Note that - building PDAL also requires several libraries including boost, laszip and - GDAL. - -If you only want to read ply files (for example, to use the scripting language -bindings), and don't care about las you may set the build option -``DISPLAZ_USE_LAS=FALSE``. - - Supported Systems ----------------- From 64727438463251125cce220e8a1b282ef58ef0d0 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Thu, 31 Aug 2017 19:04:03 +1000 Subject: [PATCH 2/4] A shader drawing a line segment on each point in the normal direction May be tested using the test file displaz_ply_points.ply --- shaders/point_normals.glsl | 96 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 shaders/point_normals.glsl diff --git a/shaders/point_normals.glsl b/shaders/point_normals.glsl new file mode 100644 index 00000000..10b850c3 --- /dev/null +++ b/shaders/point_normals.glsl @@ -0,0 +1,96 @@ +#version 130 +// Copyright 2015, Christopher J. Foster and the other displaz contributors. +// Use of this code is governed by the BSD-style license found in LICENSE.txt + +// This shader allows normals to be supplied with each point, and draws a small +// line segment in the direction of the normal, centred on the point. + +uniform mat4 modelViewMatrix; +uniform mat4 projectionMatrix; +uniform mat4 modelViewProjectionMatrix; + +//------------------------------------------------------------------------------ +#if defined(VERTEX_SHADER) + +uniform float pointSize = 10.0; //# uiname=Point Size; min=1; max=200 +uniform float minPointSize = 0; +uniform float maxPointSize = 200.0; +// Point size multiplier to keep coverage constant when doing stochastic +// simplification +uniform float pointSizeLodMultiplier = 1; +in vec3 position; +in vec3 normal; +in vec3 color; + +flat out float pointScreenSize; +flat out vec3 pointColor; +flat out vec2 lineNormal; +flat out float lineNormalLen; + +void main() +{ + vec4 p = modelViewProjectionMatrix * vec4(position,1.0); + gl_Position = p; + float wInv = 1.0/p.w; + // Compute differential of the projection Proj(v) = (A*v).xy / (A*v).w + // restricted to the xy plane. dProj given here has a factor of wInv + // removed so that the resulting lineNormalLen is correct for the point + // coordinate system (pointScreenSize is effectively absorbing the factor + // of wInv). + mat3x2 dProj = mat3x2(modelViewProjectionMatrix) - + outerProduct(wInv*p.xy, transpose(modelViewProjectionMatrix)[3].xyz); + // Remove aspect ratio - fragment coord system will be square. + float aspect = projectionMatrix[1][1]/projectionMatrix[0][0]; + dProj = mat2x2(aspect, 0, 0, 1) * dProj; + vec2 dirProj = dProj*normalize(normal); + lineNormalLen = length(dirProj); + lineNormal = vec2(-dirProj.y, dirProj.x) / lineNormalLen; + pointScreenSize = clamp(20.0*pointSize * wInv * pointSizeLodMultiplier, + minPointSize, maxPointSize); + gl_PointSize = pointScreenSize; + pointColor = color; +} + + +//------------------------------------------------------------------------------ +#elif defined(FRAGMENT_SHADER) + +uniform float markerWidth = 0.3; // # uiname=Marker Width; min=0.01; max=1 + +flat in float pointScreenSize; +flat in vec3 pointColor; +flat in vec2 lineNormal; +flat in float lineNormalLen; + +out vec4 fragColor; + +// Limit at which the point is rendered as a small square for antialiasing +// rather than using a specific marker shape +const float pointScreenSizeLimit = 2; + +void main() +{ + if (pointScreenSize <= 0) + discard; + if (pointScreenSize > pointScreenSizeLimit) + { + float w = markerWidth; + if (pointScreenSize < 2*pointScreenSizeLimit) + { + // smoothly turn on the markers as we get close enough to see them + w = mix(1, w, pointScreenSize/pointScreenSizeLimit - 1); + } + vec2 p = 2*(gl_PointCoord - 0.5); + p.y = -p.y; + float r = length(p); + const float lineRad = 1.0; + bool inLine = r*(1-w) < max(0.5*lineNormalLen, 2/pointScreenSize) && + abs(dot(lineNormal,p))*(1-w)*pointScreenSize < lineRad; + if (!inLine) + discard; + } + fragColor = vec4(pointColor, 1); +} + +#endif + From 5e38fa70475c1b5e32caa75ada37ce4f58404d95 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Thu, 19 Oct 2017 14:20:02 +1000 Subject: [PATCH 3/4] Several people have requested that bounding boxes be off by default. Let's just do it, I guess :-) --- src/gui/PointViewerMainWindow.cpp | 2 +- src/render/View3D.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/PointViewerMainWindow.cpp b/src/gui/PointViewerMainWindow.cpp index ed6309ac..5eaf4de7 100644 --- a/src/gui/PointViewerMainWindow.cpp +++ b/src/gui/PointViewerMainWindow.cpp @@ -154,7 +154,7 @@ PointViewerMainWindow::PointViewerMainWindow(const QGLFormat& format) viewMenu->addSeparator(); QAction* drawBoundingBoxes = viewMenu->addAction(tr("Draw Bounding bo&xes")); drawBoundingBoxes->setCheckable(true); - drawBoundingBoxes->setChecked(true); + drawBoundingBoxes->setChecked(false); QAction* drawCursor = viewMenu->addAction(tr("Draw 3D &Cursor")); drawCursor->setCheckable(true); drawCursor->setChecked(true); diff --git a/src/render/View3D.cpp b/src/render/View3D.cpp index 0ebdecc4..68d77b8d 100644 --- a/src/render/View3D.cpp +++ b/src/render/View3D.cpp @@ -33,7 +33,7 @@ View3D::View3D(GeometryCollection* geometries, const QGLFormat& format, QWidget m_cursorPos(0), m_prevCursorSnap(0), m_backgroundColor(60, 50, 50), - m_drawBoundingBoxes(true), + m_drawBoundingBoxes(false), m_drawCursor(true), m_drawAxes(true), m_drawGrid(false), From 1ad1c09e587279aec5c7978f75b4281f1ef5e126 Mon Sep 17 00:00:00 2001 From: Bryce Stansfield Date: Fri, 1 Dec 2017 14:02:46 +1000 Subject: [PATCH 4/4] This branch "adds" (the ability was already there, this just added a quick way to macro with it) the ability to draw classifications over only points already classified as a certain number. To do this just hit alt-(the number of the classification to draw over), and if you want to be able to draw over everything again just hit alt-r. --- shaders/las_points_selection.glsl | 3 +- src/render/View3D.cpp | 134 +++++++++++++++++++++--------- 2 files changed, 98 insertions(+), 39 deletions(-) diff --git a/shaders/las_points_selection.glsl b/shaders/las_points_selection.glsl index 653934eb..c6e57ffe 100644 --- a/shaders/las_points_selection.glsl +++ b/shaders/las_points_selection.glsl @@ -77,6 +77,8 @@ void main() else if (classification == 2) classColor = vec3(0.33, 0.18, 0.0); else if (classification == 3) classColor = vec3(1.0, 0.0, 0.0); else if (classification == 4) classColor = vec3(0.0, 1.0, 1.0); + else if (classification == 5) classColor = vec3(0.295, 0.0, 0.5); + else if (classification == 6) classColor = vec3(1.0, 0.63, 0.5); pointColor = classColor + vec3(0,0,float(rr // Centre camera on current cursor location if(event->key() == Qt::Key_C) { m_camera.setCenter(m_cursorPos); } - else if(event->key() == Qt::Key_0) + else if(!(event->modifiers()& Qt::AltModifier)) { - m_selectionClassTo = 0; - } - else if(event->key() == Qt::Key_1) - { - m_selectionClassTo = 1; - } - else if(event->key() == Qt::Key_2) - { - m_selectionClassTo = 2; - } - else if(event->key() == Qt::Key_3) - { - m_selectionClassTo = 3; - } - else if(event->key() == Qt::Key_4) - { - m_selectionClassTo = 4; - } - else if(event->key() == Qt::Key_5) - { - m_selectionClassTo = 5; - } - else if(event->key() == Qt::Key_6) - { - m_selectionClassTo = 6; - } - else if(event->key() == Qt::Key_7) - { - m_selectionClassTo = 7; - } - else if(event->key() == Qt::Key_8) - { - m_selectionClassTo = 8; - } - else if(event->key() == Qt::Key_9) - { - m_selectionClassTo = 9; + if(event->key() == Qt::Key_0) + { + m_selectionClassTo = 0; + } + else if(event->key() == Qt::Key_1) + { + m_selectionClassTo = 1; + } + else if(event->key() == Qt::Key_2) + { + m_selectionClassTo = 2; + } + else if(event->key() == Qt::Key_3) + { + m_selectionClassTo = 3; + } + else if(event->key() == Qt::Key_4) + { + m_selectionClassTo = 4; + } + else if(event->key() == Qt::Key_5) + { + m_selectionClassTo = 5; + } + else if(event->key() == Qt::Key_6) + { + m_selectionClassTo = 6; + } + else if(event->key() == Qt::Key_7) + { + m_selectionClassTo = 7; + } + else if(event->key() == Qt::Key_8) + { + m_selectionClassTo = 8; + } + else if(event->key() == Qt::Key_9) + { + m_selectionClassTo = 9; + } + else if(event->modifiers() == 0) + { + event->ignore(); + } } else if(event->key() == Qt::Key_S && (event->modifiers() & Qt::ControlModifier)) { @@ -700,6 +708,56 @@ void View3D::keyPressEvent(QKeyEvent *event) m_geometries->get()[sel[i].row()]->saveFile(fileName); } } + else if(event->modifiers() & Qt::AltModifier){ + if(event->key() == Qt::Key_0) + { + m_selectionClassFrom = 0; + } + else if(event->key() == Qt::Key_1) + { + m_selectionClassFrom = 1; + } + else if(event->key() == Qt::Key_2) + { + m_selectionClassFrom = 2; + } + else if(event->key() == Qt::Key_3) + { + m_selectionClassFrom = 3; + } + else if(event->key() == Qt::Key_4) + { + m_selectionClassFrom = 4; + } + else if(event->key() == Qt::Key_5) + { + m_selectionClassFrom = 5; + } + else if(event->key() == Qt::Key_6) + { + m_selectionClassFrom = 6; + } + else if(event->key() == Qt::Key_7) + { + m_selectionClassFrom = 7; + } + else if(event->key() == Qt::Key_8) + { + m_selectionClassFrom = 8; + } + else if(event->key() == Qt::Key_9) + { + m_selectionClassFrom = 9; + } + else if(event->key() == Qt::Key_R) + { + m_selectionClassFrom = 1; + } + else + { + event->ignore(); + } + } else { event->ignore();