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

Base class for abstract render operations. More...

#include <ocean/Anemonia/RenderBasin.hpp>

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

Classes

class  Buffer
 Encapsulation of buffer objects. More...
 
class  ComputationDispatcher
 Base class for compute shader executions. More...
 
struct  FloatedOrigin
 Support for FloatingOrigin (class FloatOrigin ). More...
 
class  Illumination
 A render tentacle that activates all light sources that are defined through shader code. More...
 
struct  MapMemory
 
class  Painter
 Base class for paint operations. More...
 
class  Program
 Base class for abstract shader/render programs. More...
 
class  RangedPainter
 Intermediate class for painters that may cover just a subset of the entire domain. More...
 
class  RenderFlag
 Base class for render flags. More...
 
class  RenderParameter
 Base class for render parameters, which are Anemone::Tentacle instances that implement an updateValue() function via a provided functor to be invoked by Anemone::updateValues() . More...
 
class  RenderTimer
 Base class for render timers. More...
 
struct  ShaderProgram
 Helper struct for alternative call to createProgram() with better uniqueness of arguments. More...
 
class  StorageBufferTentacle
 Storage buffer objects. More...
 
struct  TextureStorageFormat
 Enum for the storage type of the texture, which will affect memory utilization on the GPU. More...
 
class  TextureTentacle
 Base class for textures, child classes are implemented by Renderers. More...
 
struct  TypedRenderParameter
 Helper class for implementations of render parameters that operate on one specific type. More...
 
class  UniformParameter
 Base class for uniform variables in programs. More...
 
class  VertexAttribute
 A Vertex Attribute is a set of data which sits available on each vertex of some rendering. More...
 

Public Types

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 Member Functions

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.
 

Static Public Member Functions

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

int NumberOfActiveLightSources
 The number of currently active light sources.
 

Detailed Description

Base class for abstract render operations.


Class Documentation

◆ Wizt::RenderBasin::ShaderProgram

struct Wizt::RenderBasin::ShaderProgram

Helper struct for alternative call to createProgram() with better uniqueness of arguments.

Use GLSL_SHADER and GLSL_SOURCE macros to define and use GLS sources Define the GLSL source like this:

GLSL_SHADER( fragment_shader ) =
R"SHADER(
#version 450
out vec4 fragmentColor;
void main(void)
{
fragmentColor = vec4(1,0,0,0);
}
)SHADER"
;

and construct the Program like this:

RefPtr<Program> Program = Context.createProgram( GLSL_SOURCE( vertex_shader ),
GLSL_SOURCE( fragment_shader ) );
A set of variable names, with indices associated to each type.
Definition Context.hpp:18
A reference counting pointer class which keeps objects alive as long as strong pointers to these obje...
Definition RefPtr.hpp:405
Base class for abstract shader/render programs.
Definition RenderBasin.hpp:512

Constructor & Destructor Documentation

◆ RenderBasin()

Wizt::RenderBasin::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.

For instance, when rendering via OpenGL, the seagrass manager would handle OpenGL ID's and the memory associated with them.

Member Function Documentation

◆ createCoordinates()

MemCore::RefPtr< VertexAttribute > Wizt::RenderBasin::createCoordinates ( const MemCore::RefPtr< MemCore::ChunkBase > &  VertexData)
inline

Convenience function to load coordinates as vertex attribute.

RenderBasin&myContext;
Anemone RenderAnemone;
RenderAnemone.insert( Context.createCoordinates( Data ) );
Abstract object for elementary render objects.
Definition Anemone.hpp:39
MemCore::WeakPtr< Tentacle > insert(const MemCore::WeakPtr< Tentacle > &T, int OrderDeviation=0)
Insert a specialized Tentacle to this Anemone, returns pointer to the given tentacle if insertion was...
Definition Anemone.hpp:455
Base class for abstract render operations.
Definition RenderBasin.hpp:83
Definition elementary/memcore/check/main.cpp:9

Calls the generic createVertexAttribute() function.

◆ 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.

References createGeometryProgram().

◆ createRenderLambda()

template<class Lambda >
RPtr Wizt::RenderBasin::createRenderLambda ( const std::string &  what,
VRenderContext Context,
const Lambda &  theLambda 
)
inline

Initialize a typed updater, remembering the default value.

Virtual update function, reads the typed slot relative to the context and sends it to the render parameter.

References Wizt::RenderBasin::RenderParameter::modify().

◆ createRenderParameter()

virtual RPtr Wizt::RenderBasin::createRenderParameter ( const glsl ,
const void *  data,
const std::type_info &  type,
int  Multiplicity 
)
pure virtual

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.

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

◆ createRenderSlot()

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.

◆ createRenderSlotWithFunctor()

template<typename F >
requires RenderLambda<F>
auto Wizt::RenderBasin::createRenderSlotWithFunctor ( const glsl what,
const TypedSlot< typename render_lambda_signature< F >::slot_type > &  InputSlot,
F &&  theFunctor 
)
inline

Couple a VObject's input slot to a render parameter, in particular uniform shader variables, according to createRenderParameter(); Synopsis:

in<double>&myInputSlot;
Context.createRenderSlotWithFunctor( "my_uniform_integer", myInputSlot, double(42.24), [](const VRenderContext&Context, const double&SlotValue)
{
return int(SlotValue*100.0);
}
);
Base class for objects that may display something.
Definition VRenderContext.hpp:77

Note that the return type of the function may differ from the slot type, i.e. this function may perform type conversations.

Parameters
whatThe name of a shader's uniform variable, or some special name as handled by the implementation of createRenderParameter() as provided by some derived VRenderContext .

◆ createStdVertexAttribute()

MemCore::RefPtr< VertexAttribute > Wizt::RenderBasin::createStdVertexAttribute ( const MemCore::RefPtr< MemCore::ChunkBase > &  VertexData,
VertexAttributeTypes  Type 
)
inline

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).

RenderBasin&myContext;
Anemone RenderAnemone;
RenderAnemone.insert( Context.createStdVertexAttribute( Data, RenderNamespace::NORMALS ) );
@ NORMALS
Normal vectors.
Definition RenderNamespace.hpp:138

Calls the generic createVertexAttribute() function.

◆ createStorageBuffer()

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

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.

Implemented in Wizt::VGLRenderContext.

Referenced by bindStorageBuffer().

◆ createTexture()

virtual MemCore::RefPtr< TextureTentacle > Wizt::RenderBasin::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 MemCore::RefPtr< TextureTentacle > &  OldTT = nullptr 
)
pure virtual

Application call to the Render Context 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.
OldTTAn optional old texture tentacle which would be updated with the data instead of creating a new one.
See also
createTextureBuffer()

◆ createTextureBuffer()

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

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()

Implemented in Wizt::VGLRenderContext.

◆ createTextureCoordinates()

MemCore::RefPtr< VertexAttribute > Wizt::RenderBasin::createTextureCoordinates ( const MemCore::RefPtr< MemCore::ChunkBase > &  TextureCoordData,
int  TextureUnit = 0 
)
inline

Convenience function to load texture coordinates as vertex attribute.

RenderBasin&myContext;
Anemone RenderAnemone;
RenderAnemone.insert( Context.createTexture( Data ) );

◆ createVertexAttribute()

virtual MemCore::RefPtr< VertexAttribute > Wizt::RenderBasin::createVertexAttribute ( const MemCore::RefPtr< MemCore::ChunkBase > &  VertexData,
const std::string &  name 
)
pure virtual
Parameters
nameA name to be associated with this buffer
RenderBasin&myContext;
Anemone RenderAnemone;
RenderAnemone.insert( Context.createVertexAttribute( Data , "myVariable" ) );

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

◆ drawPrimitives()

virtual MemCore::RefPtr< Painter > Wizt::RenderBasin::drawPrimitives ( Primitive  ,
size_t  howmany = 0 
)
pure virtual
Deprecated:
Painters are supposed to be created by MemCore::RefPtr<RenderBasin::Painter> VertexAttribute::createPainter(Primitive Mode);

Return a painter object suitable for insertion to an Anemone. It is supposed to draw all stored Tentacles once called through Anemone::wave().

Anemone RenderAnemone;
RenderBasin&MyRenderContext;
RenderAnemone.insert( MyRenderContext.drawPrimitives(RenderBasin::POINTS) );
RenderAnemone.wave();
int wave(Activity_t Activity=~0) const
Let the Anemone display its full glory by activating all its Tentacles.
Definition Anemone.cpp:240
virtual MemCore::RefPtr< Painter > drawPrimitives(Primitive, size_t howmany=0)=0
@ POINTS
draw as points
Definition RenderNamespace.hpp:80
Parameters
howmanyThe number of elements that will be shown. If none specified here, then all that have been loaded into the Anemone .

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

◆ Enable()

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

Virtual OpenGL call to enable some rendering flag.

Give some OpenGL flag as string, for instance:

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

instead of

glEnable(GL_LIGHTING);

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

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

◆ getIllumination()

RefPtr< Illumination > Wizt::RenderBasin::getIllumination ( ) const
inline

Insert into newly created Anemone objects, for instance via feedAnemone().

The Lighting is stored at the Seagrass Cache that is associated with this RenderBasin as persistent storage location.

When constructing a new RenderAnemone, include code like this:

RenderAnemone.insert( myContext.getIllumination() );

Use in conjunction with lightingHasChanged() to check whether shaders need to be recompiled.

The Illumination tentacle manages all global shader variables (i.e., uniforms) that are used throughout all light sources. Light sources do not compile shader code on their own; all shader code is compiled within lit objects. These lit objects have to

  1. include the GLSL shader code provided by the getLightSourceCode() function
  2. implement a GLSl function
    vec3 LightFunction(in LightAtVertex LightSource, in vec3 theVertex);
    Base class for light sources in shaders: A light source provides a light function,...
    Definition RenderNamespace.hpp:502
    which defines the actual light model used by this lit objects, and
  3. call a function

    outputColor.rgb = getLightAtVertex(myVertexWorldCoordinates);

    which implements the iteration and summation over all light sources at the given vertex, which must be known to the LightFunction in coordinates that this function understands.

    For explicit manual treatment of some Program call

    Context.mergeIlluminationUniforms(P);

    or

    Context.getIllumination()->mergeIlluminationUniformsIntoProgram(P);

    instead. Both version do the same, the first one is shorter and faster.

◆ getInteractor()

WeakPtr< Interactor > Wizt::RenderBasin::getInteractor ( ) const

Get the current Interactor .

It is a weak pointer, meaning that the Interactor must be referenced by external means such as stored with in a VObject's state (the preferred method). Once the VObject dies, and thus its State, then the Interactor gets automatically removed from the Seagrass cache and thus from the RenderBasin including derived classes.

◆ makeInteractor()

RefPtr< Interactor > Wizt::RenderBasin::makeInteractor ( ) const

Receive the current Interactor, if one is set already, and create a new one if that is not the case.

The Interactor is set to the Seagrass Cache and is persistently available as long as it is kept alive externally via its reference pointers.

◆ mergeIlluminationUniforms() [1/2]

void Wizt::RenderBasin::mergeIlluminationUniforms ( const Lighting myLighting,
RenderBasin::Program P 
)
static

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.

The RenderBasin manages a list of light sources, each one providing their own shader code fragment, and glues them together as one contiguous shader code that is then applied to each lit object.

The net effect is similar to how it was in OpenGL 1.0, but more flexible since everything is based on shaders instead of the fixed pipeline.

References Wizt::RenderNamespace::ProgramVariables::merge(), Wizt::RenderNamespace::Lighting::placeholder, and Wizt::RenderNamespace::ProgramVariables::remove().

Referenced by mergeIlluminationUniforms().

◆ mergeIlluminationUniforms() [2/2]

void Wizt::RenderBasin::mergeIlluminationUniforms ( RenderBasin::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.

When using a Render Anemone, use

Anemone.insert( Context.getIllumination() );

instead.

References mergeIlluminationUniforms().

◆ MultichannelTexture() [1/2]

RenderBasin::TextureStorageFormat Wizt::RenderBasin::MultichannelTexture ( int  nChannels,
int  Bits,
bool  Integer = false,
bool  Signed = false,
bool  Normalized = true,
bool  Compressed = true 
)

◆ MultichannelTexture() [2/2]

RenderBasin::TextureStorageFormat Wizt::RenderBasin::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:

  1. One: Intensity, Red
  2. Two: LuminanceAlpha, RedGreen
  3. Three: Rgb
  4. Four: RgbAlpha
Parameters
nChannelsThe number of channels that shall be in the texture.

References Red(), RedGreen(), Rgb(), and RgbAlpha().

Referenced by MultichannelTexture().

Member Data Documentation

◆ NumberOfActiveLightSources

int Wizt::RenderBasin::NumberOfActiveLightSources

The number of currently active light sources.

An implementation of the virtual render() function must reset this number to zero and count the number of light sources while traversing all objects. A light source is defined as an object derived from VLightSource.

Referenced by Wizt::VGLRenderContext::render(), and Wizt::VRenderContext::VRenderContext().