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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "libvideostitch/overlay.hpp"
#include "common/angles.hpp"
#include "core/transformGeoParams.hpp"
#include "gpu/allocator.hpp"
#include "overlay/oglShader.hpp"
#include "parse/json.hpp"
#include "util/pngutil.hpp"
#include "libvideostitch/parse.hpp"
#include "libvideostitch/panoDef.hpp"
#include "libvideostitch/frame.hpp"
#include <iostream>
#include <locale.h>
#include <math.h>
#include <memory>
#include <string>
#include <vector>
#if _MSC_VER
// To disable warnings on the external glm library
#pragma warning(push)
#pragma warning(disable : 4201)
#pragma warning(disable : 4310)
#include <glm/ext.hpp>
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#pragma warning(pop)
#else
#include <glm/ext.hpp>
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#endif
namespace VideoStitch {
namespace Input {
class VideoReader;
}
namespace GPU {
struct PanoParams {
int64_t panoTexWidth;
int64_t panoTexHeight;
FrameRate panoFrameRate;
frameid_t panoFrameId;
};
class OverlayTex {
public:
~OverlayTex();
int cubemapFboId = -1;
int cubemapTexId = -1;
int equirectFboId = -1;
int equirectTexId = -1;
int equirectPboId = -1;
int textFboId = -1;
int panoSrcTexId = -1;
int panoSrcPboId = -1;
std::vector<std::pair<const Core::OverlayInputDefinition*, GLuint>> inputTexIds;
mtime_t date = 0;
int64_t panoSrcTexWidth = 0;
int64_t panoSrcTexHeight = 0;
};
class VS_EXPORT Overlayer::Pimpl {
public:
Pimpl();
~Pimpl();
void initialize(const Core::PanoDefinition* pano, const FrameRate& frameRate);
void computeOverlay(std::shared_ptr<Core::PanoOpenGLSurface> surf, std::shared_ptr<Core::PanoOpenGLSurface> oglSurf,
mtime_t date);
void renderOverlay(int winWidth, int winHeight);
private:
friend class Overlayer;
bool createCubemapSurfaceFBAndTexture();
bool createEquirectSurfaceFBAndTexture();
bool createPanoSrcTexture();
bool createInputTexture(const Core::OverlayInputDefinition* input);
bool createSphereAoAndBo();
bool createShader(OGLShader**, const std::string& vShaderCode, const std::string& fShaderCode,
const std::string& gShaderCode);
OverlayTex olTex;
GLuint sphereVbo, sphereVao;
OGLShader *sphereShader, *equirectShader, *texturedQuadShader;
PanoParams pParams;
Core::QuaternionCurve* stitcherOrientationCurve;
Core::QuaternionCurve* stitcherStabilizationCurve;
Pimpl(const Pimpl&);
const Pimpl& operator=(const Pimpl&);
};
} // namespace GPU
} // namespace VideoStitch