Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Data Structures | Typedefs | Enumerations | Functions
omni::visual Namespace Reference

Namespace for OpenGL visualization. More...

Namespaces

 detail
 
 util
 

Data Structures

class  BoundingBox
 Visualizer for draing a bounding box from bounds. More...
 
class  Box
 Box with subdivisions for drawing. More...
 
class  CameraInterface
 A generic camera interface. More...
 
class  Circle
 Visualizer for drawing a circle with VBO. More...
 
struct  ContextBoundPtr
 A pointer template which is free'd together with its context Holds an internal object which is responsible for freeing the held object when OpenGL context is free'd. More...
 
class  Framebuffer32F
 Framebuffer with 32-bit float pixel depth per channel. More...
 
class  Grid
 A cartesian grid with lining adapted to distance. More...
 
class  Interface
 Basic visual interface. More...
 
struct  Light
 A light with position and phong shader attributes. More...
 
class  PerspectiveCamera
 A perspective camera. More...
 
class  Plane
 A plane with n x m grid points Vertex data is not stored on host, it is copied to GPU directly. Plane has dimensions [-0.5,-0.5] - [0.5,0.5]. More...
 
class  Projector
 Visualizer for drawing a projector with halo. More...
 
struct  Rectangle
 Visualizer helper class for drawing a rectangle in an OpenGL context. More...
 
class  Scene
 A class that holds settings and elements for session 3d visualization Belongs to a session. More...
 
class  Session
 Base class for drawing a session. More...
 
class  ShaderCompiler
 Adds #include functionality to shader source code Compiles source code file with included files or compiles a shader. More...
 
class  Sphere
 Draw Handler for visualizing a centered sphere. More...
 
class  Texture32F
 RGBA Texture with 32-bit float for each channel. More...
 
struct  Tracker
 
class  Tuning
 Tuning visualizer. More...
 
struct  UniformHandler
 Uniform handler for a shader program Cares about bind and releasing shaders and texture uniforms. Should only be used with the visual::useShader function. More...
 
struct  VBO
 A small Vertex Buffer Object class. More...
 
class  VertexVBO
 Utility class for storing and drawing VBO data. More...
 
class  WarpGrid
 Draw Handler for WarpGrid. More...
 

Typedefs

typedef std::function< void(QOpenGLFunctions &)> ContextFunctor
 

Enumerations

enum  ProjectorViewMode { ProjectorViewMode::INSIDE, ProjectorViewMode::OUTSIDE, ProjectorViewMode::BOTH }
 
enum  EditMode { EditMode::CAMERA, EditMode::MOVE, EditMode::ROTATE }
 Enum class to determine which scene element is edited. More...
 
enum  MoveMode { MoveMode::MOVE_X, MoveMode::MOVE_Y, MoveMode::MOVE_Z, MoveMode::MOVE_XY }
 Which direction to move with mouse. More...
 
enum  RotateMode { RotateMode::PITCH, RotateMode::YAW, RotateMode::ROLL }
 Rotate pitch, yaw, roll. More...
 
enum  ProjectorSelectionMode { ProjectorSelectionMode::ALL, ProjectorSelectionMode::SELECTED, ProjectorSelectionMode::NONE }
 

Functions

bool operator== (CameraInterface const &_lhs, CameraInterface const &_rhs)
 Test for equality. More...
 
void contextSwitch (QOpenGLContext *_context, ContextFunctor f)
 
void primaryContextSwitch (ContextFunctor)
 Switch to primary context to create OpenGL objects like textures etc. More...
 
void withCurrentContext (ContextFunctor)
 Do OpenGL operations with current context, if it exists. More...
 
bool operator== (Light const &_lhs, Light const &_rhs)
 Test for equality. ScreenSetup is ignored. More...
 
bool operator== (PerspectiveCamera const &_lhs, PerspectiveCamera const &_rhs)
 Test for equality. ScreenSetup is ignored. More...
 
bool operator== (Scene const &_lhs, Scene const &_rhs)
 
void initShader (QOpenGLShaderProgram &_s, const char *_filename)
 Initialize shader: load from file and compile. More...
 
void initShader (std::unique_ptr< QOpenGLShaderProgram > &_s, const char *_filename)
 Initialize shader: load from file and compile. More...
 
void initShader (ContextBoundPtr< QOpenGLShaderProgram > &_s, const char *_filename)
 Initialize shader: load from file and compile. More...
 
void useShader (QOpenGLShaderProgram &_s, std::function< void(UniformHandler &)> f)
 Use shader with and do uniform assignment and drawing inside functor. More...
 
bool operator== (Tracker const &_lhs, Tracker const &_rhs)
 Test for equality. ScreenSetup is ignored. More...
 

Detailed Description

Namespace for OpenGL visualization.

Typedef Documentation

typedef std::function<void (QOpenGLFunctions&)> omni::visual::ContextFunctor

Enumeration Type Documentation

Enum class to determine which scene element is edited.

Enumerator
CAMERA 
MOVE 
ROTATE 

Which direction to move with mouse.

Enumerator
MOVE_X 
MOVE_Y 
MOVE_Z 
MOVE_XY 

Rotate pitch, yaw, roll.

Enumerator
PITCH 
YAW 
ROLL 

Function Documentation

void omni::visual::contextSwitch ( QOpenGLContext *  _context,
ContextFunctor  f 
)
25  {
26  auto *_current = QOpenGLContext::currentContext();
27  if (!_current) return;
28 
29  if (_context != _current) {
30  _context->makeCurrent(_current->surface());
31  }
32 
34 
35  if (_context != _current) {
36  _current->makeCurrent(_current->surface());
37  }
38  }
void withCurrentContext(ContextFunctor f)
Do OpenGL operations with current context, if it exists.
Definition: ContextSwitch.cpp:45
void omni::visual::initShader ( QOpenGLShaderProgram &  _s,
const char *  _filename 
)

Initialize shader: load from file and compile.

27  {
28  QString _vertSrc =
29  ShaderCompiler::compile(":/shaders/" + QString(_filename) + ".vert");
30  QString _fragmentSrc =
31  ShaderCompiler::compile(":/shaders/" + QString(_filename) + ".frag");
32 
33  _s.addShaderFromSourceCode(QOpenGLShader::Vertex,
34  _vertSrc);
35  _s.addShaderFromSourceCode(QOpenGLShader::Fragment,
36  _fragmentSrc);
37  _s.link();
38  }
void omni::visual::initShader ( std::unique_ptr< QOpenGLShaderProgram > &  _s,
const char *  _filename 
)

Initialize shader: load from file and compile.

Dont do anything if shader is already allocated

41  {
42  /// Dont do anything if shader is already allocated
43  if (!!_s) return;
44 
45  _s.reset(new QOpenGLShaderProgram());
46  initShader(*_s, _filename);
47  }
void initShader(ContextBoundPtr< QOpenGLShaderProgram > &_s, const char *_filename)
Initialize shader: load from file and compile.
Definition: Shader.cpp:49
void omni::visual::initShader ( ContextBoundPtr< QOpenGLShaderProgram > &  _s,
const char *  _filename 
)

Initialize shader: load from file and compile.

Dont do anything if shader is already allocated

50  {
51  /// Dont do anything if shader is already allocated
52  if (!!_s) return;
53 
54  if (_s.reset(new QOpenGLShaderProgram())) {
55  initShader(*_s, _filename);
56  }
57  }
void initShader(ContextBoundPtr< QOpenGLShaderProgram > &_s, const char *_filename)
Initialize shader: load from file and compile.
Definition: Shader.cpp:49
bool omni::visual::operator== ( PerspectiveCamera const &  _lhs,
PerspectiveCamera const &  _rhs 
)

Test for equality. ScreenSetup is ignored.

77  {
78  return
79  (static_cast<CameraInterface const&>(_lhs) == static_cast<CameraInterface const&>(_rhs)) &&
81  }
#define OMNI_TEST_MEMBER_EQUAL(member)
Definition: util.h:125
bool omni::visual::operator== ( CameraInterface const &  _lhs,
CameraInterface const &  _rhs 
)

Test for equality.

Test for equality. ScreenSetup is ignored.

100  {
101  return
102  OMNI_TEST_MEMBER_EQUAL(up_) &&
103  OMNI_TEST_MEMBER_EQUAL(near_) &&
105  }
#define OMNI_TEST_MEMBER_EQUAL(member)
Definition: util.h:125
bool omni::visual::operator== ( Tracker const &  _lhs,
Tracker const &  _rhs 
)

Test for equality. ScreenSetup is ignored.

121  {
122  return
123  OMNI_TEST_MEMBER_EQUAL(center_) &&
124  OMNI_TEST_MEMBER_EQUAL(direction_);
125  }
#define OMNI_TEST_MEMBER_EQUAL(member)
Definition: util.h:125
bool omni::visual::operator== ( Light const &  _lhs,
Light const &  _rhs 
)

Test for equality. ScreenSetup is ignored.

152  {
153  return
154  OMNI_TEST_MEMBER_EQUAL(ambient_) &&
155  OMNI_TEST_MEMBER_EQUAL(diffuse_) &&
156  OMNI_TEST_MEMBER_EQUAL(specular_) &&
157  OMNI_TEST_MEMBER_EQUAL(intensity_);
158  }
#define OMNI_TEST_MEMBER_EQUAL(member)
Definition: util.h:125
bool omni::visual::operator== ( Scene const &  _lhs,
Scene const &  _rhs 
)
233  {
234  return
235  OMNI_TEST_MEMBER_EQUAL(size_) &&
236  OMNI_TEST_MEMBER_EQUAL(displayInput_) &&
237  OMNI_TEST_MEMBER_EQUAL(displayGrid_) &&
238  OMNI_TEST_MEMBER_EQUAL(displayProjectors_) &&
239  OMNI_TEST_MEMBER_EQUAL(displayProjectedAreas_) &&
240  OMNI_TEST_MEMBER_EQUAL(editMode_) &&
241  OMNI_TEST_MEMBER_EQUAL(rotateMode_) &&
242  OMNI_TEST_MEMBER_EQUAL(moveMode_) &&
243  OMNI_TEST_MEMBER_EQUAL(lights_) &&
244  OMNI_TEST_MEMBER_EQUAL(cameras_);
245  }
#define OMNI_TEST_MEMBER_EQUAL(member)
Definition: util.h:125
void omni::visual::primaryContextSwitch ( ContextFunctor  f)

Switch to primary context to create OpenGL objects like textures etc.

40  {
41  if (!QOpenGLContext::globalShareContext()) return;
42  contextSwitch(QOpenGLContext::globalShareContext(), f);
43  }
void contextSwitch(QOpenGLContext *_context, ContextFunctor f)
Definition: ContextSwitch.cpp:25
void omni::visual::useShader ( QOpenGLShaderProgram &  _s,
std::function< void(UniformHandler &)>  f 
)

Use shader with and do uniform assignment and drawing inside functor.

60  {
61  withCurrentContext([&](QOpenGLFunctions& _gl) {
62  _s.bind();
63  {
64  UniformHandler _handler(_gl, _s);
65  f(_handler);
66 
67  // Destructor of handler is called here implicitly
68  // by RAII to unbind all textures
69  }
70  _s.release();
71  });
72  }
void withCurrentContext(ContextFunctor f)
Do OpenGL operations with current context, if it exists.
Definition: ContextSwitch.cpp:45
void omni::visual::withCurrentContext ( ContextFunctor  f)

Do OpenGL operations with current context, if it exists.

46  {
47  auto _currentContext = QOpenGLContext::currentContext();
48  if (!_currentContext) return;
49 
50  if (!_currentContext->isValid()) {
51  return;
52  }
53  QOpenGLFunctions glFuncs(_currentContext);
54  f(glFuncs);
55  }