SGCT
master (487fac4)
Simple Graphics Cluster Toolkit
Toggle main menu visibility
Loading...
Searching...
No Matches
fisheye.h
Go to the documentation of this file.
1
/*****************************************************************************************
2
* SGCT *
3
* Simple Graphics Cluster Toolkit *
4
* *
5
* Copyright (c) 2012-2026 *
6
* For conditions of distribution and use, see copyright notice in LICENSE.md *
7
****************************************************************************************/
8
9
#ifndef __SGCT__FISHEYE__H__
10
#define __SGCT__FISHEYE__H__
11
12
#include <sgct/sgctexports.h>
13
#include <
sgct/projection/nonlinearprojection.h
>
14
15
#include <
sgct/shaderprogram.h
>
16
#include <
sgct/math.h
>
17
18
namespace
sgct
{
19
20
namespace
config
{
struct
FisheyeProjection
; }
21
class
BaseViewport
;
22
class
User
;
23
class
Window
;
24
28
class
SGCT_EXPORT
FisheyeProjection
final :
public
NonLinearProjection
{
29
public
:
30
enum class
FisheyeMethod
{ FourFaceCube = 0, FiveFaceCube, SixFaceCube };
31
32
FisheyeProjection
(
const
config::FisheyeProjection
&
config
,
const
Window
& parent,
33
User
& user);
34
~FisheyeProjection
() final;
35
39
void
update
(const
vec2
& size) const override;
40
44
void
render
(const
BaseViewport
& viewport,
FrustumMode
frustumMode) const override;
45
49
void
renderCubemap
(
FrustumMode
frustumMode) const override;
50
57
void
setDomeDiameter
(
float
diameter);
58
65
void
setTilt
(
float
angle);
66
72
void
setFOV
(
float
angle);
73
79
void
setCropFactors
(
float
left,
float
right,
float
bottom,
float
top);
80
86
void
setOffset
(
vec3
offset) const;
87
93
void
setBaseOffset
(
vec3
offset);
94
99
void
setIgnoreAspectRatio
(
bool
state);
100
101
void
setKeepAspectRatio
(
bool
state);
102
103
private:
104
void
initVBO() override;
105
void
initViewports() override;
106
void
initShaders() override;
107
108
float
_fov;
109
float
_tilt;
110
float
_diameter;
111
float
_cropLeft;
112
float
_cropRight;
113
float
_cropBottom;
114
float
_cropTop;
115
116
bool
_ignoreAspectRatio = false;
117
bool
_keepAspectRatio;
118
119
mutable
bool
_isOffAxis = false;
120
mutable
vec3
_offset =
vec3
{ 0.f, 0.f, 0.f };
121
vec3
_baseOffset =
vec3
{ 0.f, 0.f, 0.f };
122
mutable
vec3 _totalOffset = vec3{ 0.f, 0.f, 0.f };
123
124
FisheyeMethod _method = FisheyeMethod::FourFaceCube;
125
126
// shader locations
127
struct
{
128
int
cubemap = -1;
129
int
depthCubemap = -1;
130
int
normalCubemap = -1;
131
int
positionCubemap = -1;
132
int
halfFov = -1;
133
int
offset = -1;
134
int
swapColor = -1;
135
int
swapDepth = -1;
136
int
swapNear = -1;
137
int
swapFar = -1;
138
} _shaderLoc;
139
unsigned
int
_vao = 0;
140
unsigned
int
_vbo = 0;
141
ShaderProgram _shader;
142
ShaderProgram _depthCorrectionShader;
143
};
144
145
}
// namespace sgct
146
147
#endif
// __SGCT__FISHEYE__H__
sgct::BaseViewport
This class holds and manages viewportdata and calculates frustums.
Definition
baseviewport.h:27
sgct::FisheyeProjection::setKeepAspectRatio
void setKeepAspectRatio(bool state)
sgct::FisheyeProjection::render
void render(const BaseViewport &viewport, FrustumMode frustumMode) const override
Render the non-linear projection to currently bounded FBO.
sgct::FisheyeProjection::setCropFactors
void setCropFactors(float left, float right, float bottom, float top)
Set the fisheye crop values.
sgct::FisheyeProjection::renderCubemap
void renderCubemap(FrustumMode frustumMode) const override
Render the enabled faces of the cubemap.
sgct::FisheyeProjection::FisheyeProjection
FisheyeProjection(const config::FisheyeProjection &config, const Window &parent, User &user)
sgct::FisheyeProjection::setFOV
void setFOV(float angle)
Set the fisheye/dome field-of-view angle used in the fisheye renderer.
sgct::FisheyeProjection::update
void update(const vec2 &size) const override
Update projection when aspect ratio changes for the viewport.
sgct::FisheyeProjection::~FisheyeProjection
~FisheyeProjection() final
sgct::FisheyeProjection::setDomeDiameter
void setDomeDiameter(float diameter)
Set the dome diameter used in the fisheye renderer (used for the viewplane distance calculations).
sgct::FisheyeProjection::setOffset
void setOffset(vec3 offset) const
Set fisheye offset to render offaxis.
sgct::FisheyeProjection::setIgnoreAspectRatio
void setIgnoreAspectRatio(bool state)
Ignore the framebuffer aspect ratio to allow non-circular fisheye.
sgct::FisheyeProjection::setTilt
void setTilt(float angle)
Set the fisheye/dome tilt angle used in the fisheye renderer.
sgct::FisheyeProjection::FisheyeMethod
FisheyeMethod
Definition
fisheye.h:30
sgct::FisheyeProjection::setBaseOffset
void setBaseOffset(vec3 offset)
Set fisheye base offset to render offaxis.
sgct::NonLinearProjection::NonLinearProjection
NonLinearProjection(const Window &parent)
sgct::User
Helper class for setting user variables.
Definition
user.h:24
sgct::Window
Definition
window.h:46
math.h
sgct::config
Definition
clustermanager.h:22
sgct
Definition
actions.h:16
sgct::FrustumMode
FrustumMode
Definition
definitions.h:23
nonlinearprojection.h
shaderprogram.h
sgct::config::FisheyeProjection
Definition
config.h:204
sgct::vec2
Definition
math.h:47
sgct::vec3
Definition
math.h:56
sgct
projection
fisheye.h
Generated by
1.18.0