Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Private Attributes
omni::input::Framebuffer Class Reference

Input object that is renderer to a framebuffer. More...

#include <Framebuffer.h>

Inheritance diagram for omni::input::Framebuffer:
Inheritance graph
[legend]
Collaboration diagram for omni::input::Framebuffer:
Collaboration graph
[legend]

Public Member Functions

 Framebuffer (input::Interface const *=nullptr)
 
virtual ~Framebuffer ()
 
virtual QSize size () const
 An input must return width and height information. More...
 
virtual void setSize (QSize const &)
 
GLuint textureId () const
 An input must return an OpenGL texture ID. More...
 
virtual void destroy ()
 
virtual void toPropertyMap (PropertyMap &) const
 Serialize to property map. More...
 
virtual void fromPropertyMap (PropertyMap const &)
 Deserialize from property map. More...
 
- Public Member Functions inherited from omni::input::Interface
 Interface (Interface const *_parent=nullptr)
 
virtual ~Interface ()
 Virtual destructor. More...
 
virtual void update ()
 Update interface. More...
 
size_t numberOfChildren () const
 
int width () const
 Return width from size. More...
 
int height () const
 Return height from size. More...
 
virtual categoryset_type categories () const
 Input can have a fixed set of categories. More...
 
QString infoText () const
 Optional info text. More...
 
virtual QWidget * widget ()
 Make new parameter widget. More...
 
virtual QWidget * controlWidget ()
 Make new large control widget for live mode. More...
 
virtual bool canAdd ()
 Returns true if this input can be added E.g., an input can be added after an initial settings dialog was approved or it has valid settings. More...
 
virtual bool canHaveChildren () const
 
int setUpdateCallback (callback_type _updatedCallback)
 Insert a new callback when input has updated and returns its unique id. More...
 
callback_type updatedCallback (int _id)
 
void triggerUpdateCallbacks () const
 
void removeUpdateCallback (int _id)
 
InterfaceaddInput (QString const &_id, Id const &_typeId)
 Add new input with given type id. Returns nullptr if input with typeid does not exist. More...
 
InterfaceaddInput (QString const &_id, Interface *_i)
 Input with id and return pointer to input when successfully added. More...
 
QString getId (Interface const *) const
 Get id of child interface. More...
 
virtual void removeInput (QString const &_id)
 Remove input with id. More...
 
InterfacegetInput (QString const &_id)
 Return pointer of input with id, nullptr if input does not exist. More...
 
Interface const * getInput (QString const &_id) const
 Return pointer of input with id, nullptr if input does not exist. More...
 
container_type const & children () const
 Return children. More...
 
Interface const * parent () const
 Return parent interface (const version) More...
 
QString path () const
 Return absolute path of interface. More...
 
void setParent (Interface *)
 Set new parent. More...
 
inputlist_type getAllInputs () const
 Returns a list of input maintained by controller, except this one. 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...
 

Protected Member Functions

QOpenGLFramebufferObject * framebuffer ()
 
QOpenGLFramebufferObject const * framebuffer () const
 
void setupFramebuffer (QSize const &_size)
 
void setupFramebuffer ()
 

Private Attributes

QSize size_
 
ContextBoundPtr
< QOpenGLFramebufferObject > 
framebuffer_
 

Additional Inherited Members

- Public Types inherited from omni::input::Interface
typedef Interface interface_type
 
typedef std::vector< Interface
const * > 
inputlist_type
 
typedef std::map< QString,
std::unique_ptr< Interface > > 
container_type
 
typedef std::function< void()> callback_type
 
typedef std::set< QString > categoryset_type
 

Detailed Description

Input object that is renderer to a framebuffer.

Constructor & Destructor Documentation

omni::input::Framebuffer::Framebuffer ( input::Interface const *  _input = nullptr)
27  :
28  input::Interface(_input),
29  size_(0,0) {
30  }
QSize size_
Definition: Framebuffer.h:53
virtual omni::input::Framebuffer::~Framebuffer ( )
inlinevirtual
33 {};

Member Function Documentation

void omni::input::Framebuffer::destroy ( )
virtual

Reimplemented in omni::input::TestImage.

32  {
33  framebuffer_.reset();
34  }
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
QOpenGLFramebufferObject * omni::input::Framebuffer::framebuffer ( )
protected
49  {
50  return framebuffer_.get();
51  }
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
QOpenGLFramebufferObject const * omni::input::Framebuffer::framebuffer ( ) const
protected
53  {
54  return framebuffer_.get();
55  }
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
void omni::input::Framebuffer::fromPropertyMap ( PropertyMap const &  _map)
virtual

Deserialize from property map.

Deserialize from stream.

Reimplemented from omni::input::Interface.

Reimplemented in omni::input::TestImage.

97  {
99  size_ = _map.getValue("size",QSize(0,0));
101  }
virtual void fromPropertyMap(PropertyMap const &)
Deserialize from property map.
Definition: Interface.cpp:156
QSize size_
Definition: Framebuffer.h:53
void setupFramebuffer()
Definition: Framebuffer.cpp:88
void omni::input::Framebuffer::setSize ( QSize const &  _size)
virtual
45  {
46  setupFramebuffer(_size);
47  }
void setupFramebuffer()
Definition: Framebuffer.cpp:88
void omni::input::Framebuffer::setupFramebuffer ( QSize const &  _size)
protected
57  {
58  if (_size == QSize(0,0)) {
59  framebuffer_.reset();
60  return;
61  }
62 
63  bool _reset = !framebuffer_;
64  if (framebuffer_) {
65  _reset |= framebuffer_->size() != _size;
66  }
67 
68  // Framebuffer is already setup, no work to do
69  if (!_reset) return;
70 
71  primaryContextSwitch([&](QOpenGLFunctions& _) {
72  QOpenGLFramebufferObjectFormat _format;
73  _format.setMipmap(false);
74  _format.setSamples(0);
75  _format.setTextureTarget(GL_TEXTURE_RECTANGLE);
76  _format.setAttachment(QOpenGLFramebufferObject::NoAttachment);
77  framebuffer_.reset(new QOpenGLFramebufferObject(
78  _size.width(),
79  _size.height(),_format));
80  _.glBindTexture(GL_TEXTURE_RECTANGLE, framebuffer_->texture());
81  _.glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
82  _.glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
83  _.glBindTexture(GL_TEXTURE_RECTANGLE, 0);
84  size_ = _size;
85  });
86  }
QSize size_
Definition: Framebuffer.h:53
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
void primaryContextSwitch(ContextFunctor f)
Switch to primary context to create OpenGL objects like textures etc.
Definition: ContextSwitch.cpp:40
void omni::input::Framebuffer::setupFramebuffer ( )
protected
88  {
90  }
virtual QSize size() const
An input must return width and height information.
Definition: Framebuffer.cpp:41
void setupFramebuffer()
Definition: Framebuffer.cpp:88
QSize omni::input::Framebuffer::size ( ) const
virtual

An input must return width and height information.

Implements omni::input::Interface.

41  {
42  return !framebuffer_ ? size_ : framebuffer_->size();
43  }
QSize size_
Definition: Framebuffer.h:53
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
GLuint omni::input::Framebuffer::textureId ( ) const
virtual

An input must return an OpenGL texture ID.

Implements omni::input::Interface.

37  {
38  return !framebuffer_ ? 0 : framebuffer_->texture();
39  }
ContextBoundPtr< QOpenGLFramebufferObject > framebuffer_
Definition: Framebuffer.h:54
void omni::input::Framebuffer::toPropertyMap ( PropertyMap &  _map) const
virtual

Serialize to property map.

Serialize to stream.

Reimplemented from omni::input::Interface.

Reimplemented in omni::input::TestImage.

92  {
93  _map("size",size());
95  }
virtual QSize size() const
An input must return width and height information.
Definition: Framebuffer.cpp:41
virtual void toPropertyMap(PropertyMap &) const
Serialize to property map.
Definition: Interface.cpp:145

Field Documentation

ContextBoundPtr<QOpenGLFramebufferObject> omni::input::Framebuffer::framebuffer_
private
QSize omni::input::Framebuffer::size_
private

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