Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Private Attributes
omni::canvas::Interface Class Referenceabstract

Abstract interface for a canvas A canvas represents the surface on which the projection is performed. It might be a dome or a planar surface. More...

#include <Interface.h>

Inheritance diagram for omni::canvas::Interface:
Inheritance graph
[legend]
Collaboration diagram for omni::canvas::Interface:
Collaboration graph
[legend]

Public Types

enum  ViewMode { ViewMode::INSIDE, ViewMode::OUTSIDE, ViewMode::BOTH }
 

Public Member Functions

 Interface ()
 
virtual ~Interface ()
 Virtual destructor. More...
 
ViewMode viewMode () const
 Return current view mode. More...
 
void setViewMode (ViewMode _viewMode)
 Set view mode. More...
 
void drawWithViewMode () const
 Draws with culled front or back faces, depending on view mode. More...
 
virtual void drawAux () const
 Draws auxiliary elements which are not used for mapping (e.g. More...
 
virtual Box bounds () const =0
 Abstract method for returning bounding box of canvas. More...
 
virtual QVector3D center () const
 Spectator's center of canvas (center of bounding box by default) More...
 
virtual qreal radius () const
 Canvas radius (is half of size by default) More...
 
AffineTransform const & transform () const
 Return const ref to affine transform. More...
 
AffineTransform & transform ()
 Return ref to affine transform. More...
 
void setTransform (AffineTransform const &_transform)
 Set new affine transform. More...
 
visual::Scene const * scene () const
 The scene this canvas belongs to. More...
 
void setScene (visual::Scene const *)
 Set the scene this canvas belongs to. Is set automatically when a canvas is added to a session. More...
 
virtual QMatrix4x4 matrix () const
 Transformation matrix for canvas. More...
 
virtual ui::CanvasParameterswidget ()=0
 Returns pointer to new parameter widget. More...
 
virtual void toPropertyMap (PropertyMap &) const
 Write mapping to stream. More...
 
virtual void fromPropertyMap (PropertyMap const &)
 Read mapping from stream. More...
 
- Public Member Functions inherited from omni::TypeIdInterface
virtual ~TypeIdInterface ()
 
virtual Id getTypeId () const =0
 Returns type id of object. More...
 
virtual void registerInFactory () const =0
 Register the inherited class in factory. More...
 
- Public Member Functions inherited from omni::visual::Interface
virtual void draw () const =0
 Abstract method for visualing. More...
 
virtual void update ()
 Update geometry. More...
 

Protected Attributes

bool needsUpdate_ = true
 

Private Attributes

AffineTransform transform_
 
ViewMode viewMode_ = ViewMode::BOTH
 
visual::Scene const * scene_ = nullptr
 

Additional Inherited Members

- Static Protected Member Functions inherited from omni::visual::Interface
static void vertex3 (QVector3D const &)
 glVertex3f from QVector3D More...
 
static void visualLine (QVector3D const &_from, QVector3D const &_to)
 Draws a line. More...
 
static void color (QColor _color, float _alpha=1.0)
 glColor4f from QColor More...
 

Detailed Description

Abstract interface for a canvas A canvas represents the surface on which the projection is performed. It might be a dome or a planar surface.

Member Enumeration Documentation

Constructor & Destructor Documentation

omni::canvas::Interface::Interface ( )
28  {
29  // Disable scaling and translation by default
30  transform_.setTranslationEnabled(false);
31  transform_.setScaleEnabled(false);
32  }
AffineTransform transform_
Definition: Interface.h:118
omni::canvas::Interface::~Interface ( )
virtual

Virtual destructor.

Reimplemented from omni::visual::Interface.

34 {}

Member Function Documentation

virtual Box omni::canvas::Interface::bounds ( ) const
pure virtual

Abstract method for returning bounding box of canvas.

Implemented in omni::canvas::Dome, and omni::canvas::Envelope.

QVector3D omni::canvas::Interface::center ( ) const
virtual

Spectator's center of canvas (center of bounding box by default)

38  {
39  return (bounds().max() + bounds().min()) * 0.5;
40  }
virtual Box bounds() const =0
Abstract method for returning bounding box of canvas.
virtual void omni::canvas::Interface::drawAux ( ) const
inlinevirtual

Draws auxiliary elements which are not used for mapping (e.g.

Reimplemented in omni::canvas::Dome.

74  {}
void omni::canvas::Interface::drawWithViewMode ( ) const

Draws with culled front or back faces, depending on view mode.

42  {
43  withCurrentContext([&](QOpenGLFunctions& _) {
44  switch (viewMode_) {
45  case ViewMode::INSIDE:
46  _.glEnable(GL_CULL_FACE);
47  _.glCullFace(GL_FRONT);
48  break;
49  case ViewMode::OUTSIDE:
50  _.glEnable(GL_CULL_FACE);
51  _.glCullFace(GL_BACK);
52  break;
53  case ViewMode::BOTH:
54  _.glDisable(GL_CULL_FACE);
55  break;
56  }
57  this->draw();
58  _.glDisable(GL_CULL_FACE);
59  });
60  }
ViewMode viewMode_
Definition: Interface.h:119
void withCurrentContext(ContextFunctor f)
Do OpenGL operations with current context, if it exists.
Definition: ContextSwitch.cpp:45
virtual void draw() const =0
Abstract method for visualing.
void omni::canvas::Interface::fromPropertyMap ( PropertyMap const &  _map)
virtual

Read mapping from stream.

Reimplemented in omni::canvas::Dome.

108  {
109  _map.get("transform",transform_);
110  }
AffineTransform transform_
Definition: Interface.h:118
QMatrix4x4 omni::canvas::Interface::matrix ( ) const
virtual

Transformation matrix for canvas.

99  {
100  return transform_.matrix();
101  }
AffineTransform transform_
Definition: Interface.h:118
qreal omni::canvas::Interface::radius ( ) const
virtual

Canvas radius (is half of size by default)

Reimplemented in omni::canvas::Dome.

64  {
65  return bounds().size().length() * 0.5;
66  }
virtual Box bounds() const =0
Abstract method for returning bounding box of canvas.
visual::Scene const * omni::canvas::Interface::scene ( ) const

The scene this canvas belongs to.

93  {
94  return scene_;
95  }
visual::Scene const * scene_
Definition: Interface.h:120
void omni::canvas::Interface::setScene ( visual::Scene const *  _scene)

Set the scene this canvas belongs to. Is set automatically when a canvas is added to a session.

89  {
90  scene_=_scene;
91  }
visual::Scene const * scene_
Definition: Interface.h:120
void omni::canvas::Interface::setTransform ( AffineTransform const &  _transform)

Set new affine transform.

76  {
77  transform_ = _transform;
78  }
AffineTransform transform_
Definition: Interface.h:118
void omni::canvas::Interface::setViewMode ( ViewMode  _viewMode)

Set view mode.

84  {
85  needsUpdate_ = viewMode_ != _viewMode;
86  viewMode_ = _viewMode;
87  }
ViewMode viewMode_
Definition: Interface.h:119
bool needsUpdate_
Definition: Interface.h:115
void omni::canvas::Interface::toPropertyMap ( PropertyMap &  _map) const
virtual

Write mapping to stream.

Reimplemented in omni::canvas::Dome.

103  {
104  _map("transform",transform_);
105  }
AffineTransform transform_
Definition: Interface.h:118
AffineTransform const & omni::canvas::Interface::transform ( ) const

Return const ref to affine transform.

68  {
69  return transform_;
70  }
AffineTransform transform_
Definition: Interface.h:118
AffineTransform & omni::canvas::Interface::transform ( )

Return ref to affine transform.

72  {
73  return transform_;
74  }
AffineTransform transform_
Definition: Interface.h:118
Interface::ViewMode omni::canvas::Interface::viewMode ( ) const

Return current view mode.

80  {
81  return viewMode_;
82  }
ViewMode viewMode_
Definition: Interface.h:119
virtual ui::CanvasParameters* omni::canvas::Interface::widget ( )
pure virtual

Returns pointer to new parameter widget.

Field Documentation

bool omni::canvas::Interface::needsUpdate_ = true
protected
visual::Scene const* omni::canvas::Interface::scene_ = nullptr
private
AffineTransform omni::canvas::Interface::transform_
private
ViewMode omni::canvas::Interface::viewMode_ = ViewMode::BOTH
private

The documentation for this class was generated from the following files: