The Vish Visualization Shell 0.3
Vish
Public Member Functions | Static Public Member Functions | List of all members
Wizt::Colorizer Class Reference

A vish object component (aka vish skale) that references some colormap and takes care of its parameter handling. More...

#include <ocean/Anemonia/Colorizer.hpp>

Public Member Functions

 Colorizer (VObject *that, const string &slotname="colormap", int EL=0)
 Construct a colorizer object.
 
MemCore::RefPtr< RenderBasin::TextureTentaclecreateColormapTexture (VRenderContext &Context, int TextureUnit, const MemCore::RefPtr< RenderBasin::TextureTentacle > &OldTT=NullPtr(), bool IntegerTexture=false) const
 Create a colormap texture from the internal colormap input slot.
 
bool haveNewerColormap (VRenderContext &Context, const Ageable &) const
 Check if the colormap is newer than the given Ageable object relative to the given context.
 
MemCore::RefPtr< RenderBasin::TextureTentaclemakeColormapTexture (VRenderContext &Context, const RefPtr< RenderBasin::Program > &ShaderProgram, int TextureUnit, const string &ShaderTexturename="", bool IntegerTexture=false) const
 Minimalistic colormap shader:
 

Static Public Member Functions

static RefPtr< RenderBasin::TextureTentaclecreateColormapTexture (Colormap &Cmap, VRenderContext &Context, int TextureUnit, const MemCore::RefPtr< RenderBasin::TextureTentacle > &OldTT=nullptr, bool IntegerTexture=false)
 Create a colormap texture from a given valid colormap object.
 
static const char * getColormapFunctionDefinitions ()
 Defines a GLSL shader function that maps a floating-point scalar value to a RGBA color value, given a 1D sampler, a range of allowed values, and the steps to discretize the lookup.
 
static bool setSmoothColormap (const MemCore::RefPtr< RenderBasin::TextureTentacle > &TT, bool yes=true)
 Enable the colormap to be linearly interpolated or not.
 

Detailed Description

A vish object component (aka vish skale) that references some colormap and takes care of its parameter handling.

Constructor & Destructor Documentation

◆ Colorizer()

Wizt::Colorizer::Colorizer ( VObject that,
const string &  slotname = "colormap",
int  EL = 0 
)

Construct a colorizer object.

Parameters
ELThe Expert Level for this colormap slot. Values larger than zero will make this slot invisible on object creation.
defaultcolormapA creation preference for a colormap that shall be created when no colormap exists yet.

Member Function Documentation

◆ getColormapFunctionDefinitions()

const char * Wizt::Colorizer::getColormapFunctionDefinitions ( )
static

Defines a GLSL shader function that maps a floating-point scalar value to a RGBA color value, given a 1D sampler, a range of allowed values, and the steps to discretize the lookup.

The Steps can be zero to avoid any sampling, i.e. the colorization map will be as smooth as possible, using linear interpolation between color steps. Any values beyond the specified range will be clamped to within the last value of the colormap range.

vec4 vish_getColormapValue(sampler1D theColormap, float ScalarValue, vec2 ScalarRange, int Steps)

◆ makeColormapTexture()

RefPtr< RenderBasin::TextureTentacle > Wizt::Colorizer::makeColormapTexture ( VRenderContext Context,
const RefPtr< RenderBasin::Program > &  ShaderProgram,
int  TextureUnit,
const string &  ShaderTexturename = "",
bool  IntegerTexture = false 
) const

Minimalistic colormap shader:

uniform sampler1D ColormapTexture;
void main (void)
{
gl_FragColor = texture1D(ColormapTexture, gl_TexCoord[1].r );
}
Parameters
ShaderTexturenameIf defined, assign to this specific name of the uniform sampler1D variable in the fragment shader, otherwise use the same name as the slot.

References createColormapTexture().