|
A fullscreen shader effect. More...
Public Member Functions | |
void | clearShaderMacros () |
Remove all shader macros. | |
void | disable () |
Disables the effect. | |
String | dumpShaderDisassembly () |
Dumps this PostEffect shader's disassembly to a temporary text file. | |
void | enable () |
Enables the effect. | |
float | getAspectRatio () |
bool | isEnabled () |
void | reload () |
Reloads the effect shader and textures. | |
void | removeShaderMacro (string key) |
Remove a shader macro. This will usually be called within the preProcess callback. | |
void | setShaderConst (string name, string value) |
Sets the value of a uniform defined in the shader. This will usually be called within the setShaderConsts callback. Array type constants are not supported. | |
void | setShaderMacro (string key, string value="") |
Adds a macro to the effect's shader or sets an existing one's value. This will usually be called within the onAdd or preProcess callback. | |
bool | toggle () |
Toggles the effect between enabled / disabled. | |
Callbacks | |
void | onAdd () |
Called when this object is first created and registered. | |
void | onDisabled () |
Called when this effect becomes disabled. | |
bool | onEnabled () |
Called when this effect becomes enabled. If the user returns false from this callback the effect will not be enabled. | |
void | preProcess () |
Called when an effect is processed but before textures are bound. This allows the user to change texture related paramaters or macros at runtime. | |
void | setShaderConsts () |
Called immediate before processing this effect. This is the user's chance to set the value of shader uniforms (constants). | |
Public Attributes | |
bool | allowReflectPass |
Is this effect processed during reflection render passes. | |
bool | isEnabled |
Is the effect on. | |
bool | oneFrameOnly |
Allows you to turn on a PostEffect for only a single frame. | |
bool | onThisFrame |
Allows you to turn on a PostEffect for only a single frame. | |
string | renderBin |
Name of a renderBin, used if renderTime is PFXBeforeBin or PFXAfterBin. | |
float | renderPriority |
PostEffects are processed in DESCENDING order of renderPriority if more than one has the same renderBin/Time. | |
PFXRenderTime | renderTime |
When to process this effect during the frame. | |
string | shader |
Name of a GFXShaderData for this effect. | |
bool | skip |
Skip processing of this PostEffect and its children even if its parent is enabled. Parent and sibling PostEffects in the chain are still processed. | |
GFXStateBlockData | stateBlock |
Name of a GFXStateBlockData for this effect. | |
string | target |
String identifier of this effect's target texture. | |
PFXTargetClear | targetClear |
Describes when the target texture should be cleared. | |
ColorF | targetClearColor |
Color to which the target texture is cleared before rendering. | |
string | targetDepthStencil |
Optional string identifier for this effect's target depth/stencil texture. | |
GFXFormat | targetFormat |
Format of the target texture, not applicable if writing to the backbuffer. | |
Point2F | targetScale |
If targetSize is zero this is used to set a relative size from the current target. | |
Point2I | targetSize |
If non-zero this is used as the absolute target size. | |
filename | texture [4] |
Input textures to this effect ( samplers ). |
A fullscreen shader effect.
void PostEffect::clearShaderMacros | ( | ) |
Remove all shader macros.
void PostEffect::disable | ( | ) |
Disables the effect.
String PostEffect::dumpShaderDisassembly | ( | ) |
Dumps this PostEffect shader's disassembly to a temporary text file.
void PostEffect::enable | ( | ) |
Enables the effect.
float PostEffect::getAspectRatio | ( | ) |
bool PostEffect::isEnabled | ( | ) |
void PostEffect::onAdd | ( | ) |
Called when this object is first created and registered.
void PostEffect::onDisabled | ( | ) |
Called when this effect becomes disabled.
bool PostEffect::onEnabled | ( | ) |
Called when this effect becomes enabled. If the user returns false from this callback the effect will not be enabled.
void PostEffect::preProcess | ( | ) |
Called when an effect is processed but before textures are bound. This allows the user to change texture related paramaters or macros at runtime.
function SSAOPostFx::preProcess( %this ) { if ( $SSAOPostFx::quality !$= %this.quality ) { %this.quality = mClamp( mRound( $SSAOPostFx::quality ), 0, 2 ); %this.setShaderMacro( "QUALITY", %this.quality ); } %this.targetScale = $SSAOPostFx::targetScale; }
void PostEffect::reload | ( | ) |
Reloads the effect shader and textures.
void PostEffect::removeShaderMacro | ( | string | key | ) |
Remove a shader macro. This will usually be called within the preProcess callback.
key | Macro to remove. |
void PostEffect::setShaderConst | ( | string | name, | |
string | value | |||
) |
Sets the value of a uniform defined in the shader. This will usually be called within the setShaderConsts callback. Array type constants are not supported.
name | Name of the constanst, prefixed with '$'. | |
value | Value to set, space seperate values with more than one element. |
function MyPfx::setShaderConsts( %this ) { // example float4 uniform %this.setShaderConst( "$colorMod", "1.0 0.9 1.0 1.0" ); // example float1 uniform %this.setShaderConst( "$strength", "3.0" ); // example integer uniform %this.setShaderConst( "$loops", "5" );}
void PostEffect::setShaderConsts | ( | ) |
Called immediate before processing this effect. This is the user's chance to set the value of shader uniforms (constants).
void PostEffect::setShaderMacro | ( | string | key, | |
string | value = "" | |||
) |
Adds a macro to the effect's shader or sets an existing one's value. This will usually be called within the onAdd or preProcess callback.
key | lval of the macro. | |
value | rval of the macro, or may be empty. |
function MyPfx::onAdd( %this ) { %this.setShaderMacro( "NUM_SAMPLES", "10" ); %this.setShaderMacro( "HIGH_QUALITY_MODE" ); // In the shader looks like... // #define NUM_SAMPLES 10 // #define HIGH_QUALITY_MODE }
bool PostEffect::toggle | ( | ) |
Toggles the effect between enabled / disabled.
Is this effect processed during reflection render passes.
Is the effect on.
Allows you to turn on a PostEffect for only a single frame.
Allows you to turn on a PostEffect for only a single frame.
string PostEffect::renderBin |
Name of a renderBin, used if renderTime is PFXBeforeBin or PFXAfterBin.
PostEffects are processed in DESCENDING order of renderPriority if more than one has the same renderBin/Time.
When to process this effect during the frame.
string PostEffect::shader |
Name of a GFXShaderData for this effect.
bool PostEffect::skip |
Skip processing of this PostEffect and its children even if its parent is enabled. Parent and sibling PostEffects in the chain are still processed.
Name of a GFXStateBlockData for this effect.
string PostEffect::target |
String identifier of this effect's target texture.
Describes when the target texture should be cleared.
ColorF PostEffect::targetClearColor |
Color to which the target texture is cleared before rendering.
Optional string identifier for this effect's target depth/stencil texture.
Format of the target texture, not applicable if writing to the backbuffer.
Point2F PostEffect::targetScale |
If targetSize is zero this is used to set a relative size from the current target.
Point2I PostEffect::targetSize |
If non-zero this is used as the absolute target size.
filename PostEffect::texture[4] |
Input textures to this effect ( samplers ).