Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit 8abbc47

Browse files
committed
Merge branch 'develop'
2 parents aa064a0 + a99e7d1 commit 8abbc47

17 files changed

+124
-63
lines changed

SolARModuleOpenGL.pro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
QT -= core gui
33
CONFIG -= qt
44

5+
QMAKE_PROJECT_DEPTH = 0
6+
57
## global defintions : target lib name, version
68
INSTALLSUBDIR = SolARBuild
79
TARGET = SolARModuleOpenGL
810

911
FRAMEWORK = $$TARGET
10-
VERSION=0.9.1
12+
VERSION=0.10.0
1113

1214
DEFINES += MYVERSION=$${VERSION}
1315
DEFINES += TEMPLATE_LIBRARY
@@ -47,8 +49,11 @@ unix:!android {
4749
}
4850

4951
linux {
52+
QMAKE_LFLAGS += -ldl
53+
LIBS += -L/home/linuxbrew/.linuxbrew/lib # temporary fix caused by grpc with -lre2 ... without -L in grpc.pc
5054
LIBS += -lGLU -lGL
5155
}
56+
5257
macx {
5358
DEFINES += _MACOS_TARGET_
5459
QMAKE_MAC_SDK= macosx
@@ -60,7 +65,7 @@ macx {
6065

6166
win32 {
6267

63-
DEFINES += WIN64 UNICODE _UNICODE
68+
DEFINES += WIN64 UNICODE _UNICODE NOMINMAX
6469
QMAKE_COMPILER_DEFINES += _WIN64
6570
QMAKE_CXXFLAGS += -wd4250 -wd4251 -wd4244 -wd4275
6671
QMAKE_CXXFLAGS_RELEASE += /O2
@@ -79,6 +84,7 @@ INSTALLS += xpcf_xml_files
7984
OTHER_FILES += \
8085
packagedependencies.txt \
8186
packagedependencies-linux.txt \
87+
packagedependencies-mac.txt \
8288
packagedependencies-win.txt
8389

8490
#NOTE : Must be placed at the end of the .pro

bcom-SolARModuleOpenGL.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ libdir=${exec_prefix}/lib
55
includedir=${prefix}/interfaces
66
Name: SolARModuleOpenGL
77
Description:
8-
Version: 0.9.1
8+
Version: 0.10.0
99
Requires:
1010
Libs: -L${libdir} -l${libname}
1111
Libs.private: ${libdir}/${pfx}${libname}.${lext}

interfaces/SolARSinkPoseTextureBufferOpengl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222

2323
#include "datastructure/Image.h"
2424

25+
#ifdef __APPLE__
26+
#include "GL/freeglut.h"
27+
#else
2528
#include "freeglut.h"
29+
#endif
2630
#include <mutex>
2731

2832
namespace SolAR {

packagedependencies-linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
freeglut|3.0.0|freeglut|thirdParties@github|https://github.com/SolarFramework/binaries/releases/download
12
libglu1-mesa-dev||libglu|apt-get@system|apt-get
23

34

packagedependencies-mac.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mesa-glu|9.0.1|glu|brew@system|
2+
freeglut|3.2.1|glut|brew@system|

packagedependencies-win.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
freeglut|3.0.0|freeglut|thirdParties@github|https://github.com/SolarFramework/binaries/releases/download
12

23

34

packagedependencies.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SolARFramework|0.9.1|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
2-
freeglut|3.0.0|freeglut|thirdParties@github|https://github.com/SolarFramework/binaries/releases/download
1+
SolARFramework|0.10.0|SolARFramework|SolARBuild@github|https://github.com/SolarFramework/SolarFramework/releases/download
2+

packageignoreinstall.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
SolARFramework xpcf boost grpc
1+
SolARFramework
2+
xpcf
3+
boost
4+
grpc

src/SolAR3DPointsViewerOpengl.cpp

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -113,40 +113,26 @@ FrameworkReturnCode SolAR3DPointsViewerOpengl::display (const std::vector<SRef<C
113113
if (m_firstDisplay)
114114
{
115115
// Compute the center point of the point cloud
116-
Point3Df minPoint, maxPoint;
117-
maxPoint(0)=(std::numeric_limits<size_t>::lowest)();
118-
maxPoint(1)=(std::numeric_limits<size_t>::lowest)();
119-
maxPoint(2)=(std::numeric_limits<size_t>::lowest)();
120-
minPoint(0)=(std::numeric_limits<size_t>::max)();
121-
minPoint(1)=(std::numeric_limits<size_t>::max)();
122-
minPoint(2)=(std::numeric_limits<size_t>::max)();
123-
124-
for (int i = 0; i < m_points.size(); i++)
116+
std::vector<float> xValues, yValues, zValues;
117+
int nbPoints = m_points.size();
118+
for (int i = 0; i < nbPoints; i++)
125119
{
126-
if (points[i]->getX() > maxPoint(0)) maxPoint(0)=points[i]->getX();
127-
if (points[i]->getY() > maxPoint(1)) maxPoint(1)=points[i]->getY();
128-
if (points[i]->getZ() > maxPoint(2)) maxPoint(2)=points[i]->getZ();
129-
if (points[i]->getX() < minPoint(0)) minPoint(0)=points[i]->getX();
130-
if (points[i]->getY() < minPoint(1)) minPoint(1)=points[i]->getY();
131-
if (points[i]->getZ() < minPoint(2)) minPoint(2)=points[i]->getZ();
120+
xValues.push_back(m_points[i]->getX());
121+
yValues.push_back(m_points[i]->getY());
122+
zValues.push_back(m_points[i]->getZ());
132123
}
133-
Vector3f sceneDiagonal;
124+
std::sort(xValues.begin(), xValues.end());
125+
std::sort(yValues.begin(), yValues.end());
126+
std::sort(zValues.begin(), zValues.end());
134127

135128
// Center the scene on the center of the point cloud
136-
m_sceneCenter = Point3Df((minPoint(0)+maxPoint(0))/2.0f, -(minPoint(1)+maxPoint(1))/2.0f, -(minPoint(2)+maxPoint(2))/2.0f);
137-
138-
// Add the camera to the box of the scene
139-
if (m_cameraPose(0,3) > maxPoint(0)) maxPoint(0)=m_cameraPose(0,3);
140-
if (m_cameraPose(1,3) > maxPoint(1)) maxPoint(1)=m_cameraPose(1,3);
141-
if (m_cameraPose(2,3) > maxPoint(2)) maxPoint(2)=m_cameraPose(2,3);
142-
if (m_cameraPose(0,3) < minPoint(0)) minPoint(0)=m_cameraPose(0,3);
143-
if (m_cameraPose(1,3) < minPoint(1)) minPoint(1)=m_cameraPose(1,3);
144-
if (m_cameraPose(2,3) < minPoint(2)) minPoint(2)=m_cameraPose(2,3);
129+
m_sceneCenter = Point3Df(xValues[nbPoints / 2], yValues[nbPoints / 2], zValues[nbPoints / 2]);
145130

146131
// Copmute the diagonal of the box to define the scene Size
147-
sceneDiagonal(0) = maxPoint(0) - minPoint(0);
148-
sceneDiagonal(1) = maxPoint(1) - minPoint(1);
149-
sceneDiagonal(2) = maxPoint(2) - minPoint(2);
132+
Vector3f sceneDiagonal;
133+
sceneDiagonal(0) = std::abs(xValues[nbPoints * 0.99] - xValues[nbPoints * 0.01]);
134+
sceneDiagonal(1) = std::abs(yValues[nbPoints * 0.99] - yValues[nbPoints * 0.01]);
135+
sceneDiagonal(2) = std::abs(zValues[nbPoints * 0.99] - zValues[nbPoints * 0.01]);
150136
m_sceneSize = sceneDiagonal.norm();
151137

152138
// Set the camera according to the center and the size of the scene.
@@ -173,19 +159,11 @@ FrameworkReturnCode SolAR3DPointsViewerOpengl::display( const SRef<PointCloud> p
173159
const std::vector<Transform3Df> & keyframePoses2)
174160
{
175161
std::vector<SRef<CloudPoint>> points_3Df;
176-
const std::vector<CloudPoint> points = pointCloud->getConstPointCloud();
177-
for (auto& point : points)
178-
{
179-
points_3Df.push_back(xpcf::utils::make_shared<CloudPoint>(point));
180-
}
162+
pointCloud->getAllPoints(points_3Df);
181163
std::vector<SRef<CloudPoint>> points2_3Df;
182164
if (pointCloud2 != nullptr)
183165
{
184-
const std::vector<CloudPoint> points2 = pointCloud2->getConstPointCloud();
185-
for (auto& point2 : points2)
186-
{
187-
points2_3Df.push_back(xpcf::utils::make_shared<CloudPoint>(point2));
188-
}
166+
pointCloud2->getAllPoints(points2_3Df);
189167
}
190168
return display(points_3Df, pose, keyframePoses, framePoses, points2_3Df, keyframePoses2);
191169
}

src/glcamera/gl_camera.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ Manages OpenGL camera and trackball/arcball interaction
1111
#include "common.hpp"
1212
#include "gl_camera.hpp"
1313
#include "trackball.hpp"
14+
#include <algorithm>
1415
using namespace std;
1516

1617
#define DOF 10.0f
17-
#define MAXDOF 10000.0f
18+
#define MAXDOF 100000.0f
1819
#define TRACKBALL_R 0.8f
1920
#define WHEEL_MOVE 0.2f
2021

@@ -247,7 +248,7 @@ void gl_camera::setup(const math_vector_3f &scene_center, float scene_size) cons
247248
math_vector_3f center = m_camera_rm * scene_center;
248249

249250
float fardist = -(center[2] - 8*scene_size);//max( -(center[2] - scene_size), scene_size / DOF);
250-
float neardist = max( -(center[2] + scene_size), scene_size / MAXDOF);
251+
float neardist = std::max( -(center[2] + scene_size), scene_size) / MAXDOF;
251252

252253
glMatrixMode(GL_PROJECTION);
253254
glLoadIdentity();

0 commit comments

Comments
 (0)