Ocean
Ocean::Rendering::WindowFramebuffer Class Reference

This class is the base class for all window framebuffers. More...

Inheritance diagram for Ocean::Rendering::WindowFramebuffer:

Public Member Functions

FramebufferType framebufferType () const override
 Returns the type of this framebuffer. More...
 
virtual size_t id () const
 Returns the platform dependent framebuffer base id or handle. More...
 
virtual bool initializeById (const size_t id, const FramebufferRef &shareFramebuffer=FramebufferRef())
 Sets the platform dependent framebuffer base id or handle and initializes the framebuffer. More...
 
ObjectType type () const override
 Returns the type of this object. More...
 
- Public Member Functions inherited from Ocean::Rendering::Framebuffer
virtual const Scenesscenes () const
 Returns the scene connected with this framebuffer. More...
 
virtual const ViewRefview () const
 Returns the view connected with this framebuffer. More...
 
virtual void viewport (unsigned int &left, unsigned int &top, unsigned int &width, unsigned int &height) const
 Returns the viewport of this framebuffer. More...
 
virtual FaceMode faceMode () const
 Returns the global face mode of the entire framebuffer. More...
 
virtual CullingMode cullingMode () const
 Returns the global face culling mode of the entire framebuffer. More...
 
virtual LightingMode lightingMode () const
 Returns the global lighting mode of the entire framebuffer. More...
 
virtual RenderTechnique renderTechnique () const
 Returns the render technique of the entire framebuffer. More...
 
virtual bool isQuadbufferedStereoSupported () const
 Returns whether the framebuffer supports quad-buffered stereo views. More...
 
virtual bool isAntialiasingSupported (const unsigned int buffers) const
 Returns whether the framebuffer supports hardware anti-aliasing. More...
 
virtual bool isAntialiasing () const
 Returns whether the framebuffer uses hardware anti-aliasing. More...
 
virtual ShadowTechnique shadowTechnique () const
 Returns the shadow technique of the entire framebuffer. More...
 
virtual HomogenousMatrix4 device_T_display () const
 Returns the transformation between display and device. More...
 
virtual bool verticalSynchronization () const
 Returns whether the framebuffer is synchronized with the vertical sync signal of the display device. More...
 
virtual std::string extensions () const
 Returns all supported extensions of this framebuffer. More...
 
virtual bool hasExtension (const std::string &extension) const
 Returns whether the framebuffer and thus e.g. More...
 
virtual void addScene (const SceneRef &scene)
 Adds a new scene to the framebuffer. More...
 
virtual void removeScene (const SceneRef &scene)
 Removes a scene from the framebuffer. More...
 
virtual void clearScenes ()
 Clears all scenes registered at the framebuffer. More...
 
virtual void setView (const ViewRef &view)
 Connects a view with this framebuffer. More...
 
virtual void setViewport (const unsigned int left, const unsigned int top, const unsigned int width, const unsigned int height)
 Sets the viewport of this framebuffer. More...
 
virtual void setPreferredPixelFormat (const FrameType::PixelFormat pixelFormat)
 Sets the preferred pixel format of this framebuffer. More...
 
virtual void setFaceMode (const FaceMode faceMode)
 Sets the global face mode of the entire framebuffer. More...
 
virtual void setCullingMode (const CullingMode cullingMode)
 Sets the global culling mode of the entire framebuffer. More...
 
virtual void setLightingMode (const LightingMode lightingMode)
 Sets the global lighting mode of the entire framebuffer. More...
 
virtual void setRenderTechnique (const RenderTechnique technique)
 Sets the rendering technique of the entire framebuffer. More...
 
virtual bool setSupportQuadbufferedStereo (const bool enable)
 Sets whether this framebuffer will support quad-buffered stereo views. More...
 
virtual bool setSupportAntialiasing (const unsigned int buffers)
 Sets whether this framebuffer will support hardware anti-aliasing. More...
 
virtual bool setAntialiasing (const bool antialiasing)
 Sets whether the framebuffer uses hardware anti-aliasing. More...
 
virtual void setShadowTechnique (const ShadowTechnique technique)
 Sets the shadow technique of the entire framebuffer. More...
 
virtual bool setDevice_T_display (const HomogenousMatrix4 &device_T_display)
 Sets the transformation between display and device. More...
 
virtual void setVerticalSynchronization (const bool synchronize)
 Sets whether the framebuffer will is synchronized with the vertical sync signal of the display device. More...
 
void setPreRenderCallback (const RenderCallback &renderCallback)
 Sets an optional callback function for pre-render events. More...
 
void setPostRenderCallback (const RenderCallback &renderCallback)
 Sets an optional callback function for pre-render events. More...
 
virtual void render ()
 Renders the next frame into the framebuffer. More...
 
virtual bool render (Frame &frame, Frame *depthFrame=nullptr)
 Renders the next frame and copies the image content into to a given frame. More...
 
virtual bool intersection (const Line3 &ray, RenderableRef &renderable, Vector3 &position)
 Returns the renderable object intersected by a given ray. More...
 
virtual void makeCurrent ()
 Makes this framebuffer to the current one. More...
 
virtual void makeNoncurrent ()
 Makes this framebuffer to non current. More...
 
virtual bool linearizeDepthFrame (Frame &depthFrame, const Scalar nearDistance, const Scalar farDistance) const
 Linearizes a given z-buffer depth frame with non-linear (e.g., logarithmic) depth. More...
 
Locklock () const
 Returns the lock object of this engine. More...
 
- Public Member Functions inherited from Ocean::Rendering::Object
ObjectId id () const
 Returns the unique object id of this object. More...
 
const std::string & name () const
 Returns the name of this object. More...
 
virtual void setName (const std::string &name)
 Sets or changes the name of this object. More...
 
virtual const std::string & engineName () const =0
 Returns the name of the owner engine. More...
 
ObjectRefs parentObjects () const
 Returns all parent objects. More...
 
ObjectRefSet parentNodes () const
 Returns all parent nodes. More...
 
virtual std::string descriptiveInformation () const
 Returns descriptive information about the object as string. More...
 

Protected Member Functions

 WindowFramebuffer ()
 Creates a new window framebuffer. More...
 
 ~WindowFramebuffer () override
 Destructs a window framebuffer. More...
 
- Protected Member Functions inherited from Ocean::Rendering::Framebuffer
 Framebuffer ()
 Creates a new framebuffer. More...
 
 ~Framebuffer () override
 Destructs a framebuffer. More...
 
virtual bool initialize (const FramebufferRef &shareFramebuffer=FramebufferRef())
 Initializes the framebuffer. More...
 
virtual void release ()
 Releases the framebuffer. More...
 
- Protected Member Functions inherited from Ocean::Rendering::Object
 Object ()
 Creates a new object. More...
 
 Object (const Object &object)=delete
 Disabled copy constructor. More...
 
virtual ~Object ()
 Destructs an object. More...
 
Engineengine () const
 Returns the render engine which is owner of this object. More...
 
void registerParent (const ObjectId parentId)
 Registers a parent node for this (child) node. More...
 
void unregisterParent (const ObjectId parentId)
 Unregisters a parent node for this (child) node. More...
 
void registerThisObjectAsParent (const ObjectRef &child)
 Registers this object at a child as parent object. More...
 
void unregisterThisObjectAsParent (const ObjectRef &child)
 Unregisters this object from a child as parent. More...
 
Objectoperator= (const Object &object)=delete
 Disabled copy operator. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::Rendering::Framebuffer
enum  FramebufferType { FRAMEBUFFER_INVALID , FRAMEBUFFER_BITMAP , FRAMEBUFFER_WINDOW }
 Definition of different framebuffer types. More...
 
enum  RenderTechnique { TECHNIQUE_FULL , TECHNIQUE_TEXTURED , TECHNIQUE_SHADED , TECHNIQUE_UNLIT }
 Definition of different render techniques. More...
 
enum  ShadowTechnique { SHADOW_TECHNIQUE_NONE , SHADOW_TECHNIQUE_MAPS }
 Definition of different shadow techniques. More...
 
typedef PrimitiveAttribute::FaceMode FaceMode
 Definition of different rendering face modes. More...
 
typedef PrimitiveAttribute::CullingMode CullingMode
 Definition of different rendering face culling modes. More...
 
typedef PrimitiveAttribute::LightingMode LightingMode
 Definition of different face lighting modes. More...
 
typedef PhantomAttribute::PhantomMode PhantomMode
 Definition of different rendering phantom modes. More...
 
typedef Callback< void, const size_t, const HomogenousMatrix4, const SquareMatrix4, const TimestampRenderCallback
 Definition of a callback function for render events. More...
 
- Public Types inherited from Ocean::Rendering::Object
enum  ObjectType {
  TYPE_UNKNOWN , TYPE_ABSOLUTE_TRANSFORM , TYPE_ATTRIBUTE , TYPE_ATTRIBUTE_SET ,
  TYPE_BACKGROUND , TYPE_BILLBOARD , TYPE_BITMAP_FRAMEBUFFER , TYPE_BLEND_ATTRIBUTE ,
  TYPE_BOX , TYPE_CONE , TYPE_CYLINDER , TYPE_DEPTH_ATTRIBUTE ,
  TYPE_DIRECTIONAL_LIGHT , TYPE_FRAMEBUFFER , TYPE_FRAME_TEXTURE_2D , TYPE_GEOMETRY ,
  TYPE_GROUP , TYPE_INDEPENDENT_PRIMITIVE , TYPE_LIGHT_SOURCE , TYPE_LINES ,
  TYPE_LINE_STRIPS , TYPE_LOD , TYPE_MATERIAL , TYPE_NODE ,
  TYPE_OBJECT , TYPE_PARALLEL_VIEW , TYPE_PERSPECTIVE_VIEW , TYPE_PHANTOM_ATTRIBUTE ,
  TYPE_POINT_LIGHT , TYPE_POINTS , TYPE_PRIMITIVE , TYPE_PRIMITIVE_ATTRIBUTE ,
  TYPE_QUAD_STRIPS , TYPE_QUADS , TYPE_RENDERABLE , TYPE_SCENE ,
  TYPE_SHADER_PROGRAM , TYPE_SHAPE , TYPE_SKY_BACKGROUND , TYPE_SPHERE ,
  TYPE_SPOT_LIGHT , TYPE_STEREO_ATTRIBUTE , TYPE_STEREO_VIEW , TYPE_STRIP_PRIMITIVE ,
  TYPE_SWITCH , TYPE_TEXT , TYPE_TEXTURE , TYPE_TEXTURE_2D ,
  TYPE_MEDIA_TEXTURE_2D , TYPE_TEXTURE_FRAMEBUFFER , TYPE_TEXTURES , TYPE_TRANSFORM ,
  TYPE_TRIANGLE_FANS , TYPE_TRIANGLES , TYPE_TRIANGLE_STRIPS , TYPE_UNDISTORTED_BACKGROUND ,
  TYPE_VERTEX_SET , TYPE_VIEW , TYPE_WINDOW_FRAMEBUFFER
}
 Definition of different object type. More...
 
typedef std::unordered_map< ObjectId, unsigned int > ObjectIdMap
 Definition of a map holding object ids to reference counters. More...
 
- Static Public Member Functions inherited from Ocean::Rendering::Object
static std::string translateObjectType (const ObjectType objectType)
 Translates an object type to a readable string. More...
 
- Protected Attributes inherited from Ocean::Rendering::Framebuffer
Scenes framebufferScenes
 Scenes registered at the framebuffer. More...
 
ViewRef framebufferView
 View connected with the framebuffer. More...
 
RenderCallback preRenderCallback_
 Optional callback function for pre-render events. More...
 
RenderCallback postRenderCallback_
 Optional callback function for post-render events. More...
 
- Protected Attributes inherited from Ocean::Rendering::Object
Lock objectLock
 Lock for the object. More...
 

Detailed Description

This class is the base class for all window framebuffers.

To initialize the framebuffer set the id of the window receiving the framebuffer.
All userdefined framebuffer properties must be set before the id is set.

Sample code for windows platforms:

void newFramebuffer(const EngineRef engine, HWND window)
{
if (!framebuffer)
throw OceanException("Failed to create a new framebuffer");
framebuffer->setSupportAntialiasing(4);
if (!framebuffer->setId(size_t(window)))
throw OceanException("Failed to initialize the framebuffer");
// ...
}
FramebufferRef createFramebuffer(const Framebuffer::FramebufferType type=Framebuffer::FRAMEBUFFER_WINDOW, const Framebuffer::FramebufferConfig &config={})
Returns a new framebuffer of this render engine.
@ FRAMEBUFFER_WINDOW
Window framebuffer type.
Definition: rendering/Framebuffer.h:61
Engine & engine() const
Returns the render engine which is owner of this object.
Ocean::ObjectRef< Engine > EngineRef
Definition of an engine reference object.
Definition: Engine.h:24
SmartObjectRef< WindowFramebuffer > WindowFramebufferRef
Definition of a smart object reference holding a window framebuffer node.
Definition: rendering/WindowFramebuffer.h:21

Constructor & Destructor Documentation

◆ WindowFramebuffer()

Ocean::Rendering::WindowFramebuffer::WindowFramebuffer ( )
protected

Creates a new window framebuffer.

◆ ~WindowFramebuffer()

Ocean::Rendering::WindowFramebuffer::~WindowFramebuffer ( )
overrideprotected

Destructs a window framebuffer.

Member Function Documentation

◆ framebufferType()

FramebufferType Ocean::Rendering::WindowFramebuffer::framebufferType ( ) const
overridevirtual

Returns the type of this framebuffer.

See also
Framebuffer::framebufferType().

Implements Ocean::Rendering::Framebuffer.

◆ id()

virtual size_t Ocean::Rendering::WindowFramebuffer::id ( ) const
virtual

Returns the platform dependent framebuffer base id or handle.

Returns
Id or handle of the framebuffer base
See also
initializeById().
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GlobalIllumination::GIWindowFramebuffer.

◆ initializeById()

virtual bool Ocean::Rendering::WindowFramebuffer::initializeById ( const size_t  id,
const FramebufferRef shareFramebuffer = FramebufferRef() 
)
virtual

Sets the platform dependent framebuffer base id or handle and initializes the framebuffer.

This id can be a handle of a window.
E.g. on windows platforms this id must be the window handle (HWND).
The definition of the id will initialize the rendering context for this framebuffer.

Parameters
idId or handle of the framebuffer base
shareFramebufferOptional framebuffer to share resources with
Returns
True, if succeeded
See also
id().
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GLESceneGraph::Windows::GLESWindowFramebuffer, Ocean::Rendering::GLESceneGraph::Quest::OpenXR::GLESWindowFramebuffer, Ocean::Rendering::GlobalIllumination::GIWindowFramebuffer, and Ocean::Rendering::GLESceneGraph::QT::GLESWindowFramebuffer.

◆ type()

ObjectType Ocean::Rendering::WindowFramebuffer::type ( ) const
overridevirtual

Returns the type of this object.

See also
Object::type().

Reimplemented from Ocean::Rendering::Framebuffer.


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