The Vish Visualization Shell 0.3
Vish
Public Member Functions | List of all members
Wizt::MultiviewRenderable Struct Referenceabstract

Base class for objects that can render to multiple views at once, such as needed for single-pass stereo rendering. More...

#include <ocean/Anemonia/MultiView.hpp>

Inheritance diagram for Wizt::MultiviewRenderable:
Wizt::VManagedObjectBase MemCore::ReferenceBase< VManagedObjectBase >

Public Member Functions

bool exception_safe_multiview_render (const RefPtr< RenderAble > &that, double &RenderTime, VRenderContext &Context, const VRenderContext::MultiView &Eyes, RenderAble::SubContext &SC) noexcept
 Calls multiview_render() and handles possible exceptions.
 
virtual bool multiview_render (VRenderContext &Context, const MultiView &Eyes, RenderAble::SubContext &SC)=0
 The multiview_render() function allows render objects to handle stereo, or multiview rendering in general.
 
- Public Member Functions inherited from Wizt::VManagedObjectBase
 VManagedObjectBase ()
 Constructor.
 
 ~VManagedObjectBase ()
 Destructor.
 
- Public Member Functions inherited from MemCore::ReferenceBase< VManagedObjectBase >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< VManagedObjectBase, VManagedObjectBase > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (VManagedObjectBase *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 

Additional Inherited Members

- Public Types inherited from MemCore::ReferenceBase< VManagedObjectBase >
using reference_domain_t = VManagedObjectBase
 The type of the base class.
 
using SelfPtr_t = WeakPtr< VManagedObjectBase, VManagedObjectBase >
 Type for a pointer to this object itself.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< VManagedObjectBase >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Detailed Description

Base class for objects that can render to multiple views at once, such as needed for single-pass stereo rendering.

The implementation is based on the OVR multiview extension https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview.txt and called in with OVR multiview being enabled during the virtual multiview_render function.

Example code for a vertex shader:

#version 450 core
#extension GL_OVR_multiview : require
#extension GL_OVR_multiview2 : require
layout(location = 0) in vec3 inVertex;
layout(set = 0, binding = 0) uniform ViewMatrix { mat4 view[2]; };
void main()
{
gl_Position = view[gl_ViewID_OVR] * vec4(inVertex, 1.0);
}

Member Function Documentation

◆ multiview_render()

virtual bool Wizt::MultiviewRenderable::multiview_render ( VRenderContext Context,
const MultiView &  Eyes,
RenderAble::SubContext SC 
)
pure virtual

The multiview_render() function allows render objects to handle stereo, or multiview rendering in general.

It has access to all the view parameters at once, the "Eyes". The default code just iterates over all eyes, "opens" each eye in the given Context, and calls the appropriate render() function (the one with a SubContext) then:

for(unsigned Eye = 0; Eye<Eyes.size(); Eye++)
{
const View&myEye = Eyes[Eye];
Context.openEye(Eye);
if (!render(Context, myEye, SC))
return false;
}
return true;
A set of variable names, with indices associated to each type.
Definition Context.hpp:18
Definition Camera.hpp:199
Defining the view in a rendering scene via the projection parameters and the rotation / translation d...
Definition View.hpp:155

Instead, some stereo-capable code may access both stereo buffers directly to perform immediate rendering.