Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Wizt::CarpetAnemone Class Reference

The CarpetAnemone handles a colormap attached to an Anemone. More...

#include <CarpetAnemone.hpp>

Inheritance diagram for Wizt::CarpetAnemone:
Wizt::Colorizer Wizt::HeightDots Wizt::HeightDotsMultiView Wizt::WhiteDots

Classes

struct  ColormapTexture
 A ColormapTexture object is an interface that allows to remember a set of textures. More...
 

Public Types

template<class T , int EL = VSlotContainer::InvalidExpertLevel>
using in_t = VObject::in< T, EL >
 

Public Member Functions

 CarpetAnemone (VObject *that, const string &slotname="colormap", int EL=0)
 
std::string scalarfield_vertex_shader (VRenderContext &Context) const
 
- Public Member Functions inherited from Wizt::Colorizer
 Colorizer (VObject *that, const string &slotname="colormap", int EL=0)
 
MemCore::RefPtr< RenderBasin::TextureTentaclecreateColormapTexture (VRenderContext &Context, int TextureUnit, const MemCore::RefPtr< RenderBasin::TextureTentacle > &OldTT=NullPtr(), bool IntegerTexture=false) const
 
bool haveNewerColormap (VRenderContext &Context, const Ageable &) const
 
MemCore::RefPtr< RenderBasin::TextureTentaclemakeColormapTexture (VRenderContext &Context, const RefPtr< RenderBasin::Program > &ShaderProgram, int TextureUnit, const string &ShaderTexturename="", bool IntegerTexture=false) const
 

Static Public Member Functions

static RefPtr< RenderBasin::TextureTentaclegetColormapTexture (const GridAnemone::AnemoneCreationContext &ACC, int TextureUnit)
 
static void setupRangeFromBoundingBoxHeight (const string &HeightRangeShaderVariableName, Anemone &RenderAnemone, const VObject::in< Range > &inHeightRange, VRenderContext &theRenderContext, std::function< RefPtr< Fiber::DataRangeBase >(VRenderContext &)>Ranger=nullptr)
 In the shader code the color map will be accessible under the name that we define here.
 
static void setupRangeFromBoundingBoxHeight (const string &HeightRangeShaderVariableName, Anemone &RenderAnemone, const VObject::in< Range > &inHeightRange, const GridAnemone::AnemoneCreationContext &ARC, std::function< RefPtr< Fiber::DataRangeBase >(VRenderContext &)>Ranger=nullptr)
 
- Static Public Member Functions inherited from Wizt::Colorizer
static RefPtr< RenderBasin::TextureTentaclecreateColormapTexture (Colormap &Cmap, VRenderContext &Context, int TextureUnit, const MemCore::RefPtr< RenderBasin::TextureTentacle > &OldTT=nullptr, bool IntegerTexture=false)
 
static const chargetColormapFunctionDefinitions ()
 
static bool setSmoothColormap (const MemCore::RefPtr< RenderBasin::TextureTentacle > &TT, bool yes=true)
 

Public Attributes

VObject::in< boolinUseLocalBoundingBoxForHeightRange
 

Detailed Description

The CarpetAnemone handles a colormap attached to an Anemone.

Carpet anemones: Beautiful, fragile, and deadly

Anemones of the genus Stichodactyla are some of the most colorful inverts in the sea, but they're also notoriously poor shippers, and those that do survive their trek from sea to aquarium can turn out to be deadly additions to your reef. Leonard Ho http://www.advancedaquarist.com/blog/carpet-anemones-beautiful-but-deadly

To check whether the colormap has changed and the render Anemone needs to be updated, use code like this (note that updating just the colormap instead of re-creating the Anemone yet has to be implemented - 12SEP14):

bool isValidAnemone (const Anemone&RenderAnemone,
const RefPtr<AnemoneExplorer>&AE) const override
{
if (!SurfaceRenderer::isValidAnemone( RenderAnemone, ARC, AE))
return false;
if (haveNewerColormap(ARC.myContext, RenderAnemone) )
return false;
return true;
}
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
bool haveNewerColormap(VRenderContext &Context, const Ageable &) const
bool isValidAnemone(const Anemone &RenderAnemone, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const override
Checks if a given Anemone is valid for rendering.
Definition SurfaceRenderer.cpp:110
The context of creating a RenderAnemone.
Definition AnemoneCreationContext.hpp:58

Optionally, an additional colormap input slot can be checked by specifying this slot:

if (haveNewerColormap(myFieldColormap, Context, RenderAnemone) )
return false;

To use and possibly create a default color map, override the setup() function in a derived class an implement like this:

/// This call allows to connect a default colormap
void setup(const CreationSlots_t&CreationSlots) override
{
setupDefaultColormap(CreationSlots, this, "hypsometric");
}
virtual void setup(const CreationSlots_t &CreationSlots)
Author
werner

Member Function Documentation

◆ setupRangeFromBoundingBoxHeight()

void Wizt::CarpetAnemone::setupRangeFromBoundingBoxHeight ( const string &  HeightRangeShaderVariableName,
Anemone RenderAnemone,
const VObject::in< Range > &  inHeightRange,
VRenderContext theRenderContext,
std::function< RefPtr< Fiber::DataRangeBase >(VRenderContext &)>  Ranger = nullptr 
)
static

In the shader code the color map will be accessible under the name that we define here.

In the GLSL code it will then be named as

and can be accessed via

vec4 Color = texture1D( Colormap, 0.5 );
@endode
where the floating point value is any number between zero and one.
/
RefPtr<RenderBasin::TextureTentacle>
int ColormapTextureUnit = 0,
) const;
RefPtr<RenderBasin::TextureTentacle>
int ColormapTextureUnit = 0,
) const;
/**
Normalization of height values according to a given explicit
range or, without such availability, using the height of the
current bounding box of the rendering object.
This function couples an input range to a shader variable of
type vec2, which allows to scale a height value into normalized
[0,1] range by using the following expression:
@code
uniform vec2 HeightRange;
float ScaledHeightValue =
(HeightValue - HeightRange.x)/(HeightRange.y-HeightRange.x);
MemCore::RefPtr< RenderBasin::TextureTentacle > createColormapTexture(VRenderContext &Context, int TextureUnit, const MemCore::RefPtr< RenderBasin::TextureTentacle > &OldTT=NullPtr(), bool IntegerTexture=false) const
Base class for objects that render information given on a Grid.
Definition GridAnemone.hpp:79
virtual AnemoneRenderStatus initializeAnemone(Anemone &RenderAnemone, const AnemoneCreationContext &ARC, const RefPtr< AnemoneExplorer > &AE) const =0
Initialize a virgin Render Anemone, i.e.
Base class for objects that render information given on the a skeleton of a Grid.
Definition SkeletonRenderer.hpp:25
STL namespace.