Applies a normal map to the filtered Object in order to displace pixels.

Uses red and green channels to displaces horizontal and vertical axes accordingly.

Constructor

@:value({ wrap : true, dispY : 5., dispX : 5. })new(normalMap:Tile, dispX:Float = 5., dispY:Float = 5., wrap:Bool = true)

Create a new displacement filter.

Parameters:

normalMap

The normal map used for displacement lookup.

dispX

Horizontal displacement distance in pixels.

dispY

Vertical displacement distance in pixels.

wrap

Wrap normal map around when lookup UV goes out of bounds.

Variables

dispX:Float

Horizontal displacement distance in pixels.

dispY:Float

Vertical displacement distance in pixels.

normalMap:Tile

The normal map used for displacement lookup.

wrap:Bool

When enabled, the displacement map will wrap around when lookup reaches its edges. Otherwise out-of-bounds values are clamped to the border.

Methods

Inherited Variables

Defined by Filter

@:value(true)autoBounds:Bool = true

When enabled, rendering bounds of the filter will be expanded by Filter.boundsExtend in all directions. Otherwise filter should provide custom bounds through Filter.getBounds call. Default : true.

@:value(0.)boundsExtend:Float = 0.

Rendering texture boundaries extent. Increases the rendering area by twice the Filter.boundsExtend value. Automatically applied to object bounds when autoBounds = true or Filter.getBounds is not overridden. Does not affect boundaries when autoBounds = true and boundsExtend is less than 0.

@:value(true)@:isVarenable:Bool = true

When filter is disabled, attached object will render as usual.

@:value(1)resolutionScale:Float = 1

Custom rendering resolution scaling of the filter.

Stacks with additional scaling from Filter.useResolutionScaling if enabled.

@:value(false)smooth:Bool = false

When enabled, filters on not Object which are not Drawable will use bilinear filtering when displayed and some filter will also use bilinear filtering on intermediate textures.

@:value(defaultUseScreenResolution)useScreenResolution:Bool = defaultUseScreenResolution

Use the screen resolution to upscale/downscale the filter rendering resolution.

Stacks with additional scaling from Filter.resolutionScale if enabled.

Inherited Methods

Defined by Filter

bind(s:Object):Void

Sent when filter is bound to an Object s. If Object was not yet allocated, method will be called when it's added to allocated Scene.

getBounds(s:Object, bounds:Bounds, scale:Point):Void

Method should populate bounds with rendering boundaries of the Filter for Object s. Initial bounds contents are undefined and it's recommended to either clear them or call s.getBounds(s, bounds). Only used when Filter.autoBounds is false.

By default uses given Object bounds and extends them with Filter.boundsExtend. Compared to autoBounds = true, negative boundsExtend are still applied, causing rendering area to shrink.

Parameters:

s

The Object instance to which the filter is applied.

bounds

The Bounds instance which should be populated by the filter boundaries.

scale

Contains the desired rendering resolution scaling which should be accounted when constructing the bounds. Can be edited to override provided scale values.

unbind(s:Object):Void

Sent when filter was unbound from an Object s. Method won't be called if Object was not yet allocated.