LensDistortionEffect Class

Adds a screen-space effect to the selected Viewport to simulate the lens distortion produced by real-world cameras with very wide fields of view. Based on https://www.decarpentier.nl/lens-distortion The effect is improved considerably by enabling anti-aliasing (e.g., via RenderSystem.Options.antialiasSamples at startup, or using the fdt aasamples key-in`).

@note Because this effect applies a non-linear transform to each pixel, operations like snapping to geometry will not work properly. Element locate will work however -

@see ScreenSpaceEffectSource.sampleSourcePixel.

Extends

Methods

Name Description
constructor(..._args: any[]): LensDistortionEffect    
defineEffect(builder: ScreenSpaceEffectBuilder): void Protected Add uniforms, varyings, etc.  

Inherited methods

Name Inherited from Description
parseAndRun(..._args: string[]): Promise<boolean> Inherited AddEffectTool Run this instance of a tool using a series of string arguments.
run(): Promise<boolean> Inherited AddEffectTool Run this instance of a Tool.
register(namespace?: string): void Static Inherited AddEffectTool Register this Tool class with the ToolRegistry.

Properties

Name Type Description
effectName Accessor Protected ReadOnly string Name of effect as used in keyins like fdt effect add.  
source Accessor Protected ReadOnly { fragment: string, sampleSourcePixel: string, vertex: string } vertex, fragment, and optional sampleSourcePixel GLSL snippets.  
textureCoordFromPosition Accessor Protected ReadOnly boolean Whether the fragment shader should include built-in textureCoordFromPosition function.  
toolId Static string The unique string that identifies this tool.  

Inherited properties

Name Type Inherited from Description
description Accessor Inherited ReadOnly string AddEffectTool Get the localized description string from this Tool's class
description Accessor Static Inherited ReadOnly string AddEffectTool Get the localized description for this Tool class. This returns the value of "tools." + this.toolId + ".description" from
its registered Namespace (e.g. "en/MyApp.json"). If that key is not in the localization namespace,
flyover is returned.
englishKeyin Accessor Static Inherited ReadOnly string AddEffectTool Get the English keyin string for this Tool class. This returns the value of "tools." + this.toolId + ".keyin" from
its registered Namespace (e.g. "en/MyApp.json").
flyover Accessor Inherited ReadOnly string AddEffectTool Get the localized flyover string from this Tool's class
flyover Accessor Static Inherited ReadOnly string AddEffectTool Get the localized flyover for this Tool class. This returns the value of "tools." + this.toolId + ".flyover" from
its registered Namespace (e.g. "en/MyApp.json"). If that key is not in the localization namespace,
keyin is returned.
hidden Static Inherited boolean AddEffectTool If true, this Tool will not appear in the list from ToolRegistry.getToolList.
iconSpec Accessor Inherited ReadOnly string AddEffectTool Get the iconSpec from this Tool's class.
iconSpec Static Inherited string AddEffectTool The icon for this Tool.
keyin Accessor Inherited ReadOnly string AddEffectTool Get the localized keyin string from this Tool's class
keyin Accessor Static Inherited ReadOnly string AddEffectTool Get the localized keyin string for this Tool class. This returns the value of "tools." + this.toolId + ".keyin" from
its registered Namespace (e.g. "en/MyApp.json").
maxArgs Accessor Static Inherited ReadOnly undefined | number AddEffectTool The maximum number of arguments allowed by parseAndRun, or undefined if there is no maximum.
If subclasses override parseAndRun, they should also override this method to indicate the maximum
number of arguments their implementation expects.
minArgs Accessor Static Inherited ReadOnly number AddEffectTool The minimum number of arguments allowed by parseAndRun. If subclasses override parseAndRun, they should also
override this method to indicate the minimum number of arguments their implementation expects. UI controls can use
this information to ensure the tool has enough information to execute.
namespace Static Inherited string AddEffectTool The namespace that provides localized strings for this Tool.
toolId Accessor Inherited ReadOnly string AddEffectTool Get the toolId string for this Tool class. This string is used to identify the Tool in the ToolRegistry and is used to localize
the keyin, description, etc. from the current locale.

Defined in

Last Updated: 17 December, 2024