![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/ParametricDeformation.h>
Base interface for a parametric deformation in 2D or 3D. More...
Base interface for a parametric deformation in 2D or 3D.
Derived classes will implement actual parametric deformation models. Additionally to the displacement method, the shader include is expected to have the following two methods:
Public Member Functions | |
ParametricDeformation (const std::string &shaderPath) | |
Initializes the parametric deformation with path to the GlInclude file. | |
~ParametricDeformation () override | |
Destructor. | |
virtual void | setParameters (const std::vector< double > &pars) |
Set the parameters of the deformation. | |
virtual void | parameters (std::vector< double > &parsOut) const |
Retrieve the current parameters of the deformation. | |
virtual void | setDisplacement (const std::vector< vec3f > &d) |
Set displacement in mm for all control points if applicable For 2D images the z-coordinate of the displacement is ignored. | |
virtual std::vector< vec3f > | displacements () const |
Get displacement in mm of all control points if applicable. | |
virtual std::vector< vec3 > | controlPoints () const |
Returns a list of all control points in world coordinates (might be empty for certain models) | |
virtual int | numberOfControlPoints () const |
Returns the number of control points (may be zero for certain deformations) | |
virtual int | numberOfParameters () const |
Returns the number of parameters e.g. for optimization. | |
![]() | |
Deformation (const std::string &shaderPath) | |
Initializes the Deformation with path to the GlInclude file. | |
virtual Deformation * | clone () const =0 |
Returns a copy of the deformation. | |
virtual vec3 | displacement (const vec3 &pos) const =0 |
Returns the displacement for pos (in world coordinates). | |
virtual vec3 | displacement (const vec2 &pos) const |
Returns the displacement at the world position pos. | |
virtual vec3 | displacePoint (const vec3 &point) const |
Returns the displaced position of the given point in world-coordinates. | |
virtual bool | isIdentity () const =0 |
Returns if the current state of the deformation transformations the image or not. | |
virtual void | setIdentity ()=0 |
Sets all displacements to 0. | |
int | setIncludeArguments (GL::Program &p, const SharedImage *img=nullptr, const std::string &prefix="deform") const override=0 |
Override default arguments for GlMask includes. | |
void | setDisabled (bool flag) |
Set a disabled flag in order to hide the visualization of this deformation. | |
bool | disabled () const |
Return whether the deformation was set to disabled. | |
virtual int | dimension () const =0 |
Returns the dimension of the deformation. | |
virtual std::string | id () const =0 |
Returns a unique string identifier for this type of deformation. | |
virtual std::unique_ptr< SharedImageSet > | supportingImages () const |
Returns the images that, together with the configuration, defines the deformation. | |
![]() | |
AbstractInclude (const std::string &defineName, const std::string &includePath) | |
Creates a AbstractInclude for the given define and with the corresponding GLSL file at includePath. | |
const std::string & | defineName () const |
Returns the name of define used by this include. | |
const std::string & | includePath () const |
Returns the path to the included shader file. | |
virtual std::function< std::string(const std::string &)> | includeCodeSubstitution () const |
Optionally the abstract include can provide a function to change the shader code. | |
virtual std::vector< AbstractInclude * > | dependentIncludes () const |
Returns a list of dependent abstract includes that need to be included as well. | |
virtual Fingerprint | fingerprint () const |
Provides a finger print of the include. | |
![]() | |
std::shared_ptr< MultiIncludeType > | createMultiInclude (const std::string &replacementToken) |
Instantiates a new AbstractInclude instance where all occurrences of baseToken provided during construction are replaces with replacementToken according to the specified replacementScheme. | |
virtual int | setIncludeArguments (Program &prog, IncludeArgumentsTypes... includeArgs, const std::string &token) const=0 |
Interface that multi includes should use to configure the shader include (such as setting uniforms, binding textures, etc). | |
![]() | |
virtual void | configure (const Properties *p) |
Configure this object instance by de-serializing the given Properties. | |
virtual void | configuration (Properties *p) const |
Serialize the current object configuration into the given Properties object. | |
virtual void | configureDefaults () |
Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
void | registerParameter (ParameterBase *param) |
Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
void | unregisterParameter (const ParameterBase *param) |
Remove the given Parameter or SubProperty from the list of registered parameters. | |
Configurable (const Configurable &rhs) | |
Configurable (Configurable &&rhs) noexcept | |
Configurable & | operator= (const Configurable &) |
Configurable & | operator= (Configurable &&) noexcept |
Additional Inherited Members | |
![]() | |
using | MultiIncludeType |
Alias for type of a multi-include instance of the original include. | |
![]() | |
static std::string | defineName () |
Returns the define name of GlAbstractInclude for all deformations. | |
static std::string | defineSuffix () |
Returns "DEFORM". | |
static std::string | multiIncludeDefine (const std::string &replacementToken) |
Returns "IMAGE_" + toUpper(replacementToken) | |
![]() | |
Signal< const DeformationEvent & > | signalChanged |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
void | notifyListeners (const DeformationEvent &event) const |
convenience function to call signalChanged.emitSignal(event) . | |
![]() | |
MultiIncludable (Deformation *crtpInstance, const std::string &baseToken, Flags< ShaderTextReplacement > replacementScheme) | |
Instantiate and configure the MultiIncludable interface. | |
![]() | |
bool | m_disabled |
Disabled flag for visualization. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
|
virtual |
Set the parameters of the deformation.
Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.
|
virtual |
Retrieve the current parameters of the deformation.
Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.
|
virtual |
Set displacement in mm for all control points if applicable For 2D images the z-coordinate of the displacement is ignored.
Reimplemented in FreeFormDeformation, and GlTPSDeformation.
|
virtual |
Get displacement in mm of all control points if applicable.
Reimplemented in FreeFormDeformation, and GlTPSDeformation.
|
virtual |
Returns a list of all control points in world coordinates (might be empty for certain models)
Reimplemented in FreeFormDeformation, and GlTPSDeformation.
|
inlinevirtual |
Returns the number of control points (may be zero for certain deformations)
Reimplemented in FreeFormDeformation, and GlTPSDeformation.
|
inlinevirtual |
Returns the number of parameters e.g. for optimization.
Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.