-
Notifications
You must be signed in to change notification settings - Fork 592
/
Copy pathGlobalModel.h
130 lines (107 loc) · 3.39 KB
/
GlobalModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* This file is part of ElasticFusion.
*
* Copyright (C) 2015 Imperial College London
*
* The use of the code within this file and all code within files that
* make up the software that is ElasticFusion is permitted for
* non-commercial purposes only. The full terms and conditions that
* apply to the code within this file are detailed within the LICENSE.txt
* file and at
* <http://www.imperial.ac.uk/dyson-robotics-lab/downloads/elastic-fusion/elastic-fusion-license/>
* unless explicitly stated. By downloading this file you agree to
* comply with these terms.
*
* If you wish to use any of this code for commercial purposes then
* please email [email protected].
*
*/
#ifndef GLOBALMODEL_H_
#define GLOBALMODEL_H_
#include <pangolin/gl/gl.h>
#include <Eigen/LU>
#include "GPUTexture.h"
#include "IndexMap.h"
#include "Shaders/FeedbackBuffer.h"
#include "Shaders/Shaders.h"
#include "Shaders/Uniform.h"
#include "Utils/Intrinsics.h"
#include "Utils/Resolution.h"
#include "Utils/Stopwatch.h"
class GlobalModel {
public:
GlobalModel();
virtual ~GlobalModel();
void initialise(const FeedbackBuffer& rawFeedback, const FeedbackBuffer& filteredFeedback);
static const int TEXTURE_DIMENSION;
static const int MAX_VERTICES;
static const int NODE_TEXTURE_DIMENSION;
static const int MAX_NODES;
void renderPointCloud(
pangolin::OpenGlMatrix mvp,
const float threshold,
const bool drawUnstable,
const bool drawNormals,
const bool drawColors,
const bool drawPoints,
const bool drawWindow,
const bool drawTimes,
const int time,
const int timeDelta);
const std::pair<GLuint, GLuint>& model();
void fuse(
const Sophus::SE3d& T_wc,
const int& time,
GPUTexture* rgb,
GPUTexture* depthRaw,
GPUTexture* depthFiltered,
GPUTexture* indexMap,
GPUTexture* vertConfMap,
GPUTexture* colorTimeMap,
GPUTexture* normRadMap,
const float depthCutoff,
const float weighting);
void clean(
const Sophus::SE3d& T_wc,
const int& time,
GPUTexture* indexMap,
GPUTexture* vertConfMap,
GPUTexture* colorTimeMap,
GPUTexture* normRadMap,
GPUTexture* depthMap,
const float confThreshold,
std::vector<float>& graph,
const int timeDelta,
const float maxDepth,
const bool isFern);
uint32_t lastCount();
Eigen::Vector4f* downloadMap();
private:
// First is the vbo, second is the fid
std::pair<GLuint, GLuint>* vbos;
int target, renderSource;
const int bufferSize;
GLuint countQuery;
uint32_t count;
std::shared_ptr<Shader> initProgram;
std::shared_ptr<Shader> drawProgram;
std::shared_ptr<Shader> drawSurfelProgram;
// For supersample fusing
std::shared_ptr<Shader> dataProgram;
std::shared_ptr<Shader> updateProgram;
std::shared_ptr<Shader> unstableProgram;
pangolin::GlRenderBuffer renderBuffer;
// We render updated vertices vec3 + confidences to one texture
GPUTexture updateMapVertsConfs;
// We render updated colors vec3 + timestamps to another
GPUTexture updateMapColorsTime;
// We render updated normals vec3 + radii to another
GPUTexture updateMapNormsRadii;
// 16 floats stored column-major yo'
GPUTexture deformationNodes;
GLuint newUnstableVbo, newUnstableFid;
pangolin::GlFramebuffer frameBuffer;
GLuint uvo;
int uvSize;
};
#endif /* GLOBALMODEL_H_ */