FiberVISH 0.2
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)
 
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
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:

void setup(const CreationSlots_t&CreationSlots) override
{
SurfaceRenderer::setup(CreationSlots);
setupDefaultColormap(CreationSlots, this, "hypsometric");
}
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 
      @code
      uniform sampler1D Colormap;
      @endcode
      and can be accessed via
      @code
       vec4 Color = texture1D( Colormap, 0.5 ); 
       @endode
       where the floating point value is any number between zero and one.

       To be called from GridAnemone::initializeAnemone() or a child class,
       for instance feedAnemone() as called by SkeletonRenderer and kids.
     /
    RefPtr<RenderBasin::TextureTentacle>
            createColormapTexture(Anemone&RenderAnemone,
                                  VRenderContext&Context,
                                  AnemoneCreatorBase&AC,
                                  int ColormapTextureUnit = 0,
                                  const std::string&ColorMapShaderName = "Colormap"
                                  ) const;

    RefPtr<RenderBasin::TextureTentacle>
            createColormapTexture(Anemone&RenderAnemone,
                                  const GridAnemone::AnemoneCreationContext&ACC,
                                  int ColormapTextureUnit = 0,
                                  const std::string&ColorMapShaderName = "Colormap"
                                  ) 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: