The Vish Visualization Shell 0.3
Vish
Public Member Functions | List of all members
Wizt::VRenderContextBasin Class Reference

Base class for render activities that allows to create various buffer objects via the RenderBasin and provides an evaluation context, yet without explicit render-specific functionality. More...

#include <ocean/Anemonia/VRenderContext.hpp>

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

Public Member Functions

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.
 

Additional Inherited Members

- 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::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 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.
 
- 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 render activities that allows to create various buffer objects via the RenderBasin and provides an evaluation context, yet without explicit render-specific functionality.