![]() |
ImFusion SDK 4.3
|
#include <ImFusion/US/GlGeometricTransform.h>
Base interface for implementing polymorphic geometric transforms from and to image coordinates using OpenGL. More...
Inheritance diagram for GlGeometricTransform:Base interface for implementing polymorphic geometric transforms from and to image coordinates using OpenGL.
The defineName is IMAGE_TRANSFORM and the include file is expected to define functions with the following signatures:
Where imageCoord and alternateCoord are the image coordinates and coordinates in the alternate space respectively. The alternateNormalized flag indicates whether the given or returned alternate coordinates are normalized to the range [0, 1], i.e. texture coordinates. For resulting points that do not lie within the image or alternate space, the functions should return vec3(NaN) if NaNs are supported or vec3(-Inf) otherwise.
A possible implementation of a class defining a trivial translation transform could be:
GlTranslationTransform.h
GlTranslationTransform.cpp
TranslationTransform.glh
The class can be used now:
On this case, dummy.frag implements transformToAlternate and transformFromAlternate inside a ifndef IMAGE_TRANSFORM with a in vec3 textCoords, we override them with the contents of our glTranslation, set the u_exampletranslation to the given one, and execute.
Public Member Functions | |
| GlGeometricTransform (const std::string &includePath) | |
Instantiates a new GL::AbstractInclude using IMAGE_TRANSFORM as defineName and the given path the to retrieve the GLSL source code from. | |
| int | setIncludeArguments (GL::Program &p, const std::string &prefix="transform") const override=0 |
| Called by users of GlGeometricTransform in order to correctly set up the transform shader. | |
Public Member Functions inherited from AbstractInclude | |
| 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. | |
Public Member Functions inherited from MultiIncludable< GlGeometricTransform > | |
| 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). | |
Static Public Member Functions | |
| static std::string | defineName () |
| Returns "IMAGE_TRANSFORM". | |
| static std::string | defineSuffix () |
| Returns "TRANSFORM". | |
| static std::string | multiIncludeDefine (const std::string &replacementToken) |
Returns "IMAGE_" + toUpper(replacementToken) | |
Additional Inherited Members | |
Public Types inherited from MultiIncludable< GlGeometricTransform > | |
| using | MultiIncludeType |
| Alias for type of a multi-include instance of the original include. | |
Protected Member Functions inherited from MultiIncludable< GlGeometricTransform > | |
| MultiIncludable (GlGeometricTransform *crtpInstance, const std::string &baseToken, Flags< ShaderTextReplacement > replacementScheme) | |
| Instantiate and configure the MultiIncludable interface. | |
|
overridepure virtual |
Called by users of GlGeometricTransform in order to correctly set up the transform shader.
Subclasses should implement this function so that it correctly sets all needed uniforms and input textures to be used by the OpenGL shader instance. Make sure to use the given prefix argument instead of a hardcoded "transform" when defining uniform names to support multi-includes where the prefixes have been replaced with unique alternatives. Example:
Implemented in GlScanConversionConvexGeometricTransform, GlScanConversionLinearGeometricTransform, and GlScanConversionSectorGeometricTransform.