The Vish Visualization Shell 0.3
Vish
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Wizt::TransformOperator Struct Reference

Implements an operation that affects a 3D rendering, in whatever way. More...

#include <ocean/Anemonia/TransformOperator.hpp>

Classes

struct  Functor
 
struct  Transform
 An exception-safe helper class to invoke the transformation functor. More...
 

Public Member Functions

bool initializeAnemone (Anemone &RenderAnemone, VRenderContext &Context) const
 Forwarding the initializeAnemone() call to the Functor contained here.
 
 TransformOperator (const RefPtr< Functor > &R=NullPtr())
 Construct with optional transformation functor.
 
 ~TransformOperator ()
 Destructor.
 

Static Public Member Functions

static glsl getDefaultShaderFunctions (const RefPtr< ValuePool > &Context)
 

Static Public Attributes

static const char GlobalFunctions []
 Transform directly from world to screen coordinate (implicitly computing eye coordinates);.
 

Detailed Description

Implements an operation that affects a 3D rendering, in whatever way.

It might well be a geometrical transformation, or some clipping, some combination of both, or anything else.

Transformation operators may be provides as output by Vish objects and used as input for a VRenderObject.

Application shader code must use the vish_transform GLSL functions that are provided via the getShaderFunctions(VRenderContext&Context) call. Typical shader code, replacing the usual matrix operations from standard OpenGL, will then look like:

out vec4 theVertex;
out vec4 theVertex_EyeSpace;
out vec3 Normal;
out vec3 Normal_EyeSpace;
void main(void)
{
theVertex = gl_Vertex;
theVertex_EyeSpace = vish_transform_vertex_WorldToEye(theVertex, TranslationVector);
gl_Position = vish_transform_vertex_EyeToScreen(theVertex_EyeSpace);
Normal= gl_Normal;
Normal_EyeSpace = vish_transform_normal_WorldToEye(Normal);
}

Member Function Documentation

◆ getDefaultShaderFunctions()

string Wizt::TransformOperator::getDefaultShaderFunctions ( const RefPtr< ValuePool > &  Context)
static
       Default shader functions to
       compute the transformation from world coordinates to eye coordinates
       based on OpenGL 1 matrices.

Assumes a global variable gl_ModelViewMatrix conforming to OpenGL compatibility profile, but without a translation component. The translation component has to be provided by the TranslationVector argument.

vec4 vish_transform_vertex_WorldToEye_Default(vec4 theVertex, vec3 TranslationVector);

Transforms from eye space to screen space:

vec4 vish_transform_vertex_EyeToScreen_Default(vec4 theVertex_in_EyeSpace);

Computes the transformation of a normal vector given in world coordinates to eye space.

vec3 vish_transform_normal_WorldToEye_Default(vec3 TheNormal);

Member Data Documentation

◆ GlobalFunctions

constinit const char Wizt::TransformOperator::GlobalFunctions
static

Transform directly from world to screen coordinate (implicitly computing eye coordinates);.

#define HAVE_vish_transform_vertex_WorldToScreen
vec4 vish_transform_vertex_WorldToScreen(in RelativeVertex theVertex);