FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | List of all members
Wizt::SurfaceRenderer Class Reference

Base class to render triangular surface using shaders and support for floating origin (i.e., large coordinates). More...

#include <SurfaceRenderer.hpp>

Inheritance diagram for Wizt::SurfaceRenderer:
Wizt::TriangleRenderer Wizt::FloatingAnemone Wizt::Programmable Wizt::ShaderConditionals Wizt::Phong Wizt::SkeletonOperator< SkeletonProperty > Wizt::FloatingOriginAnemone Wizt::Illuminatable Wizt::GetSkeletonOperator Wizt::FloatOrigin Wizt::VStateCreatorBase

Public Types

using SurfaceRenderState = SkeletonRendererState
 
using MyRenderState = SkeletonRendererState
 
using glsl = RenderNamespace::glsl
 
- Public Types inherited from Wizt::TriangleRenderer
using GridInspector = Fiber::GridInspector< Fiber::hasSkeletonOfGridType< Fiber::TriangularSurface > >
 
- Public Types inherited from Wizt::Programmable
typedef RenderBasin::Program Program
 

Public Member Functions

RefPtr< AnemoneExplorer > getAnemoneExplorer (VRenderContext &Context) const override
 The SurfaceAnemoneExplorer is a temporary object that exists while rendering all fragments of a surface.
 
 SurfaceRenderer (const string &name, int, const RefPtr< VCreationPreferences > &VP)
 
string getSurfaceShaderPrefix (const GridAnemone::AnemoneCreationContext &ARC, const GridAnemone::AnemoneExplorer &AE) const
 Provide shader code for -+ Transformations -+ floating origin -+ uniform coordinates -+ light sources -+ shader conditionals.
 
virtual string getShaderPrefix (const GridAnemone::AnemoneCreationContext &ARC, const GridAnemone::AnemoneExplorer &AE) const
 Allow to insert shader code at shader initialization.
 
bool feedAnemone (Anemone &RenderAnemone, RenderBasin::ElementAttribute &SkeletonBuffer, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const override
 
bool isValidAnemone (const Anemone &RenderAnemone, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const override
 
bool updateAnemone (Anemone &RenderAnemone, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const override
 
- Public Member Functions inherited from Wizt::TriangleRenderer
 TriangleRenderer (const string &name, int RenderCategory, const RefPtr< VCreationPreferences > &VP)
 
bool feedAnemone (Anemone &RenderAnemone, RenderBasin::ElementAttribute &SkeletonBuffer, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const override
 Feed all triangle-related data to the Render Anemone, in particular sets the Painter of the Anemone to do triangles.
 
- Public Member Functions inherited from Wizt::SkeletonOperator< SkeletonProperty >
RefPtr< Fiber::SkeletongetSkeleton (const Fiber::Grid &G) const override
 
RefPtr< Fiber::SkeletongetRefinedSkeleton (const Fiber::Grid &G, int i) const override
 
- Public Member Functions inherited from Wizt::FloatingAnemone
string WorldToScreen () const override
 
string getShaderPrefix (const GridAnemone::AnemoneCreationContext &ARC, const GridAnemone::AnemoneExplorer &AE) const
 
bool initializeTranslation (Anemone &RenderAnemone, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE) const
 
bool updateTranslation (Anemone &RenderAnemone, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE) const
 
RefPtr< GridAnemone::AnemoneExplorergetAnemoneExplorer (const WeakPtr< GridAnemone > &theGridAnemone, VRenderContext &Context) const
 
- Public Member Functions inherited from Wizt::FloatingOriginAnemone
RefPtr< GridAnemone::AnemoneExplorergetAnemoneExplorer (const WeakPtr< GridAnemone > &theGridAnemone, VRenderContext &Context) const
 
bool hasChangedAbsoluteTranslationVector (const RefPtr< GridAnemone::AnemoneExplorer > &AE) const
 
- Public Member Functions inherited from Wizt::FloatOrigin
RefPtr< Chunk< Eagle::point3 > > computeShiftedCoordinates (const RefPtr< Chunk< Eagle::point3 > > &RawCoordinates, const Eagle::tvector3 &TranslationVector) const
 
VRenderContext::ModelViewState getCoordinateTranslation (const VRenderContext &Context, Eagle::tvector3 &TranslationVector) const
 
VRenderContext::ModelViewState getCoordinateTranslation (const VRenderContext &Context, Intercube &IC, Eagle::tvector3 &TranslationVector) const
 
- Public Member Functions inherited from Wizt::VStateCreatorBase
RefPtr< State > & getState (const WeakPtr< ValuePool > &VP) const
 
RefPtr< InterfaceBasehasLocalInterface (const type_info &InterfaceType) const
 
RefPtr< State > myState (const WeakPtr< ValuePool > &Context) const
 
virtual RefPtr< State > newState () const
 
void setState (const WeakPtr< ValuePool > &, const RefPtr< State > &st) const
 
- Public Member Functions inherited from Wizt::Programmable
RefPtr< RenderBasin::ProgramCompileShader (VRenderContext &Context, const std::string &Name, const RenderBasin::Program::Setup &SetupFunction=nullptr, const RefPtr< RenderBasin::Program > &ExistingProgram=NullPtr(), const glsl &LocalVertexShaderPrefixCode="", const glsl &LocalGeometryShaderPrefixCode="", const glsl &LocalFragmentShaderPrefixCode="") const
 
void enableViewportArray (bool EnableFragmentLayerViewport=true)
 
virtual glsl fragment_shader (VRenderContext &Context) const=0
 
virtual glsl geometry_shader (VRenderContext &Context) const
 
virtual glsl GeometryShaderPrefix (VRenderContext &Context) const
 
std::pair< glsl, string > getCode (VRenderContext &Context, const std::string &Name, const std::string &Ext, std::string(Programmable::*shader)(VRenderContext &Context) const, const string &PrefixCode) const
 
void setGLSLVersion (const string &v_version, const string &g_version, const string &f_version)
 
void setGLSLVersion (const string &version)
 
virtual glsl vertex_shader (VRenderContext &Context) const=0
 
- Public Member Functions inherited from Wizt::ShaderConditionals
RenderNamespace::glsl getShaderDefines (const RefPtr< ValuePool > &Context) const
 
bool hasValidShaderDefines (const AnemoneCreatorContext &ACC) const
 

Additional Inherited Members

- Static Public Member Functions inherited from Wizt::TriangleRenderer
static RefPtr< RenderBasin::VertexAttributegetNormals (const AnemoneCreationContext &ARC)
 Query the per-vertex normal vectors for the current triangle fragment as specified via the AnemoneCreationContext and create a vertex attribute from it.
 
static void computeVertexNormals (Fiber::Representation &myVertices, Fiber::Representation &mySkeletonAsVertices, VRequest &Context)
 Compute normals in case we don't have any yet.
 
- Static Public Member Functions inherited from Wizt::FloatingAnemone
static RefPtr< RenderBasin::VertexAttributecreatePossiblyShiftedVertices (const RefPtr< TypedChunk< Eagle::PhysicalSpace::point > > &Coordinates, const BoundingBox &BBox, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE)
 If the AnemoneExplorer is a FloatingAnemoneExplorer (which will be the case if getAnemoneExplorer() has been implemented as documented), then shift coordinates into the center of the bounding box, create a vertex attribute from it and set a CoordinateShift interface to the AnemoneExplorer.
 
static RefPtr< RenderBasin::VertexAttributecreatePossiblyShiftedVertices (const RefPtr< Fiber::MemBase > &Coordinates, const BoundingBox &BBox, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE, const MemCore::Attributes &Attribs, bool AllowProceduralCoordinates)
 If the AnemoneExplorer is a FloatingAnemoneExplorer (which will be the case if getAnemoneExplorer() has been implemented as documented), then shift coordinates into the center of the bounding box, create a vertex attribute from it and set a CoordinateShift interface to the AnemoneExplorer.
 
static std::pair< RefPtr< RenderBasin::VertexAttribute >, boolcreatePossiblyShiftedVertices (Fiber::CreativeArrayBase &myPrimaryDataFragment, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE, bool AllowProceduralCoordinates, const Fiber::CreativeArrayBase::result &AsyncCallback)
 Same as similar function, but using a Creator to create the coordinates and possibly compute the bounding box information.
 
- Static Public Member Functions inherited from Wizt::FloatingOriginAnemone
static RefPtr< RenderBasin::VertexAttributecreatePossiblyShiftedVertices (const RefPtr< TypedChunk< Eagle::PhysicalSpace::point > > &Coordinates, const GridAnemone::AnemoneCreationContext &ARC, const RefPtr< GridAnemone::AnemoneExplorer > &AE)
 
- Static Public Member Functions inherited from Wizt::FloatOrigin
static VRenderContext::ModelViewState getTranslationVector (const VRenderContext &Context, Intercube &IC, Eagle::tvector3 &TranslationVector, double CameraShiftThreshold)
 
static Eagle::tvector3 getTranslationVector (Intercube &IC)
 
- Static Public Member Functions inherited from Wizt::Programmable
static string OptionalFileRead (const string &filename, const string &text)
 
static glsl setNumberOfLightSources (VRenderContext &Context, const std::string &VariableName="lightNum")
 
- Static Public Member Functions inherited from Wizt::Phong
static std::string PhongShaderFunction ()
 vec4 Phong(vec4 VertexInEyeSpace, vec3 NormalInEyeSpace, vec4 DiffuseColor, float shininess, float sidedness);
 
- Static Public Member Functions inherited from Wizt::Illuminatable
static RenderBasin::glsl DefineLightSources (VRenderContext &Context)
 
static bool feedAnemone (VRenderContext &Context, AnemoneCreatorBase &AC)
 
static bool feedAnemone (const AnemoneCreatorContext &ACC)
 
static bool isValidAnemone (VRenderContext &Context, const AnemoneCreatorBase &AC)
 Check for consistency of the number of light sources.
 
static bool isValidAnemone (VRenderContext &Context, const WeakPtr< AnemoneCreatorBase > &AC)
 Check for consistency of the number of light sources.
 
static bool isValidAnemone (const AnemoneCreatorContext &ACC)
 Check for consistency of the number of light sources.
 
- Public Attributes inherited from Wizt::Programmable
glsl f_prefix
 
glsl g_prefix
 
RenderBasin::GeometryInputType GeometryInput
 
RenderBasin::GeometryOutputType GeometryOutput
 
glsl v_prefix
 
- Static Public Attributes inherited from Wizt::Programmable
static const char default_fragment_shader []
 
static const char default_geometry_shader []
 
static const char default_vertex_shader []
 

Detailed Description

Base class to render triangular surface using shaders and support for floating origin (i.e., large coordinates).

The shader must support usage of the TranslationVector, which is needed to shift vertices by this amount.

uniform vec3 TranslationVector;
void main(void)
{
vec4 trans = vec4(TranslationVector, 0);
vec4 Vertex = gl_Vertex - trans;
}
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

Member Function Documentation

◆ getAnemoneExplorer()

RefPtr< SurfaceRenderer::AnemoneExplorer > Wizt::SurfaceRenderer::getAnemoneExplorer ( VRenderContext Context) const
override

The SurfaceAnemoneExplorer is a temporary object that exists while rendering all fragments of a surface.

It is created with the first fragment and destroyed with the last fragment. As such, it defines the scope of a FloatOrigin operation and stores the ModelView matrix which is locally modified during rendering.

Todo:
Use FloatingAnemoneExplorer here.

Create an AnemoneExplorer that lives during the duration of the rendering operation and shifts the coordinate origin according to the FloatOrigin base class specification.