The Vish Visualization Shell 0.3
Vish
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Related Symbols | List of all members
Wizt::VRenderContext Class Referenceabstract

Base class for objects that may display something. More...

#include <ocean/Anemonia/VRenderContext.hpp>

Inheritance diagram for Wizt::VRenderContext:
Wizt::VRenderContextBasin Wizt::VContext Wizt::RenderBasin Wizt::LayeredMultiViews Wizt::RenderNamespace Wizt::VGLRenderContext Wizt::WebGLRenderContext

Classes

struct  DepthMode
 Support for depth modes as discussed in: https://stannum.io/blog/0UZsbE. More...
 
class  Font
 Base class for fonts. More...
 
struct  Jitter
 A structure to define a little offset from the main camera settings. More...
 
struct  ModelViewMatrixState
 Abstract base class for a status that preserves the current model view matrix. More...
 

Public Types

using RenderResult = std::tuple< int, int >
 A render result are two integers, telling the number of completely and incompletely rendered objects.
 
using tvector3 = Eagle::tvector3
 Convenience typedef for using tangential vectors.
 
- Public Types inherited from Wizt::RenderBasin
using RPtr = MemCore::RefPtr< RenderParameter >
 Convenience Shortcut.
 
- Public Types inherited from Wizt::RenderNamespace
using AnyUniform = std::variant< int, float, double, unsigned, Eagle::FixedArray< int, 2 >, Eagle::FixedArray< float, 2 >, Eagle::FixedArray< double, 2 >, Eagle::FixedArray< int, 3 >, crd3f, Eagle::FixedArray< float, 3 >, crd3d, Eagle::FixedArray< double, 3 >, Eagle::FixedArray< int, 4 >, Eagle::FixedArray< float, 4 >, Eagle::FixedArray< double, 4 >, Eagle::Quadratic< 2, float >, Eagle::Quadratic< 3, float >, Eagle::Quadratic< 4, float >, vec3f_vector, crd3f_vector >
 A variant that may carry all currently supported data types that can be used as a uniform variable in a GLSL shader.
 
enum  GeometryInputType
 Input type for geometry shaders.
 
enum  GeometryOutputType
 Output type for geometry shader.
 
using glsl = std::string
 An alias name for strings such that the return value of functions providing GLSL code can be spotted easier.
 
enum  Primitive {
  POINTS , LINE_STRIP , LINE_LOOP , LINES ,
  TRIANGLE_STRIP , TRIANGLE_FAN , TRIANGLES , QUAD_STRIP ,
  QUADS , POLYGON , LINES_ADJACENCY , TRIANGLES_ADJACENCY ,
  LINE_STRIP_ADJACENCY , TRIANGLE_STRIP_ADJACENCY
}
 Enumeration type for primitives, similar to OpenGL (but numerically not identical). More...
 
enum  TextureFormat
 Enum for the type of texture to be used, implying the number of color channels and their meaning.
 
enum  VertexAttributeTypes {
  COORDINATES , NORMALS , COLORS , SECONDARY_COLORS ,
  TEXTURE0 , TEXTURE1 , USER_DEFINED
}
 Categories of vertex attributes for OpenGL default shader attributes, to be used in conjunction with RenderBasin::AttributeNames() and RenderBasin::createVertexAttribute(). More...
 
- Public Types inherited from Wizt::LayeredMultiViews
using LayeredViews_t = std::vector< ProjectionLayerViews_t >
 Data structure for the internal LayeredViews member, which is indexed by:
 

Public Member Functions

bool allowRendering (Anemone &RenderAnemone)
 Check if the given Anemone fits into the AvailableGPURAM, and if so, subtract its memsize() from it and return true.
 
virtual MemCore::RefPtr< Anemone::TentaclecreateFontTentacle (const string &text, const VTextRenderProperties &VTRP, const RefPtr< Font > &theFont) const
 Create a Tentacle to render text.
 
template<class Type >
MemCore::RefPtr< RenderParametercreateRenderSlot (const std::string &what, const TypedSlot< Type > &InputSlot)
 Create a cached render parameter with an explicit name from an VObject's input using the current value of this slot.
 
template<class Type , class Modifier >
MemCore::RefPtr< RenderParametercreateRenderSlot (const std::string &what, const TypedSlot< Type > &InputSlot, const Modifier &M)
 Couple a TypedSlot with a uniform variable of some Shader.
 
template<class Type >
MemCore::RefPtr< RenderParametercreateRenderSlot (const std::string &what, const TypedSlot< Type > &InputSlot, const Type &DefaultValue)
 Create a cached render parameter with an explicit name from an VObject's input and given default value.
 
template<class Type >
RPtr createRenderSlot (const std::string &what, const TypedSlot< Type > &InputSlot, const Type &DefaultValue, const WeakPtr< ValuePool > &Context)
 Create a render parameter that will be connected to a given TypedSlot such that a dependency is considered and Anemone::updateValues() handles this input slot.
 
template<class Type >
MemCore::RefPtr< RenderParametercreateRenderSlot (const std::string &what, const VObject::in< Type > &InputSlot)
 Create a cached render parameter with an explicit name from an VObject's input.
 
template<class Type >
MemCore::RefPtr< RenderParametercreateRenderSlot (const TypedSlot< Type > &InputSlot)
 Create a cached render parameter from an VObject's typed slot which will be named identical to the object's slot, using its current value.
 
template<class Type >
MemCore::RefPtr< RenderParametercreateRenderSlot (const VObject::in< Type > &InputSlot)
 Create a cached render parameter from an VObject's input slot which will be named identical to the object's input.
 
double getAspectRatio () const
 Width / Height of the current output device, i.e.
 
const VCameragetCameraSettings (unsigned Eye, unsigned int ViewportIndex=0) const
 Properties of the camera.
 
virtual RefPtr< FontgetFont (const std::list< string > &fontnames={}, Font::Type=Font::Type(), Font::RenderHint=Font::RenderHint::Extruded, const RefPtr< VCreationPreferences > &prefs=nullptr)
 Get a font object.
 
const Eagle::PhysicalSpace::FrustumgetFrustum (unsigned Eye, unsigned int ViewportIndex=0) const
 The view frustum related to the current CameraSettings.
 
double getViewportAspectRatio (unsigned int ViewportIndex=0) const
 Return the aspect ratio of the current viewer window, i.e. width / height. Returns 1.0 if no output medium is defined.
 
virtual bool isCancelled ()
 Virtual callback function that tells if this render context is supposed to be cancelled (stopped).
 
int isVisible (const Eagle::BoundingBox &DataBBox, unsigned Eye=0) const
 View Frustum Culling; test if AA-BoundingBox is visible.
 
virtual bool notifyError (const RenderAble &ErrorObject, const RenderException &theError)
 Optional function for logging errors.
 
virtual void openEye (unsigned EyeNumber)
 The frustum parameters are set into the View structure as provided in.
 
virtual RefPtr< PickListpick (const ObjectSelection &theRenderObjects, int X, int Y, int DX, int DY, int MinLevel=CAMERA_OBJECT-1, int MaxLevel=RENDER_LAST)=0
 Feedback buffer rendering, considering the objects given in the provided selection.
 
RefPtr< PickListpick (const ViewportGeometry &PickArea, const ObjectSelection &theRenderObjects, int MinLevel=CAMERA_OBJECT-1, int MaxLevel=RENDER_LAST)
 Return a touch list covering the given pick area, using the specified render objects.
 
RefPtr< PickListpick (const ViewportGeometry &PickArea, int MinLevel=CAMERA_OBJECT-1, int MaxLevel=RENDER_LAST)
 Return a touch list covering the given pick area, using the internally stored objects.
 
RefPtr< PickListpick (int X, int Y, int DX, int DY, int MinLevel=CAMERA_OBJECT-1, int MaxLevel=RENDER_LAST)
 Pick objects in the current area, as they are specified in the internal myRenderObjects list.
 
RenderResult render (double &RenderTime, int MinLevel=RENDER_FIRST, int MaxLevel=RENDER_LAST)
 Render all objects as specified in ObjectSelection RenderObjects.
 
virtual RenderResult render (ObjectSelection &theRenderObjects, double &RenderTime, int MinLevel=RENDER_FIRST, int MaxLevel=RENDER_LAST)=0
 Implementation-specific function to traverse all objects that ought to be rendered.
 
void setLightSources (const ObjectSelection &theRenderObjects) const
 Update the light sources that reside at the seagrass cache which is associated with this render context as permanent storage item.
 
virtual ViewportGeometry viewport (unsigned int ViewportIndex=0) const =0
 Return the viewport properties of the render context, as set by glViewport();.
 
 VRenderContext (const SeagrassWeakPtr_t &theSeagrass, const WeakPtr< Interruptor > &theInterruptor, const RefPtr< VRenderPrecision > &Hints, unsigned NumberOfEyes, int64_t AvailableGPURAM)
 Constructor, provide render hints.
 
virtual ~VRenderContext ()
 Constructor.
 
Projections

Member functions in this group modify the projection, in particular the OpenGL projection matrix if implemented in a child class.

void setProjectionFrustum (const Eagle::PhysicalSpace::Viewport &CameraRelativeFrustum, double zNear, double zFar, bool Orthographic, unsigned Eye, const Jitter &jittering, unsigned int ViewportIndex=0)
 Load the OpenGL projection matrix.
 
void setTileAwareFrustum (double FrameScaleFactor, const Eagle::PhysicalSpace::Viewport &CameraRelativeFrustum, double Near, double Far, bool Orthographic, unsigned Eye, const Jitter &jittering, unsigned int ViewportIndex=0)
 Consider PixelZoom and Tile parameters to compute a local viewport from the Frame and FrameScaleFactor, then call setProjectionFrustum().
 
void setTileAwarePerspective (double fovy, double Near, double Far, bool Orthographic, unsigned Eye, const Jitter &jittering, unsigned int ViewportIndex=0)
 Set the projection in the current view.
 
void setEyeView (const VCamera &theCameraSettings, double Near, double Far, bool Orthographic, unsigned EyeNumber, double ZeroParallaxDistance, double EyeSeparation, unsigned int ViewportIndex=0, bool ToeIn=false)
 Given a camera (note that it will be modified during this call if the camera settings are a reference to getCameraSettings(0) ) and stereo vision parameters, set a modified camera and a shifted, asymmetric frustum suitable for stereo rendering.
 
void setPerspective (double Near, double Far, bool Orthographic)
 Simplified version of setTileAwarePerspective(), very similar to gluPerspective() .
 
void setPerspective (double fovy, double Near, double Far, bool Orthographic)
 Simplified version of setTileAwarePerspective(), very similar to gluPerspective() .
 
void setTileAwareIdentity (unsigned Eye, double Near=0.0, double Far=2.0, const Jitter &jittering=defaultJitter(), unsigned int ViewportIndex=0)
 Set projection such that the viewport maps to [-1,-1]x[1,1].
 
- Public Member Functions inherited from Wizt::VRenderContextBasin
void queue (const ComputationFunctor &CF) const
 Schedule a computational functor for execution in a separate thread which has access to the same opengl ID resources.
 
- Public Member Functions inherited from Wizt::VContext
 operator const RefPtr< ValuePool > & () const
 A VContext may be implicitely converted into a reference pointer to a ValuePool.
 
template<typename... SlotList>
auto operator() (SlotList... t) const -> decltype(evaluateSlots(GhostValues, t...))
 Evaluate a set of input slots at once, return the values as a std::tuple<> according to the slot values.
 
string PoolName () const
 Return the name of the associated value pool.
 
void setTime ()
 set the time according to the current system time
 
 VContext (const RefPtr< Addendum > &CAddendum=NullPtr())
 Constructor.
 
 VContext (const RefPtr< ValuePool > &myValuePool, const RefPtr< Addendum > &CAddendum=NullPtr())
 Constructor with ValuePool.
 
 VContext (const RefPtr< ValuePoolProvider > &myValuePoolProvider)
 Context constructor, taking optional parameter ValuePoolProvider to setup the GhostValues in this context.
 
virtual ~VContext ()
 Destructor.
 
- Public Member Functions inherited from Wizt::RenderBasin
RefPtr< StorageBufferTentaclebindStorageBuffer (Anemone &A, const char *BufferName, const void *theStorageData, size_t N, Buffer::StorageFlags={}) const
 Create a storage buffer from the given data and bind it to all shader programs that are found at the given Anemone under the same buffer name.
 
MemCore::RefPtr< VertexAttributecreateCoordinates (const MemCore::RefPtr< MemCore::ChunkBase > &VertexData)
 Convenience function to load coordinates as vertex attribute.
 
MemCore::RefPtr< ProgramcreateGeometryProgram (const ShaderProgram &VertexShader, GeometryInputType geom_in, const ShaderProgram &GeometryShader, GeometryOutputType geom_out, const ShaderProgram &FragmentShader, const RenderBasin::Program::Setup &SetupFunction=nullptr, const MemCore::RefPtr< RenderBasin::Program > &ExistingProgram=nullptr)
 Create a shader program using a geometry shader.
 
MemCore::RefPtr< ProgramcreateGeometryProgram (const std::string &VertexShader, GeometryInputType, const std::string &GeometryShader, GeometryOutputType, const std::string &FragmentShader, const std::string &VertexShaderURL, const std::string &GeometryShaderURL, const std::string &FragmentShaderURL, const RenderBasin::Program::Setup &SetupFunction=nullptr, const MemCore::RefPtr< RenderBasin::Program > &ExistingProgram=nullptr)
 Create a shader program using a geometry shader.
 
virtual MemCore::RefPtr< ProgramcreateGeometryProgram (const std::vector< std::string > &VertexShader, const std::string &VertexShaderURL, unsigned VertexShaderLineNumber, GeometryInputType, const std::vector< std::string > &GeometryShader, GeometryOutputType, const std::string &GeometryShaderURL, unsigned GeometryShaderLineNumber, const std::vector< std::string > &FragmentShader, const std::string &FragmentShaderURL, unsigned FragmentShaderLineNumber, const RenderBasin::Program::Setup &SetupFunction=nullptr, const MemCore::RefPtr< RenderBasin::Program > &ExistingProgram=nullptr)=0
 Virtual function to create a shader program, possibly using a geometry shader.
 
virtual MemCore::RefPtr< ElementAttributecreateIndexBuffer (const MemCore::RefPtr< MemCore::ChunkBase > &ElementData)=0
 Create an index buffer containing the element indices.
 
MemCore::RefPtr< ProgramcreateProgram (const glsl &VertexShader, const glsl &FragmentShader, const std::string &VertexShaderURL, const std::string &FragmentShaderURL, unsigned VertexShaderLineNumber=0, unsigned FragmentShaderLineNumber=0, const RenderBasin::Program::Setup &SetupFunction=nullptr, const MemCore::RefPtr< RenderBasin::Program > &ExistingProgram=nullptr)
 Create a shader program from GLGS source code constructed from a vertex and fragment shader.
 
MemCore::RefPtr< ProgramcreateProgram (const ShaderProgram &VertexShader, const ShaderProgram &FragmentShader, const RenderBasin::Program::Setup &SetupFunction=nullptr, const MemCore::RefPtr< RenderBasin::Program > &ExistingProgram=nullptr)
 Create a program from vertex and fragment shader.
 
template<class Lambda >
RPtr createRenderLambda (const std::string &what, VRenderContext &Context, const Lambda &theLambda)
 
virtual RPtr createRenderParameter (const glsl &, const void *data, const std::type_info &type, int Multiplicity)=0
 Create a generic rendering parameter.
 
template<class Type >
RPtr createRenderParameter (const std::string &what, const Type &Data)
 Set variable of a given type, making use of the available META::MetaInfo<> type trait template.
 
template<class SlotType , class ShaderType >
RPtr createRenderParameterWithStdFunctor (const glsl &what, const TypedSlot< SlotType > &InputSlot, const SlotType &SlotDefaultValue, const ShaderType &ShaderDefaultValue, const std::function< ShaderType(const VRenderContext &Context, const SlotType &SlotValue)> &theFunctor)
 A more or less internal helper function that takes a std::function object for coupling a TypedSlot to a shader parameter, intended to be used by createRenderSlotWithFunctor() with a lambda function.
 
template<class Type >
RPtr createRenderSlot (const std::string &what, const TypedSlot< Type > &InputSlot, const Type &DefaultValue, const WeakPtr< ValuePool > &Context)
 Create a render parameter that will be connected to a given TypedSlot such that a dependency is considered and Anemone::updateValues() handles this input slot.
 
template<typename F >
requires RenderLambda<F>
auto createRenderSlotWithFunctor (const glsl &what, const TypedSlot< typename render_lambda_signature< F >::slot_type > &InputSlot, F &&theFunctor)
 Couple a VObject's input slot to a render parameter, in particular uniform shader variables, according to createRenderParameter(); Synopsis:
 
MemCore::RefPtr< VertexAttributecreateStdVertexAttribute (const MemCore::RefPtr< MemCore::ChunkBase > &VertexData, VertexAttributeTypes Type)
 Convenience function to load coordinates as vertex attribute that is known as fixed standard attribute in older OpenGL (discouraged, modern OpenGL and shader code should use entirely user-defined names).
 
virtual RefPtr< StorageBufferTentaclecreateStorageBuffer (const void *theStorageData, size_t N, Buffer::StorageFlags={}) const =0
 Create a storage buffer tentacle, which is a reference to an OpenGL storage buffer.
 
virtual RefPtr< RenderBasin::StorageBufferTentaclecreateStorageBuffer (Intercube &DataCreator, const DataCreationFunction &f, const RenderBasin::Buffer::StorageFlags Flags={}) const =0
 Create storage buffer of the given size with initialization from the given data creator if there is no data storage buffer associated with the specified Intercube.
 
virtual RefPtr< RenderBasin::StorageBufferTentaclecreateStorageBuffer (Intercube &DataCreator, size_t N, const RenderBasin::Buffer::StorageFlags Flags={}) const =0
 Create storage buffer of the given size without initialization, but reuse an existing storage buffer if such is given at the specified Intercube.
 
virtual MemCore::RefPtr< TextureTentaclecreateTexture (const MemCore::RefPtr< MemCore::ChunkBase > &TextureData, TextureFormat TF, int rank, const size_t *Dimensions, int TextureUnit=0, TextureStorageFormat TSF=AutomaticTexture(), int level=0, bool GenerateDoMipMap=false, const MemCore::RefPtr< TextureTentacle > &OldTT=nullptr)=0
 Application call to the Render Context to create a Texture.
 
virtual MemCore::RefPtr< AttributecreateTextureBuffer (const MemCore::RefPtr< MemCore::ChunkBase > &TextureData, int textureUnit=0, bool doNormalize=false, int AttributeClass=0, int MaxBitStorage=0)=0
 Create a texture buffer, which are basically 1D arrays of data that can be accessed randomly in OpenGL.
 
MemCore::RefPtr< VertexAttributecreateTextureCoordinates (const MemCore::RefPtr< MemCore::ChunkBase > &TextureCoordData, int TextureUnit=0)
 Convenience function to load texture coordinates as vertex attribute.
 
virtual MemCore::RefPtr< VertexAttributecreateVertexAttribute (const MemCore::RefPtr< MemCore::ChunkBase > &VertexData, const std::string &name)=0
 
MemCore::RefPtr< RenderFlagDisable (const char *what)
 Disable some rendering flag.
 
virtual MemCore::RefPtr< PainterdrawPrimitives (Primitive, size_t howmany=0)=0
 
virtual MemCore::RefPtr< RenderFlagEnable (const char *what, bool Yes=true)=0
 Virtual OpenGL call to enable some rendering flag.
 
RefPtr< IlluminationgetIllumination () const
 Insert into newly created Anemone objects, for instance via feedAnemone().
 
WeakPtr< InteractorgetInteractor () const
 Get the current Interactor .
 
glsl getLightSourceCode ()
 See getIllumination() for details.
 
int getNumberOfActiveLightSources () const
 Get the number of currently active light sources.
 
SeagrassgetSeagrass () const
 Get the Seagrass caching manager that is associated with this RenderBasin.
 
const SeagrassWeakPtr_tgetSeagrassPtr () const
 Get a pointer to the Seagrass caching manager that is associated with this RenderBasin.
 
virtual std::string getShaderPlatformDefines () const =0
 Create a preprocessor string containing some platform-specific definitions.
 
bool lightingHasChanged (const AnemoneCreatorBase &A) const
 Check whether the lighting managed by this RenderBasin (via its Seagrass) has changed so significantly such that shaders have to be recompiled.
 
RefPtr< InteractormakeInteractor () const
 Receive the current Interactor, if one is set already, and create a new one if that is not the case.
 
void mergeIlluminationUniforms (Program &P) const
 For explicit handling of shader programs merge all the uniforms defined by the current set of light sources into the given Program.
 
static TextureStorageFormat MultichannelTexture (int nChannels, int Bits, bool Integer=false, bool Signed=false, bool Normalized=true, bool Compressed=true)
 
static TextureStorageFormat MultichannelTexture (int nChannels, TextureStorageFormat::BitPrecision theBits=TextureStorageFormat::Unspecified, bool Integer=false, bool Signed=false, bool Normalized=true, bool Compressed=true)
 Create some texture matching the number of specified channels, it will be:
 
static TextureStorageFormat OpenGLTexture (int OpenGLTextureTypeEnum, int BitsPerTexel, bool isInteger)
 Create a texture storage format from an OpenGL texture enum, need to specify also the number of bits per texel for purposes of opengl memory management.
 
static TextureStorageFormat RedGreen (TextureStorageFormat::BitPrecision theBits=TextureStorageFormat::Unspecified)
 color channels (two)
 
 RenderBasin (const SeagrassWeakPtr_t &mySeagrass)
 Construct a render basin with a weak pointer to a seagrass, which is a persistent manager for handling resources related to the respective rendering implementation.
 
static TextureStorageFormat Rgb (TextureStorageFormat::BitPrecision theBits=TextureStorageFormat::Unspecified)
 color channels (three channels)
 
static TextureStorageFormat RgbAlpha (TextureStorageFormat::BitPrecision theColorBits=TextureStorageFormat::Unspecified, TextureStorageFormat::BitPrecision theAlphaBits=TextureStorageFormat::Unspecified)
 color and alpha (four)
 
void setInteractor (const WeakPtr< Interactor > &)
 Overwrite the current Interactor.
 
- Public Member Functions inherited from Wizt::LayeredMultiViews
ViewCurrentView (unsigned Eye, unsigned int ViewportIndex=0)
 Access the view of the current eye for the current projection layer such that it can be modified.
 
const ViewCurrentView (unsigned Eye, unsigned int ViewportIndex=0) const
 Access the view of the current eye for the current projection layer.
 
const ViewgetWorldView (unsigned Eye, unsigned int ViewportIndex=0) const
 Access to the world view parameters, which are valid after the camera objects have been rendered.
 
bool isValid (const Anemone &) const
 Check whether the Anemone is non-empty and the number of views in the Anemone matches the current settings.
 
glsl MultiViewPrefix (bool Define_num_views_layout=true, std::size_t MultiViewBindingPoint=0) const
 Define in GSL.
 
void setNumberOfEyes (unsigned NumberOfEyes)
 Change the number of views that are available for rendering.
 

Static Public Member Functions

static consteval Jitter defaultJitter ()
 Helper function such that Jitter can be used with default arguments in member functions of VRenderContext, which otherwise is not possible because it is a nested class.
 
- Static Public Member Functions inherited from Wizt::RenderBasin
static void mergeIlluminationUniforms (const Lighting &, Program &P)
 Lighting management: Similar in spirit to the semantics of light sources in OpenGL 1.0, Light Source objects via shaders are global and independent from lit objects, rather than squeezed into one single shader per object that also includes light sources.
 
static TextureStorageFormat Red (TextureStorageFormat::BitPrecision theBits=TextureStorageFormat::Unspecified)
 color channels (one)
 

Public Attributes

bool CheckShaderSourceUpdates = true
 A flag to indicate whether additional checks should be done for shader code updated on disk.
 
MemCore::Timer ContextRenderTimer
 Measuring the Render Time since start.
 
RefPtr< VRenderPrecisionHints
 Additional information on how rendering should happen.
 
Size Image
 For tiled rendering: Setup the Image size (in pixels) the size of one Tile (in pixels) and define the CurrentTileID (in integers telling the current ID of the tile to be rendered).
 
unsigned minActiveViewport = 0
 Multi-viewport support: For render modules that support multiple viewports, these settings here define their range.
 
bool MouseIsPressed = false
 An indicator for a currently ongoing interaction, it is supposed to be copied from a Viewer.
 
PixelZoom myPixelZoom
 Pixel zoom parameters.
 
ObjectSelection myRenderObjects
 The current selection of objects that shall be rendered.
 
unsigned number_of_depthbuffer_clearance_objects = 0
 Objects that clear the depth buffer must increase this counter, otherwise the depth buffer has to be cleared by the scene rendering.
 
const unsigned NumberOfOutputChannels
 The NumberOfOutputChannels is the number of screens in hardware for rendering.
 
bool timeout = false
 A flag that can be set by render objects to indicate rendering was cancelled due to an object-specific timeout.
 
RefPtr< Eagle::BoundingBallTouchableVolume
 The volume that is touchable, determining the camera navigation Computed at each render() call by VSceneLayers::getTouchableBoundingVolume().
 
std::map< unsigned, unsigned > ViewsPerOutputChannel
 If non-empty, this map is used to map views to output channels, such as displaying the left or right eye on a mono output device if a lens has enabled multiple views.
 
RefPtr< Eagle::BoundingBallVisibleVolume
 The volume that is visible, determining the OpenGL clipping planes.
 
- Public Attributes inherited from Wizt::VContext
RefPtr< AddendumContextAddendum
 An optional addendum to this context.
 
RefPtr< ValuePoolGhostValues
 Eventually, some variables of an input are contained in a value pool; if so, then they are semantically local to a certain context (or a group of context's).
 
double precision
 The precision parameter tells with what precision a certain action is to be executed.
 
- Public Attributes inherited from Wizt::RenderBasin
int NumberOfActiveLightSources
 The number of currently active light sources.
 
- Public Attributes inherited from Wizt::LayeredMultiViews
int CurrentEye = 0
 Stereo support: 0 ... cyclops, no stereo +1 ... right eye Any other numbers may be used to indicate eyes that are shifted even wider.
 
int MultiViewOutput = 1
 Requested views that are available for output at once.
 

Related Symbols

(Note that these are not member symbols.)

virtual ModelViewState ModelShift (const Eagle::FixedArray< double, 3 > &Translation) const =0
 

Additional Inherited Members

- Static Public Attributes inherited from Wizt::LayeredMultiViews
static constinit char DefineStructView []
 
static constexpr unsigned MaxViewports = 16
 Maximally allowed number of viewports.
 

Detailed Description

Base class for objects that may display something.

Note: The OpenGL matrices are available via the CurrentView() functions.


Class Documentation

◆ Wizt::VRenderContext::DepthMode

struct Wizt::VRenderContext::DepthMode

Support for depth modes as discussed in: https://stannum.io/blog/0UZsbE.

◆ Wizt::VRenderContext::Jitter

struct Wizt::VRenderContext::Jitter

A structure to define a little offset from the main camera settings.

To be used when using the accumulation buffer sampling multiple images to achieve

  • antialiasing (jitter in screen coordinates)
  • field of depth (jitter in depth)
  • motion blur (jitter in time)
Class Members
double dejavu = 0 Offset in time.
double eyedx = 0
double eyedy = 0
double focus = 1
double pixdx = 0
double pixdy = 0
double worlddx = 0
double worlddy = 0

Member Function Documentation

◆ allowRendering()

bool Wizt::VRenderContext::allowRendering ( Anemone RenderAnemone)

Check if the given Anemone fits into the AvailableGPURAM, and if so, subtract its memsize() from it and return true.

Otherwise, return false, unless AvailableGPURAM is a negative value, which means to ignore it.

References isCancelled(), and MemCore::MutableCacheable::memsize().

◆ createFontTentacle()

MemCore::RefPtr< Anemone::Tentacle > Wizt::VRenderContext::createFontTentacle ( const string &  text,
const VTextRenderProperties VTRP,
const RefPtr< Font > &  theFont 
) const
virtual

Create a Tentacle to render text.

Such a Tentacle will be self-consistent and can be added to and empty render Anemone, possibly using multiple such Font tentacles.

Parameters
BaseLineThe direction in which text shall be written.
FontPlaneThe plane in which the text will reside. If this is a null vector, then the text will be aligned on-screen.
FontDepthSpatial extent of the font, if this is zero, then the font will be 2D, otherwise it's a geometric 3D representation.

Reimplemented in Wizt::VGLRenderContext.

◆ createRenderSlot() [1/2]

template<class Type , class Modifier >
MemCore::RefPtr< RenderParameter > Wizt::VRenderContext::createRenderSlot ( const std::string &  what,
const TypedSlot< Type > &  InputSlot,
const Modifier &  M 
)
inline

Couple a TypedSlot with a uniform variable of some Shader.

Create a cached render parameter with an explicit name from an VObject's input using the current value of this slot.

◆ createRenderSlot() [2/2]

template<class Type >
RPtr Wizt::RenderBasin::createRenderSlot ( const std::string &  what,
const TypedSlot< Type > &  InputSlot,
const Type &  DefaultValue,
const WeakPtr< ValuePool > &  Context 
)
inline

Create a render parameter that will be connected to a given TypedSlot such that a dependency is considered and Anemone::updateValues() handles this input slot.

Set variable of a given type, making use of the available META::MetaInfo<> type trait template.

◆ getAspectRatio()

double Wizt::VRenderContext::getAspectRatio ( ) const

Width / Height of the current output device, i.e.

the viewport or the Image, if valid.

References getViewportAspectRatio(), and Image.

Referenced by setTileAwarePerspective().

◆ getFrustum()

const Eagle::PhysicalSpace::Frustum & Wizt::VRenderContext::getFrustum ( unsigned  Eye,
unsigned int  ViewportIndex = 0 
) const
inline

The view frustum related to the current CameraSettings.

It must be updated via calling its compute() function any time the CameraSettings are modified.

Referenced by isVisible().

◆ isVisible()

int Wizt::VRenderContext::isVisible ( const Eagle::BoundingBox DataBBox,
unsigned  Eye = 0 
) const

View Frustum Culling; test if AA-BoundingBox is visible.

Parameters
DataBBox
Returns
1 = completely inside, -1 = intersection, 0 = completely outside

References getFrustum().

◆ notifyError()

bool Wizt::VRenderContext::notifyError ( const RenderAble ErrorObject,
const RenderException theError 
)
virtual

Optional function for logging errors.

The exceptions can be added to a viewer's Viewer::myRenderExceptions structure, or anything else as defined in a derived class. For instance, for offline rendering the exceptions may be logged in a different place than for on-screen rendering. Since copying an exception may take a little time, the default of the base class is to not log any rendering exceptions. The return value specifies whether or not to continue with rendering when an error has occured.

References MemCore::MutableName::Name().

◆ openEye()

void Wizt::VRenderContext::openEye ( unsigned  EyeNumber)
virtual

The frustum parameters are set into the View structure as provided in.

CurrentView(Eye)

The virtual function openEye(Eye) will then send the View parameters to the GPU. This function is supposed to set the modelview and projection matrix in the derived implementation.

Reimplemented in Wizt::VGLRenderContext.

References Wizt::LayeredMultiViews::CurrentEye.

◆ render() [1/2]

RenderResult Wizt::VRenderContext::render ( double &  RenderTime,
int  MinLevel = RENDER_FIRST,
int  MaxLevel = RENDER_LAST 
)
inline

Render all objects as specified in ObjectSelection RenderObjects.

The member variable needs to be assigned before calling this function.

◆ render() [2/2]

virtual RenderResult Wizt::VRenderContext::render ( ObjectSelection theRenderObjects,
double &  RenderTime,
int  MinLevel = RENDER_FIRST,
int  MaxLevel = RENDER_LAST 
)
pure virtual

Implementation-specific function to traverse all objects that ought to be rendered.

Parameters
RenderTimeThe accumulative time (in seconds) used for rendering.
Returns
The number of objects that had been actually rendered

Implemented in Wizt::VGLRenderContext, and Wizt::VGLRenderContext.

◆ setEyeView()

void Wizt::VRenderContext::setEyeView ( const VCamera theCameraSettings,
double  Near,
double  Far,
bool  Orthographic,
unsigned  EyeNumber,
double  ZeroParallaxDistance,
double  EyeSeparation,
unsigned int  ViewportIndex = 0,
bool  ToeIn = false 
)

Given a camera (note that it will be modified during this call if the camera settings are a reference to getCameraSettings(0) ) and stereo vision parameters, set a modified camera and a shifted, asymmetric frustum suitable for stereo rendering.

Calls setTileAwarePerspective()

When EyeSeparation is zero, then there will be no stereo effect at all. When ZeroParallaxDistance==Far, everything pops out of the screen, while when ZeroParallaxDistance=Near everything will appear behind.

Calls setTileAwarePerspective().

References Wizt::LayeredMultiViews::CurrentView(), Eagle::norm(), setTileAwarePerspective(), Wizt::VCamera::ViewAngle, and Wizt::VCamera::viewdir().

◆ setLightSources()

void Wizt::VRenderContext::setLightSources ( const ObjectSelection theRenderObjects) const

Update the light sources that reside at the seagrass cache which is associated with this render context as permanent storage item.

To be called from a derived VRenderContext.

References Wizt::RenderBasin::getSeagrassPtr(), and MemCore::Ageable::touch().

Referenced by Wizt::VGLRenderContext::render().

◆ setPerspective() [1/2]

void Wizt::VRenderContext::setPerspective ( double  fovy,
double  Near,
double  Far,
bool  Orthographic 
)
inline

Simplified version of setTileAwarePerspective(), very similar to gluPerspective() .

Does not support Stereo. Use setTileAwarePerspective() for better control.

◆ setPerspective() [2/2]

void Wizt::VRenderContext::setPerspective ( double  Near,
double  Far,
bool  Orthographic 
)
inline

Simplified version of setTileAwarePerspective(), very similar to gluPerspective() .

Does not support Stereo. Use setTileAwarePerspective() for better control.

Referenced by Wizt::CrossSectionCam::environment_render().

◆ setProjectionFrustum()

void Wizt::VRenderContext::setProjectionFrustum ( const Eagle::PhysicalSpace::Viewport CameraRelativeFrustum,
double  zNear,
double  zFar,
bool  Orthographic,
unsigned  Eye,
const Jitter jittering,
unsigned int  ViewportIndex = 0 
)

Load the OpenGL projection matrix.

Setup the project matrix.

This function calls CurrentView().setOrthographic() or CurrentView().setFrustum()

Then load the openGL projection matrix, and finally call updateFrustum();

The viewport is shifted by a distance specified by the jittering parameter, which allows to specify a shift in pixel and in eye distance according to:

dx = -(jittering.pixdx * VP.width() / geom.width() + jittering.eyedx * nearVal / jittering.focus),
dy = -(jittering.pixdy * VP.height() / geom.height() + jittering.eyedy * nearVal / jittering.focus);

whereby VP is the viewport as seen by the Camera (the CameraRelativeFrustum ) and geom is the actual viewport used for rendering.

References Wizt::LayeredMultiViews::CurrentView(), Wizt::ProjectionParameters::setFrustum(), Wizt::ProjectionParameters::setOrthographic(), and viewport().

Referenced by setTileAwareFrustum().

◆ setTileAwareFrustum()

void Wizt::VRenderContext::setTileAwareFrustum ( double  FrameScaleFactor,
const Eagle::PhysicalSpace::Viewport CameraRelativeFrustum,
double  Near,
double  Far,
bool  Orthographic,
unsigned  Eye,
const Jitter jittering,
unsigned int  ViewportIndex = 0 
)

Consider PixelZoom and Tile parameters to compute a local viewport from the Frame and FrameScaleFactor, then call setProjectionFrustum().

Usually application code will call setTileAwarePerspective() unless it wants to compute the Frustum viewport explicitly.

References Eagle::PhysicalSpace::Viewport::getTile(), Image, myPixelZoom, and setProjectionFrustum().

Referenced by setTileAwareIdentity(), and setTileAwarePerspective().

◆ setTileAwarePerspective()

void Wizt::VRenderContext::setTileAwarePerspective ( double  fovy,
double  Near,
double  Far,
bool  Orthographic,
unsigned  Eye,
const Jitter jittering,
unsigned int  ViewportIndex = 0 
)

Set the projection in the current view.

This is usually the call that an end-user object CameraLens will invoke to set the projection for a specific eye.

Calls setTileAwareFrustum();

References getAspectRatio(), getCameraSettings(), Eagle::norm(), setTileAwareFrustum(), and Wizt::VCamera::viewdir().

Referenced by setEyeView().

Friends And Related Symbol Documentation

◆ ModelShift()

virtual ModelViewState ModelShift ( const Eagle::FixedArray< double, 3 > &  Translation) const
related
       Shift the camera by a specified amount.

       @param Translation The translation vector T, this function is
                          equivalent to calling (in OpenGL)
glTranslated( -T.x(), -T.y(), -T.z() );

Implemented in Wizt::VGLRenderContext.

References Eagle::norm().

Member Data Documentation

◆ minActiveViewport

unsigned Wizt::VRenderContext::minActiveViewport = 0

Multi-viewport support: For render modules that support multiple viewports, these settings here define their range.

Both values need to be smaller than MaxViewports .

◆ MouseIsPressed

bool Wizt::VRenderContext::MouseIsPressed = false

An indicator for a currently ongoing interaction, it is supposed to be copied from a Viewer.

This is probably not the best location for this specialized boolean, it may be better located in a context interruptor, or get generalized into different possible interaction devices and states.

◆ myRenderObjects

ObjectSelection Wizt::VRenderContext::myRenderObjects

The current selection of objects that shall be rendered.

This list needs to be updated at each render() or touch() call.

◆ timeout

bool Wizt::VRenderContext::timeout = false

A flag that can be set by render objects to indicate rendering was cancelled due to an object-specific timeout.

Note that the global function tooLate() will indicate whether there was a global timeout, and the function isCancelled() will indicate whether there was a cancellation due to external circumstances.

◆ TouchableVolume

RefPtr<Eagle::BoundingBall> Wizt::VRenderContext::TouchableVolume

The volume that is touchable, determining the camera navigation Computed at each render() call by VSceneLayers::getTouchableBoundingVolume().

It will be a nullptr outside of a render() call.

◆ ViewsPerOutputChannel

std::map<unsigned, unsigned> Wizt::VRenderContext::ViewsPerOutputChannel

If non-empty, this map is used to map views to output channels, such as displaying the left or right eye on a mono output device if a lens has enabled multiple views.

ViewPerOutputChannel[ OutputChannel ] = ViewNumber;

Referenced by Wizt::VGLRenderContext::render().

◆ VisibleVolume

RefPtr<Eagle::BoundingBall> Wizt::VRenderContext::VisibleVolume

The volume that is visible, determining the OpenGL clipping planes.

Computed at each render() call by VSceneLayers::getGlobalBoundingVolume(). It will be a nullptr outside of a render() call.