mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Reorgs the editing of postFX so the editor settings edits the default config, and Scene > edit postFX to edit scene
Changes the saving of postfx from saving via the editor to instead save on level save Reorganizes the core postfx folder to subfolders for better organization, as well as moving the shaders to group with the respective postFX Changes the postfx editor so it only edits postFXs that are actively enabled in the scene, and only saves out similarly. Adjusts the level download logic to pass asset id for both data compactness compared to the full level filename, as well as easier lookup reference for associated files like the postFX preset file or decal files from the asset def. Updated the PostFXAsset template to provide an up-to-date starting point/template.
This commit is contained in:
parent
82f7db3d48
commit
3c0c106051
186 changed files with 2534 additions and 1486 deletions
|
|
@ -20,12 +20,14 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$PostFX::@@::modColor = "1 1 1 1";
|
||||
|
||||
singleton ShaderData( @@_Shader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = $Core:modulePath @ "@@P.hlsl";
|
||||
DXPixelShaderFile = "./@@P.hlsl";
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = $Core:modulePath @ "@@P.glsl";
|
||||
OGLPixelShaderFile = "./@@P.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
@ -55,6 +57,7 @@ singleton GFXStateBlockData( @@_StateBlock )
|
|||
|
||||
function @@::setShaderConsts( %this )
|
||||
{
|
||||
%this.setShaderConst( "$modColor", $PostFX::@@::modColor );
|
||||
}
|
||||
|
||||
function @@::preProcess( %this )
|
||||
|
|
@ -69,11 +72,14 @@ function @@::onAdd(%this)
|
|||
|
||||
function @@::onEnabled( %this )
|
||||
{
|
||||
$PostFX::@@::Enabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
function @@::onDisabled( %this )
|
||||
{
|
||||
$PostFX::@@::Enabled = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//This is used to populate the PostFXEditor's settings so the post FX can be edited
|
||||
|
|
@ -82,27 +88,36 @@ function @@::onDisabled( %this )
|
|||
function @@::populatePostFXSettings(%this)
|
||||
{
|
||||
PostEffectEditorInspector.startGroup("@@ - General");
|
||||
PostEffectEditorInspector.addField("$PostFXManager::Settings::Enabled@@", "Enabled", "bool", "", $PostFXManager::PostFX::Enable@@, "");
|
||||
PostEffectEditorInspector.addCallbackField("$PostFX::@@::Enabled", "Enabled", "bool", "", $PostFX::@@::Enabled, "", "toggle@@");
|
||||
PostEffectEditorInspector.addField("$PostFX::@@::modColor", "Modifier Color", "colorI", "", $PostFX::@@::modColor, "");
|
||||
PostEffectEditorInspector.endGroup();
|
||||
}
|
||||
|
||||
//This function pair(applyFromPreset and settingsApply) are done the way they are, with the separated variables
|
||||
//so that we can effectively store the 'settings' away from the live variables that the postFX's actually utilize
|
||||
//when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them
|
||||
//This is called back from our callbackField defined in populatePostFXSettings to
|
||||
//Allow us to easily toggle the postFX and have it respond immediately
|
||||
function PostEffectEditorInspector::toggle@@(%this)
|
||||
{
|
||||
if($PostFX::@@::Enabled)
|
||||
@@.enable();
|
||||
else
|
||||
@@.disable();
|
||||
}
|
||||
|
||||
//This function is called when the post FX is loaded via a postFX preset file. It's used to do any special-case onload work
|
||||
//At minimum, it ensures that if the preset indicates it should be enabled, it actually enables the postFX object itself
|
||||
function @@::applyFromPreset(%this)
|
||||
{
|
||||
//@@ Settings
|
||||
$PostFXManager::PostFX::Enable@@ = $PostFXManager::Settings::Enabled@@;
|
||||
|
||||
if($PostFXManager::PostFX::Enable@@)
|
||||
if($PostFX::@@::Enabled)
|
||||
%this.enable();
|
||||
else
|
||||
%this.disable();
|
||||
}
|
||||
|
||||
function @@::settingsApply(%this)
|
||||
//This function writes out the postFX's settings to the edited preset file
|
||||
function HDRPostFX::savePresetSettings(%this)
|
||||
{
|
||||
$PostFXManager::Settings::Enabled@@ = $PostFXManager::PostFX::Enable@@;
|
||||
PostFXManager::savePresetSetting("$PostFX::@@::Enabled");
|
||||
PostFXManager::savePresetSetting("$PostFX::@@::modColor");
|
||||
}
|
||||
|
||||
//Our actual postFX
|
||||
|
|
@ -126,7 +141,7 @@ singleton PostEffect( @@ )
|
|||
shader = @@_Shader;
|
||||
stateBlock = @@_StateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
target = "$outTex";
|
||||
target = "$backBuffer";
|
||||
targetFormat = "GFXFormatR16G16B16A16F";
|
||||
targetScale = "1 1";
|
||||
};
|
||||
|
|
@ -27,9 +27,15 @@
|
|||
|
||||
uniform sampler2D inputTex;
|
||||
|
||||
in vec4 modColor;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = hdrEncode( vec4(1,1,1,1) );
|
||||
vec4 color = texture(inputTex, IN_uv0);
|
||||
|
||||
color *= modColor;
|
||||
|
||||
OUT_col = hdrEncode( color );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@
|
|||
|
||||
TORQUE_UNIFORM_SAMPLER2D(inputTex, 0);
|
||||
|
||||
uniform float4 modColor;
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return hdrEncode( float4(1,1,1,1) );
|
||||
float4 color = TORQUE_TEX2D( inputTex, IN.uv0 );
|
||||
|
||||
color *= modColor;
|
||||
|
||||
return hdrEncode( color );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue