The Vish Visualization Shell 0.3
Vish
Public Member Functions | Public Attributes | List of all members
Wizt::VGLRenderContext Struct Reference

A special vish context that is passed to VGLRenderObjects when rendering. More...

#include <ocean/GLvish/VGLRenderContext.hpp>

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

Public Member Functions

MemCore::RefPtr< Anemone::TentaclecreateFontTentacle (const string &text, const VTextRenderProperties &VTRP, const RefPtr< Font > &theFont) const override
 Create a Tentacle to render text.
 
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, const MemCore::RefPtr< Program > &) override
 Implementing the Anemonia function to a create and compile a GLSL shader program with support for geometry shaders.
 
MemCore::RefPtr< ElementAttributecreateIndexBuffer (const MemCore::RefPtr< MemCore::ChunkBase > &ElementData) override
 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.
 
MemCore::RefPtr< ProgramcreateProgram (const std::string &VertexShader, const std::string &FragmentShader, const std::string &VertexShaderURL, const std::string &FragmentShaderURL, const MemCore::RefPtr< Program > &P)
 Backward compatibility.
 
MemCore::RefPtr< RenderParametercreateRenderParameter (const string &, const void *data, const std::type_info &type, int Multiplicity) override
 Create a generic rendering parameter.
 
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.
 
RefPtr< StorageBufferTentaclecreateStorageBuffer (const void *theStorageData, size_t N, RenderBasin::Buffer::StorageFlags Flags) const override
 Create a storage buffer tentacle, which is a reference to an OpenGL storage buffer.
 
RefPtr< RenderBasin::StorageBufferTentaclecreateStorageBuffer (Intercube &DataCreator, const DataCreationFunction &f, const RenderBasin::Buffer::StorageFlags Flags) const override
 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, 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.
 
RefPtr< RenderBasin::StorageBufferTentaclecreateStorageBuffer (Intercube &DataCreator, size_t N, const RenderBasin::Buffer::StorageFlags Flags) const override
 Create storage buffer of the given size without initialization, but reuse an existing storage buffer if such is given at 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.
 
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 RefPtr< RenderBasin::TextureTentacle > &OldTT=nullptr) override
 Implementation to create a Texture.
 
MemCore::RefPtr< AttributecreateTextureBuffer (const MemCore::RefPtr< MemCore::ChunkBase > &TextureData, int textureUnit=0, bool doNormalize=false, int AttributeClass=0, int MaxBitStorage=0) override
 Create a texture buffer, which are basically 1D arrays of data that can be accessed randomly in OpenGL.
 
MemCore::RefPtr< VertexAttributecreateVertexAttribute (const MemCore::RefPtr< MemCore::ChunkBase > &VertexData, const std::string &name) override
 Implementing the Anemonia function to create vertex attributes.
 
MemCore::RefPtr< PainterdrawPrimitives (Primitive, size_t howmany=0) override
 deprecated!
 
MemCore::RefPtr< RenderFlagEnable (const char *what, bool Yes=true) override
 Virtual OpenGL call to enable some rendering flag.
 
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.
 
RefPtr< FontgetFont (const std::list< string > &fontnames={}, VRenderContext::Font::Type={}, VRenderContext::Font::RenderHint={}, const RefPtr< VCreationPreferences > &prefs=nullptr) override
 Get a font object.
 
std::string getShaderPlatformDefines () const override
 Create a preprocessor string containing some platform-specific definitions.
 
ModelViewState ModelShift (const Eagle::FixedArray< double, 3 > &Translation) const override
 Implement model shifting.
 
void openEye (unsigned EyeNumber) override
 The frustum parameters are set into the View structure as provided in.
 
GLCache::data_type operator() (Intercube &Storage) const
 Query as display list that is stored relative to this Intercube.
 
GLCache::data_type operator[] (Intercube &Storage) const
 Access a gl cache factory via an arbitrary intercube object.
 
RefPtr< PickListpick (const ObjectSelection &RenderObjects, int X, int Y, int DX, int DY, int MinLevel=CAMERA_OBJECT-1, int MaxLevel=RENDER_LAST) override
 Feedback buffer rendering, considering the objects given in the provided selection.
 
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.
 
RenderResult render (ObjectSelection &RenderObjects, double &RenderTime, int MinLevel=RENDER_FIRST, int MaxLevel=RENDER_LAST) override
 Implementation of object layer traversal, setting OpenGL matrices for each RenderCategory.
 
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 setModelView (unsigned Eye)
 Setup the OpenGL project matrix (matrix mode needs to be set to PROJECTION first!) to cover some bounding box as given by the parameters.
 
void setProjectionMatrix (const ProjectionParameters &P) const
 Implement the OpenGL call to load the given projection parameters as projection matrix.
 
 VGLRenderContext (const SeagrassWeakPtr_t &theSeagrass, const WeakPtr< Interruptor > &theInterruptor, const RefPtr< VRenderPrecision > &Hints, unsigned NumberOfEyes, int64_t theAvailableGPURAM)
 Constructor.
 
ViewportGeometry viewport (unsigned int ViewportIndex=0) const override
 Return the viewport properties of the render context, as set by glViewport();.
 
virtual ~VGLRenderContext ()
 Constructor.
 
- Public Member Functions inherited from Wizt::VRenderContext
bool allowRendering (Anemone &RenderAnemone)
 Check if the given Anemone fits into the AvailableGPURAM, and if so, subtract its memsize() from it and return true.
 
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.
 
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.
 
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.
 
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.
 
 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.
 
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.
 
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)
 
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 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.
 
MemCore::RefPtr< VertexAttributecreateTextureCoordinates (const MemCore::RefPtr< MemCore::ChunkBase > &TextureCoordData, int TextureUnit=0)
 Convenience function to load texture coordinates as vertex attribute.
 
MemCore::RefPtr< RenderFlagDisable (const char *what)
 Disable 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.
 
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.
 

Public Attributes

FramebufferList_t FramebufferList
 A list of currently active framebuffer into which rendering is done.
 
int nStrata
 For depth peeling, parameter specifying the number of layers.
 
- Public Attributes inherited from Wizt::VRenderContext
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.
 

Additional Inherited Members

- Public Types inherited from Wizt::VRenderContext
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:
 
- Static Public Member Functions inherited from Wizt::VRenderContext
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)
 
- Static Public Attributes inherited from Wizt::LayeredMultiViews
static constinit char DefineStructView []
 
static constexpr unsigned MaxViewports = 16
 Maximally allowed number of viewports.
 

Detailed Description

A special vish context that is passed to VGLRenderObjects when rendering.

This context contains various openGL/rendering specific properties. It also manages OpenGL Display lists, which are stored relative to an arbitrary Intercube object:

RefPtr<DisplayList> DL = RC[ IC ][ VS ];
A container that holds many Interfaces.
Definition Interface.hpp:151
A reference counting pointer class which keeps objects alive as long as strong pointers to these obje...
Definition RefPtr.hpp:405
A set of values.
Definition ValueSet.hpp:33
A special vish context that is passed to VGLRenderObjects when rendering.
Definition VGLRenderContext.hpp:35
Examples
AnemoneBoundingVolume.cpp, Background.cpp, DynamicBackground.cpp, MonochromeBackground.cpp, QuadDemo.cpp, and SeagrassBoundingVolume.cpp.

Member Function Documentation

◆ createFontTentacle()

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

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 from Wizt::VRenderContext.

◆ createProgram()

MemCore::RefPtr< RenderBasin::Program > Wizt::RenderBasin::createProgram ( 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.

This is a simplified version of createGeometryProgram();

The setup function is given maximum values as possible by the current hardware and needs to specify the actually required values for a given shader.

◆ createRenderParameter()

MemCore::RefPtr< RenderBasin::RenderParameter > Wizt::VGLRenderContext::createRenderParameter ( const string &  ,
const void *  data,
const std::type_info &  type,
int  Multiplicity 
)
overridevirtual

Create a generic rendering parameter.

The implementation of this function will have some intelligence built in with respect to what each parameter means. It might just set a uniform variable in a shader, or detect that it's name is "glLineWidth" and issue a special OpenGL call.

Implements Wizt::RenderBasin.

References MemCore::StringUtil::ends_with(), and Wizt::String().

◆ createStorageBuffer() [1/2]

virtual RefPtr< StorageBufferTentacle > Wizt::RenderBasin::createStorageBuffer ( const void *  theStorageData,
size_t  N,
Buffer::StorageFlags  = {} 
) const

Create a storage buffer tentacle, which is a reference to an OpenGL storage buffer.

For further usage the storage buffer tentacle neds to be bound to a Program with the name under which it is used there ( bindToProgram() ), and inserted to an Anemone that handles the entity. bindStorageBuffer() is a high-level alternative that does these three steps in one call.

Parameters
theStorageDataPointer to initial data for uploading to the GPU, can be a nullptr if none is needed.

◆ createStorageBuffer() [2/2]

RefPtr< RenderBasin::StorageBufferTentacle > Wizt::VGLRenderContext::createStorageBuffer ( const void *  theStorageData,
size_t  N,
RenderBasin::Buffer::StorageFlags   
) const
overridevirtual

Create a storage buffer tentacle, which is a reference to an OpenGL storage buffer.

For further usage the storage buffer tentacle neds to be bound to a Program with the name under which it is used there ( bindToProgram() ), and inserted to an Anemone that handles the entity. bindStorageBuffer() is a high-level alternative that does these three steps in one call.

Parameters
theStorageDataPointer to initial data for uploading to the GPU, can be a nullptr if none is needed.

Implements Wizt::RenderBasin.

References Wizt::RenderBasin::getSeagrass().

Referenced by createStorageBuffer(), and createStorageBuffer().

◆ createTexture()

RefPtr< RenderBasin::TextureTentacle > Wizt::VGLRenderContext::createTexture ( 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 RefPtr< RenderBasin::TextureTentacle > &  OldTT = nullptr 
)
override

Implementation to create a Texture.

Parameters
TextureDataactual data to be loaded
TFThe type of the texture
rankThe dimensionality of the data
DimensionsThe extension of the data in each dimension, must match the provided TextureData
TextureUnitThe OpenGL texture unit in which to load these data
TSFThe internal storage format of the texture, affects memory utilization.

References createTexture().

Referenced by createTexture().

◆ createTextureBuffer()

MemCore::RefPtr< RenderBasin::Attribute > Wizt::VGLRenderContext::createTextureBuffer ( const MemCore::RefPtr< MemCore::ChunkBase > &  TextureData,
int  textureUnit = 0,
bool  doNormalize = false,
int  AttributeClass = 0,
int  MaxBitStorage = 0 
)
overridevirtual

Create a texture buffer, which are basically 1D arrays of data that can be accessed randomly in OpenGL.

These texture buffer objects do not provide 2D or 3D access with interpolation, neither do they provide on-the-fly compression on the GPU, so they occupy lots of memory of the benefit of random access from shader code.

See also
createTexture()

Implements Wizt::RenderBasin.

◆ Enable()

MemCore::RefPtr< RenderBasin::RenderFlag > Wizt::VGLRenderContext::Enable ( const char *  what,
bool  Yes = true 
)
overridevirtual

Virtual OpenGL call to enable some rendering flag.

Give some OpenGL flag as string, for instance:

Enable("GL_LIGHTING");
MemCore::RefPtr< RenderFlag > Enable(const char *what, bool Yes=true) override
Virtual OpenGL call to enable some rendering flag.
Definition VGLRenderContext.cpp:1099

instead of

glEnable(GL_LIGHTING);

Note that inclusion of OpenGL headers is not required to call this function.

Implements Wizt::RenderBasin.

◆ openEye()

void Wizt::VGLRenderContext::openEye ( unsigned  EyeNumber)
overridevirtual

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 from Wizt::VRenderContext.

References Wizt::LayeredMultiViews::CurrentEye, Wizt::LayeredMultiViews::CurrentView(), and FramebufferList.

Referenced by render().

◆ pick()

RefPtr< PickList > Wizt::VGLRenderContext::pick ( const ObjectSelection theRenderObjects,
int  X,
int  Y,
int  DX,
int  DY,
int  MinLevel = CAMERA_OBJECT-1,
int  MaxLevel = RENDER_LAST 
)
overridevirtual

Feedback buffer rendering, considering the objects given in the provided selection.

16 bit depth buffer

HERE set mouse coordinatess!!!!!!!!!!!!!!

Implements Wizt::VRenderContext.

References Wizt::Framebuffer::unbind(), and viewport().

◆ render() [1/3]

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/3]

VRenderContext::RenderResult Wizt::VGLRenderContext::render ( ObjectSelection RenderObjects,
double &  RenderTime,
int  MinLevel = RENDER_FIRST,
int  MaxLevel = RENDER_LAST 
)
overridevirtual

◆ render() [3/3]

virtual RenderResult Wizt::VRenderContext::render ( ObjectSelection theRenderObjects,
double &  RenderTime,
int  MinLevel = RENDER_FIRST,
int  MaxLevel = RENDER_LAST 
)
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

Implements Wizt::VRenderContext.

◆ setModelView()

void Wizt::VGLRenderContext::setModelView ( unsigned  Eye)

Setup the OpenGL project matrix (matrix mode needs to be set to PROJECTION first!) to cover some bounding box as given by the parameters.

This includes some jittering effects.

       Set the opengl MODELVIEW matrix from
       the current View - CurrentView() - parameters.

       Note that the explicit modelview matrix can be
       retrieved for each eye by inspecting the CurrentView()
       and updating the modelview matrices via
View&CurrentV = CurrentView(Eye);
Definition Camera.hpp:199
View & CurrentView(unsigned Eye, unsigned int ViewportIndex=0)
Access the view of the current eye for the current projection layer such that it can be modified.
Definition LayeredMultiViews.cpp:29
Defining the view in a rendering scene via the projection parameters and the rotation / translation d...
Definition View.hpp:155
void computeModelViewMatrix()
Compute the model view matrix from the camera settings.
Definition View.cpp:139
    @todo This function includes possible jittering effects
          as specified by the jittering values.
          Should be coordinated with glPerspective(), which sets
          stereo parameters, if jittering is similar to
          stereoscopic viewing? Jittering is like
          camera motion in object space.

References Wizt::View::computeModelViewMatrix(), Wizt::LayeredMultiViews::CurrentView(), and setModelView().

Referenced by setModelView().

Member Data Documentation

◆ FramebufferList

FramebufferList_t Wizt::VGLRenderContext::FramebufferList

A list of currently active framebuffer into which rendering is done.

The last one is the active one. If a render object wishes to render to a framebuffer, it needs to reactivate (i.e. bind) the last render buffer in this list.

Referenced by openEye(), and render().