The Vish Visualization Shell 0.3
Vish
Public Member Functions | List of all members
Wizt::ShaderConditionals Struct Reference

Base class to ease setting a VSlot as shader defines. More...

#include <ocean/Anemonia/ShaderConditionals.hpp>

Public Member Functions

RenderNamespace::glsl getShaderDefines (const RefPtr< ValuePool > &Context) const
 GLSL code with definition directives, needs to be included early in the shader, for instance in the prefix, or as code preceding anything else in the shader function.
 
bool hasValidShaderDefines (const AnemoneCreatorContext &ACC) const
 Check whether the slots defining the various definitions are modified as compared to the Render Anemone.
 

Detailed Description

Base class to ease setting a VSlot as shader defines.

Definition of a bool in a class:

in<bool> inOrientDots;

Example code in a constructor:

Conditionals[ inOrientDots ] = "ORIENT_DOTS_BY_NORMALVECTOR";
Conditionals[ inCircularDots ] = "DO_CIRCULAR_DOTS";
Conditionals[ inDoDynamicFog ] = "DO_DYNAMIC_FOG";

Also, conditionals based on floating point VSlot inputs as in

in<double,6> inExtendedHeightSensitivityWeight = { "HeightSensitivityWeight", 0.0 };

can be defined. Those require an additional setting in the FloatConditional entries with a function that turns a floating point value into a boolean, which can be done via a lambda expression as in:

Conditionals[ inExtendedHeightSensitivityWeight ] = "DO_EXTENDED_HEIGHT_SENSITIVITY";
FloatConditionals[ inExtendedHeightSensitivityWeight ] = [](double f) { return f != 0.0; };

Member Function Documentation

◆ hasValidShaderDefines()

bool Wizt::ShaderConditionals::hasValidShaderDefines ( const AnemoneCreatorContext ACC) const

Check whether the slots defining the various definitions are modified as compared to the Render Anemone.

Usuaally called from within an isValidAnemone() function.

References Wizt::AnemoneCreatorContext::myAnemoneCreator.