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

#include <FloatingAnemone.hpp>

Inheritance diagram for Wizt::FloatingAnemone:
Wizt::FloatingOriginAnemone Wizt::FloatOrigin Wizt::VStateCreatorBase Wizt::FloatingProgrammableEdgeRenderer Wizt::FloatingSkeletonRenderer Wizt::PictureBase Wizt::ShadedFieldAnemone Wizt::SurfaceRenderer Wizt::VertexFieldShader< DisplayShader, RenderCategory > Wizt::EdgeShader Wizt::LineSetRenderer Wizt::PictureInjectorBase Wizt::HeightDots Wizt::HeightDotsMultiView Wizt::WhiteDots

Public Member Functions

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
 

Static Public Member Functions

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)
 

Detailed Description

Author
Werner Benger

Supporting Render Anemone API using shaders via FloatOrigin support. There will be two translations involved:

Member Function Documentation

◆ createPossiblyShiftedVertices() [1/2]

RefPtr< RenderBasin::VertexAttribute > Wizt::FloatingAnemone::createPossiblyShiftedVertices ( const RefPtr< Fiber::MemBase > &  Coordinates,
const BoundingBox BBox,
const GridAnemone::AnemoneCreationContext ARC,
const RefPtr< GridAnemone::AnemoneExplorer > &  AE,
const MemCore::Attributes Attribs,
bool  AllowProceduralCoordinates 
)
static

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.

Otherwise, just load the coordinates as is.

Calls FloatingAnemoneExplorer::computeCenterShift().

◆ createPossiblyShiftedVertices() [2/2]

std::pair< RefPtr< RenderBasin::VertexAttribute >, bool > Wizt::FloatingAnemone::createPossiblyShiftedVertices ( Fiber::CreativeArrayBase myPrimaryDataFragment,
const GridAnemone::AnemoneCreationContext ARC,
const RefPtr< GridAnemone::AnemoneExplorer > &  AE,
bool  AllowProceduralCoordinates,
const Fiber::CreativeArrayBase::result &  AsyncCallback 
)
static

Same as similar function, but using a Creator to create the coordinates and possibly compute the bounding box information.

The bool return value tells whether the data are yet under creation, assign as:

const auto&[VertexAttribute,YetUnderCreation] = createPossiblyShiftedVertices(...);
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
static RefPtr< RenderBasin::VertexAttribute > createPossiblyShiftedVertices(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() h...
Definition FloatingAnemone.cpp:146

References createPossiblyShiftedVertices(), and MemCore::Timer::secs().

◆ getAnemoneExplorer()

RefPtr< GridAnemone::AnemoneExplorer > Wizt::FloatingOriginAnemone::getAnemoneExplorer ( const WeakPtr< GridAnemone > &  theGridAnemone,
VRenderContext Context 
) const
       Provide GLSL code defining uniform variables that relate
       to the floating origin approach. This GLSL code can be embedded
       into vertex, geometry or fragment shaders equally.
       The provided code is equivalent to:
       @code

// The translational part of the model view matrix uniform vec3 vish_translation;

// The value by which vertices in a vertex array are offset from their real value. // // To improve numerical accuracy, vertices are shifted before uploading // to the GPU by a certain shift vector, which is usually the center // of the bounding box surrounding an Anemone. // uniform vec3 vish_origin;

// The camera observer location relative to the vertex translation uniform vec3 vish_relative_observer;

// compute actual world coordinates from shifted vertex coordinates vec3 vish_WorldPosition(in vec3 theVertex);

// project shifted vertex coordinates to screen coordinates vec4 vish_ftransform(vec4 Vertex);

#ifdef VERTEX_SHADER // get absolute coordinates of current vertex, also works for procedural (e.g. uniform) coordinates vec4 vish_gl_Position();

// get relative coordinates of current vertex, also works for procedural (e.g. uniform) coordinates vec4 vish_gl_RelativePosition(); #endif

◆ initializeTranslation()

bool Wizt::FloatingAnemone::initializeTranslation ( Anemone RenderAnemone,
const GridAnemone::AnemoneCreationContext ARC,
const RefPtr< GridAnemone::AnemoneExplorer > &  AE 
) const
       Call this function from
AnemoneRenderStatus initializeAnemone(Anemone&RenderAnemone,
const RefPtr<AnemoneExplorer>&AE) const override;
The context of creating a RenderAnemone.
Definition AnemoneCreationContext.hpp:58

in a child class of GridAnemone after computing shifted vertices via createPossiblyShiftedVertices() or similar functions that define the internal shift vector.

References Wizt::FloatingAnemoneExplorer::initializeTranslation().

◆ WorldToScreen()

string Wizt::FloatingAnemone::WorldToScreen ( ) const
override
       The name of the shader parameter used to store the translation vector.
       Shader code must be of the form such as:
uniform vec3 TranslationVector;
void main(void)
{
vec4 theVertex = gl_Vertex;
vec4 theVertex_EyeSpace = gl_ModelViewMatrix*(theVertex-vec4(TranslationVector,0));
}
@endcod
This name can be modified in a subclass if required. It will be used
when initializing a Render Anemone via the initializeAnemone() call.
/
// string TranslationVectorUniformName = "TranslationVector";
enable_if_callable_t< T, Args... > call(T &&obj, Args &&... args)