|
FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
|
#include <FloatingAnemone.hpp>
Supporting Render Anemone API using shaders via FloatOrigin support. There will be two translations involved:
|
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().
|
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:
References createPossiblyShiftedVertices(), and MemCore::Timer::secs().
| 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
| bool Wizt::FloatingAnemone::initializeTranslation | ( | Anemone & | RenderAnemone, |
| const GridAnemone::AnemoneCreationContext & | ARC, | ||
| const RefPtr< GridAnemone::AnemoneExplorer > & | AE | ||
| ) | const |
Call this function from
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().
|
override |
The name of the shader parameter used to store the translation vector.
Shader code must be of the form such as: