class FlxRadialWipeShader
package flixel.addons.display
extends FlxGraphicsShader › GraphicsShader › Shader
import flixel.addons.display.FlxRadialGauge
@:directlyUsed@:build(openfl.utils._internal.ShaderMacro.build())@:autoBuild(openfl.utils._internal.ShaderMacro.build())@:build(hscript.macros.UsingHandler.build())@:build(hscript.macros.ClassExtendMacro.build())A shader that masks a static sprite radially, based on the start
and end
angles
Constructor
@:glFragmentSource("\n\t\t#pragma header\n\t\t\n\t\tconst float TAU = 6.2831853072;\n\t\t\n\t\tuniform float _amount;\n\t\tuniform float _start;\n\t\tuniform float _end;\n\t\t\n\t\tfloat getGradiant(in vec2 dist)\n\t\t{\n\t\t\tfloat start = _start / 360.0;\n\t\t\tfloat delta = (_end - _start) / 360.0;\n\t\t\tfloat angle = atan(dist.y, dist.x) / TAU;\n\t\t\tif (_end > _start)\n\t\t\t\treturn mod(angle - start, 1.0) / delta;\n\t\t\telse\n\t\t\t\treturn mod(start - angle, 1.0) / -delta;\n\t\t}\n\t\t\n\t\tfloat wedge(in vec2 uv, in float ratio)\n\t\t{\n\t\t\tvec2 dist = uv - vec2(0.5);\n\t\t\tfloat grad = getGradiant(dist);\n\t\t\treturn step(ratio, grad < 0.0 ? 1.0 : grad);\n\t\t}\n\t\t\n\t\tvoid main()\n\t\t{\n\t\t\tif (_amount > 0.0)\n\t\t\t{\n\t\t\t\tfloat amount = min(1.0, max(0.0, _amount));\n\t\t\t\tvec4 bitmap = flixel_texture2D(bitmap, openfl_TextureCoordv);\n\t\t\t\tofl_FragColor = mix(bitmap, vec4(0.0), wedge(openfl_TextureCoordv, amount));\n\t\t\t}\n\t\t\telse\n\t\t\t\tofl_FragColor = vec4(0.0);\n\t\t}")new()
Variables
Inherited Variables
Defined by FlxGraphicsShader
Defined by GraphicsShader
Defined by Shader
data:ShaderData
Provides access to parameters, input images, and metadata for the
Shader instance. ShaderParameter objects representing parameters for
the shader, ShaderInput objects representing the input images for the
shader, and other values representing the shader's metadata are
dynamically added as properties of the data
property object when the
Shader instance is created. Those properties can be used to introspect
the shader and to set parameter and input values.
For information about accessing and manipulating the dynamic
properties of the data
object, see the ShaderData class description.
glFragmentSource:String
Get or set the fragment source used when compiling with GLSL.
This property is not available on the Flash target.
@SuppressWarnings("checkstyle:Dynamic")read onlyglProgram:GLProgram
The compiled GLProgram if available.
This property is not available on the Flash target.
glVertexSource:String
Get or set the vertex source used when compiling with GLSL.
This property is not available on the Flash target.
precisionHint:ShaderPrecision
The precision of math operations performed by the shader.
The set of possible values for the precisionHint
property is defined
by the constants in the ShaderPrecision class.
The default value is ShaderPrecision.FULL
. Setting the precision to
ShaderPrecision.FAST
can speed up math operations at the expense of
precision.
Full precision mode (ShaderPrecision.FULL
) computes all math
operations to the full width of the IEEE 32-bit floating standard and
provides consistent behavior on all platforms. In this mode, some math
operations such as trigonometric and exponential functions can be
slow.
Fast precision mode (ShaderPrecision.FAST
) is designed for maximum
performance but does not work consistently on different platforms and
individual CPU configurations. In many cases, this level of precision
is sufficient to create graphic effects without visible artifacts.
The precision mode selection affects the following shader operations. These operations are faster on an Intel processor with the SSE instruction set:
sin(x)
cos(x)
tan(x)
asin(x)
acos(x)
atan(x)
atan(x, y)
exp(x)
exp2(x)
log(x)
log2(x)
pow(x, y)
reciprocal(x)
sqrt(x)