FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Wizt::ShaderFields Class Reference
Inheritance diagram for Wizt::ShaderFields:
Wizt::FieldAnemone Wizt::TypedFieldAnemone< DisplayShader::FieldType > Wizt::FieldSlice Wizt::PictureBase Wizt::ShadedFieldAnemone Wizt::TypedFieldAnemone< FieldType > Wizt::VertexFieldShader< DisplayShader, RenderCategory > Wizt::ColorizedFloatSliceRenderer Wizt::OrthoSlice::FieldState Wizt::VectorFieldSlice Wizt::PictureInjectorBase Wizt::HeightDots Wizt::HeightDotsMultiView Wizt::WhiteDots

Public Types

using ShaderFields_t = map< string, TypedSlot< Fiber::FieldSelector > >
 Mapping from shader attribute names to input field selectors.
 
using string_set = std::unordered_set< string >
 
using getSkeletonFieldsResults_t = map< string, RefPtr< Fiber::Field > >::value_type
 
using FieldValidator_t = std::function< WeakPtr< Fiber::Field >(const Fiber::Skeleton &RI, const std::string &ShaderAttributeName)>
 

Public Member Functions

 ShaderFields (VObject *that, const string &AllowImplicitFieldsSlotName="AllowImplicitFields", int AllowImplicitFieldsSlotEL=9)
 
string_set getShaderDefaultFields (const string &Shaderfield) const
 
bool isNewerThan (const Ageable &A) const
 
getSkeletonFieldsResults_t getSkeletonField (const RefPtr< Fiber::Skeleton > &DestVertexSkeleton, const RefPtr< Fiber::Chart > &chart, const string &ShaderfieldName, const RefPtr< ValuePool > &Context, const FieldSelector &FS) const
 
virtual bool validateFragment (const RefPtr< ValuePool > &Context, const RenderNamespace::glsl &FieldID, const RefPtr< Fiber::FragmentID > &FID, const WeakPtr< Fiber::FiberTypeBase > &FTB, int ElementTextureLength) const
 
bool validateFields (VRequest &Context, const RefPtr< Fiber::Skeleton > &theSkeleton, const RefPtr< Fiber::Chart > &chart, const FieldValidator_t &FV, string &ValidateInputInfoString) const
 
bool isMandatoryShaderAttribute (const string &AttributeName) const
 Check whether a given shader attribute must be provided.
 
bool addField (VRequest &Context, const RefPtr< Fiber::Skeleton > &theSkeleton, const RefPtr< Fiber::Chart > &chart, const TypedSlot< Fiber::FieldSelector > &theFieldSelector, const RenderNamespace::glsl &AttributeName, RenderFields &Result, string &InfoString)
 Add a field to the provided FieldList.
 
bool addFields (VRequest &Context, const RefPtr< Fiber::Skeleton > &theSkeleton, const RefPtr< Fiber::Chart > &chart, RenderFields &Result, string &InfoString)
 Add all stored fields to the provided FieldList.
 
RenderNamespace::glsl getShaderDefinitions (const RefPtr< ValuePool > &Context, const RenderNamespace::glsl &FieldID, const Fiber::Field &F, const RefPtr< Fiber::FragmentID > &FID, const RefPtr< Fiber::SizeInterface > &PrimaryDataFragmentSize) const
 
RenderNamespace::glsl getFieldsShaderDefinitions (const RefPtr< ValuePool > &Context, const RenderFields::RefinementIndex &SkeletonID, const RefPtr< Fiber::FragmentID > &FID, const RefPtr< Fiber::SizeInterface > &PrimaryDataFragmentSize, const RenderFields &RF) const
 
RenderNamespace::glsl getFieldsShaderPrefix (const RefPtr< ValuePool > &Context, const RenderFields::RefinementIndex &SkeletonID, const RefPtr< Fiber::FragmentID > &FID, Fiber::CreativeArrayBase &myPrimaryDataFragment, const RenderFields &RF) const
 

Static Public Member Functions

static getSkeletonFieldsResults_t getSkeletonField (const RefPtr< Fiber::Skeleton > &DestVertexSkeleton, const RefPtr< Fiber::Chart > &chart, const FieldSelector &FS, const string_set &ImplicitFieldNames, bool AllowImplicitFields)
 Provide a field on a skeleton, considering possibly given implicit field names, i.e.
 
static RenderNamespace::glsl getPositionsShaderFunction (const Fiber::CreativeArrayBase &theCoordinateFragment)
 

Public Attributes

ShaderFields_t myShaderFields
 Map from names used in the GLSL code to input field slots.
 
VObject::in< boolinAllowImplicitFields
 
std::unordered_map< string, string_setmyShaderDefaultFields
 For each shader field optionally provide a name for the field on the Grid.
 
std::unordered_set< std::string > MandatoryShaderAttributes
 

Static Public Attributes

static const char define_ATTRIBUTE_INDEX_LOCATION []
 A glsl macro to define a.
 

Member Function Documentation

◆ addFields()

bool Wizt::ShaderFields::addFields ( VRequest Context,
const RefPtr< Fiber::Skeleton > &  theSkeleton,
const RefPtr< Fiber::Chart > &  chart,
RenderFields Result,
string &  InfoString 
)

Add all stored fields to the provided FieldList.

To be called from addSupplementaryData() .

◆ getPositionsShaderFunction()

RenderNamespace::glsl Wizt::ShaderFields::getPositionsShaderFunction ( const Fiber::CreativeArrayBase theCoordinateFragment)
static
    Defines functions in the vertex shader that allow to compute positions also
    from uniform coordinates.
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34

◆ getShaderDefinitions()

RenderNamespace::glsl Wizt::ShaderFields::getShaderDefinitions ( const RefPtr< ValuePool > &  Context,
const RenderNamespace::glsl &  FieldID,
const Fiber::Field F,
const RefPtr< Fiber::FragmentID > &  FID,
const RefPtr< Fiber::SizeInterface > &  PrimaryDataFragmentSize 
) const

◆ getSkeletonField()

static getSkeletonFieldsResults_t Wizt::ShaderFields::getSkeletonField ( const RefPtr< Fiber::Skeleton > &  DestVertexSkeleton,
const RefPtr< Fiber::Chart > &  chart,
const FieldSelector FS,
const string_set ImplicitFieldNames,
bool  AllowImplicitFields 
)
static

Provide a field on a skeleton, considering possibly given implicit field names, i.e.

if no field can be found via the FieldSelector, then go via the implicit field names as given by a list of strings.

◆ isMandatoryShaderAttribute()

bool Wizt::ShaderFields::isMandatoryShaderAttribute ( const string &  AttributeName) const

Check whether a given shader attribute must be provided.

This function simply checks its mentioning in the MandatoryShaderAttributes member array.

Member Data Documentation

◆ define_ATTRIBUTE_INDEX_LOCATION

constinit const char Wizt::ShaderFields::define_ATTRIBUTE_INDEX_LOCATION
static
Initial value:
=
GLSL_START R"SHADER(
// ShaderFields::getShaderDefinitions()
#ifndef ATTRIBUTE_INDEX_LOCATION
# if __VERSION__ >= 330
# define ATTRIBUTE_INDEX_LOCATION(index) layout(location=index)
# else
# define ATTRIBUTE_INDEX_LOCATION(index)
# endif
#endif // ATTRIBUTE_INDEX_LOCATION
)SHADER"

A glsl macro to define a.

layout(location=index)

attribute for vertex attributes, but only for GLSL version higher than 3.3, otherwie it is empty.

◆ myShaderFields

ShaderFields_t Wizt::ShaderFields::myShaderFields

Map from names used in the GLSL code to input field slots.

This map has to be filled in the derived object's constructor or setup function / functor. For instance:

class MyObject : public FieldAnemone
{
SecondaryField;
public:
typedef LIST<float, LIST<double>> FieldType;
MyObject(...)
{
myShaderFields[ "SecondaryField" ] = SecondaryField;
}
};
Base class for objects that render information given on a Field.
Definition FieldAnemone.hpp:39

The specified field's data will then appears as vertex shader attribute

in float SecondaryField;