SGCT
master (487fac4)
Simple Graphics Cluster Toolkit
Toggle main menu visibility
Loading...
Searching...
No Matches
cubemap.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__CUBEMAP__H__
10
#define __SGCT__CUBEMAP__H__
11
12
#include <sgct/sgctexports.h>
13
#include <
sgct/projection/nonlinearprojection.h
>
14
15
#include <
sgct/math.h
>
16
#include <
sgct/shaderprogram.h
>
17
#include <array>
18
#include <string>
19
#include <vector>
20
21
#ifdef SGCT_HAS_NDI
22
#include <Processing.NDI.Lib.h>
23
#endif
// SGCT_HAS_NDI
24
25
#ifdef SGCT_HAS_SPOUT
26
struct
SPOUTLIBRARY;
27
using
SPOUTHANDLE
= SPOUTLIBRARY*;
28
#endif
// SGCT_HAS_SPOUT
29
30
namespace
sgct
{
31
32
namespace
config {
struct
CubemapProjection; }
33
class
BaseViewport;
34
class
OffScreenBuffer;
35
class
User;
36
class
Window;
37
41
class
SGCT_EXPORT
CubemapProjection
final :
public
NonLinearProjection
{
42
public
:
43
CubemapProjection
(
const
config::CubemapProjection
&
config
,
44
const
Window
& parent,
User
& user);
45
~CubemapProjection
()
override
;
46
50
void
update
(
const
vec2
& size)
const override
;
51
55
void
render
(
const
BaseViewport
& viewport,
FrustumMode
frustumMode)
const override
;
56
60
61
void
setSpoutRigOrientation
(
vec3
orientation);
62
63
private
:
64
void
initTextures(
unsigned
int
internalFormat)
override
;
65
void
initVBO()
override
;
66
void
initViewports()
override
;
67
void
initShaders()
override
;
68
void
initFBO(
unsigned
int
internalFormat,
int
nSamples)
override
;
69
70
void
renderCubemap(
FrustumMode
frustumMode)
const override
;
71
72
std::unique_ptr<OffScreenBuffer> _spoutFBO;
73
74
struct
Cubeface {
75
bool
enabled =
true
;
76
unsigned
int
texture = 0;
77
78
#ifdef SGCT_HAS_SPOUT
79
struct
{
80
SPOUTHANDLE
handle
=
nullptr
;
81
} spout;
82
#endif
// SGCT_HAS_SPOUT
83
84
#ifdef SGCT_HAS_NDI
85
mutable
struct
{
86
NDIlib_send_instance_t
handle
=
nullptr
;
87
NDIlib_video_frame_v2_t
videoFrame
;
88
std::string
name
;
89
std::vector<std::byte>
videoBufferPing
;
90
std::vector<std::byte>
videoBufferPong
;
91
std::vector<std::byte>*
currentVideoBuffer
=
nullptr
;
92
} ndi;
93
#endif
// SGCT_HAS_NDI
94
};
95
std::array<Cubeface, 6> _cubeFaces;
96
97
#ifdef SGCT_HAS_SPOUT
98
const
bool
_spoutEnabled;
99
const
std::string _spoutName;
100
#endif
// SGCT_HAS_SPOUT
101
102
#ifdef SGCT_HAS_NDI
103
const
bool
_ndiEnabled;
104
const
std::string _ndiName;
105
const
std::string _ndiGroups;
106
#endif
// SGCT_HAS_NDI
107
108
vec3
_rigOrientation =
vec3
{ 0.f, 0.f, 0.f };
109
110
unsigned
int
_vao = 0;
111
unsigned
int
_vbo = 0;
112
ShaderProgram
_shader;
113
unsigned
int
_blitFbo = 0;
114
};
115
116
}
// namespace sgct
117
118
#endif
// __SGCT__CUBEMAP__H__
sgct::BaseViewport
This class holds and manages viewportdata and calculates frustums.
Definition
baseviewport.h:27
sgct::CubemapProjection::render
void render(const BaseViewport &viewport, FrustumMode frustumMode) const override
Render the non linear projection to currently bounded FBO.
sgct::CubemapProjection::~CubemapProjection
~CubemapProjection() override
sgct::CubemapProjection::setSpoutRigOrientation
void setSpoutRigOrientation(vec3 orientation)
Render the enabled faces of the cubemap.
sgct::CubemapProjection::update
void update(const vec2 &size) const override
Update projection when aspect ratio changes for the viewport.
sgct::CubemapProjection::CubemapProjection
CubemapProjection(const config::CubemapProjection &config, const Window &parent, User &user)
sgct::NonLinearProjection::NonLinearProjection
NonLinearProjection(const Window &parent)
sgct::ShaderProgram
Class for handling compiling, linking and using shader programs.
Definition
shaderprogram.h:24
sgct::User
Helper class for setting user variables.
Definition
user.h:24
sgct::Window
Definition
window.h:46
SPOUTHANDLE
SPOUTLIBRARY * SPOUTHANDLE
Definition
cubemap.h:27
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::CubemapProjection::Cubeface::[struct].ndi::currentVideoBuffer
std::vector< std::byte > * currentVideoBuffer
sgct::CubemapProjection::Cubeface::[struct].ndi::videoFrame
NDIlib_video_frame_v2_t videoFrame
sgct::CubemapProjection::Cubeface::[struct].ndi::videoBufferPing
std::vector< std::byte > videoBufferPing
sgct::CubemapProjection::Cubeface::[struct].ndi::handle
NDIlib_send_instance_t handle
sgct::CubemapProjection::Cubeface::[struct].ndi::name
std::string name
sgct::CubemapProjection::Cubeface::[struct].ndi::videoBufferPong
std::vector< std::byte > videoBufferPong
sgct::CubemapProjection::Cubeface::[struct].spout::handle
SPOUTHANDLE handle
sgct::config::CubemapProjection
Definition
config.h:144
sgct::vec2
Definition
math.h:47
sgct::vec3
Definition
math.h:56
sgct
projection
cubemap.h
Generated by
1.18.0