Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Wizt::ShaderFields Class Reference
Inheritance diagram for Wizt::ShaderFields:
Wizt::FieldAnemone Wizt::TypedFieldAnemone< double > Wizt::TypedFieldAnemone< float > Wizt::TypedFieldAnemone< LIST< double, float > > Wizt::TypedFieldAnemone< META::IntegerTypeList > Wizt::TypedFieldAnemone< META::NativeTypeList > Wizt::TypedFieldAnemone< Field_Type_t > Wizt::TypedFieldAnemone< DisplayShader::FieldType > Wizt::FieldSlice Wizt::PictureBase Wizt::ShadedFieldAnemone Wizt::TypedFieldAnemone< FieldType >

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

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)
 Defines functions in the vertex shader that allow to compute positions also from uniform coordinates.

Public Attributes

ShaderFields_t myShaderFields
 Map from names used in the GLSL code to input field slots.
VObject::in< bool > inAllowImplicitFields
std::unordered_map< string, string_set > myShaderDefaultFields
 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 Typedef Documentation

◆ FieldValidator_t

using Wizt::ShaderFields::FieldValidator_t
Initial value:
std::function<
WeakPtr<Fiber::Field>(const Fiber::Skeleton&RI, const std::string&ShaderAttributeName)>
A Skeleton is a set of Representation object, each of them accessed by an Representer object.
Definition Skeleton.hpp:102

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() .

References addFields(), getSkeletonField(), isMandatoryShaderAttribute(), and myShaderFields.

Referenced by addFields(), and getSkeletonField().

◆ 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.

vec4 get_gl_Position();
vec4 get_gl_RelativePosition();

References MemCore::CreatorBase< class Domain >::get(), getPositionsShaderFunction(), and Wizt::UniformVertexAttribute::getShaderDefines().

Referenced by getPositionsShaderFunction(), and getSkeletonField().

◆ getShaderDefinitions()

◆ getSkeletonField()

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.

References addField(), addFields(), getPositionsShaderFunction(), getShaderDefinitions(), getSkeletonField(), and isMandatoryShaderAttribute().

Referenced by addField(), addFields(), Wizt::FieldAnemone::addSupplementaryData(), getSkeletonField(), and Wizt::FieldAnemone::validateInput().

◆ 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.

References isMandatoryShaderAttribute().

Referenced by addField(), addFields(), Wizt::FieldAnemone::addSupplementaryData(), getSkeletonField(), and isMandatoryShaderAttribute().

Member Data Documentation

◆ define_ATTRIBUTE_INDEX_LOCATION

const char Wizt::ShaderFields::define_ATTRIBUTE_INDEX_LOCATION
staticconstinit
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.

Referenced by getShaderDefinitions().

◆ 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
ShaderFields_t myShaderFields
Map from names used in the GLSL code to input field slots.
Definition ShaderFields.hpp:52

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

in float SecondaryField;

Referenced by addFields().