mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Move the common shader and postFX stuff to core, and moved the debug visualizers to the world editor, where they're actually used.
This commit is contained in:
parent
1ed8b05169
commit
1520bc83b2
333 changed files with 498 additions and 508 deletions
78
Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui
Normal file
78
Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
//---------------------------------------------------------------------------------------------
|
||||
// Torque 3D
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) {
|
||||
canSaveDynamicFields = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiModelessDialogProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "0 0";
|
||||
Extent = "1024 768";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
noCursor = true;
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
internalName = "WindowCtrl";
|
||||
canSaveDynamicFields = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiWindowProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "50 50";
|
||||
Extent = "347 209";
|
||||
MinExtent = "150 100";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "1";
|
||||
minSize = "50 50";
|
||||
EdgeSnap = "1";
|
||||
text = "ShadowViz";
|
||||
closeCommand = "toggleShadowViz();";
|
||||
|
||||
new GuiMaterialCtrl() {
|
||||
internalName = "MatCtrl";
|
||||
canSaveDynamicFields = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
Position = "3 23";
|
||||
Extent = "341 181";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
Docking = "Client";
|
||||
Margin = "2 2 2 2";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
materialName = "AL_ShadowVisualizeMaterial";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
BIN
Templates/BaseGame/game/tools/worldEditor/images/depthviz.png
Normal file
BIN
Templates/BaseGame/game/tools/worldEditor/images/depthviz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 551 B |
|
|
@ -43,6 +43,7 @@ function initializeWorldEditor()
|
|||
exec("./gui/AddFMODProjectDlg.ed.gui");
|
||||
exec("./gui/SelectObjectsWindow.ed.gui");
|
||||
exec("./gui/ProceduralTerrainPainterGui.gui" );
|
||||
exec("./gui/shadowViz.gui" );
|
||||
|
||||
// Load Scripts.
|
||||
exec("./scripts/menus.ed.cs");
|
||||
|
|
@ -62,6 +63,8 @@ function initializeWorldEditor()
|
|||
exec("./scripts/AddFMODProjectDlg.ed.cs");
|
||||
exec("./scripts/SelectObjectsWindow.ed.cs");
|
||||
exec("./scripts/cameraCommands.ed.cs");
|
||||
exec("./scripts/lightViz.cs");
|
||||
exec("./scripts/shadowViz.cs");
|
||||
|
||||
// Load Custom Editors
|
||||
loadDirectory(expandFilename("./scripts/editors"));
|
||||
|
|
|
|||
369
Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs
Normal file
369
Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Debug Shaders.
|
||||
new ShaderData( AL_ColorBufferShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgColorBufferP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgColorBufferP.glsl";
|
||||
|
||||
samplerNames[0] = "colorBufferTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_ColorBufferVisualize )
|
||||
{
|
||||
shader = AL_ColorBufferShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#color";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleColorBufferViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_ColorBufferShaderVar = AL_ColorBufferVisualize.isEnabled() ? false : true;
|
||||
AL_ColorBufferVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
{
|
||||
AL_DeferredShading.disable();
|
||||
AL_ColorBufferVisualize.enable();
|
||||
}
|
||||
else if ( !%enable )
|
||||
{
|
||||
AL_ColorBufferVisualize.disable();
|
||||
AL_DeferredShading.enable();
|
||||
}
|
||||
}
|
||||
|
||||
new ShaderData( AL_SpecMapShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgSpecMapVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgSpecMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "matinfoTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_SpecMapVisualize )
|
||||
{
|
||||
shader = AL_SpecMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#matinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleSpecMapViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_SpecMapShaderVar = AL_SpecMapVisualize.isEnabled() ? false : true;
|
||||
AL_SpecMapVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_SpecMapVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_SpecMapVisualize.disable();
|
||||
}
|
||||
|
||||
new GFXStateBlockData( AL_DepthVisualizeState )
|
||||
{
|
||||
zDefined = true;
|
||||
zEnable = false;
|
||||
zWriteEnable = false;
|
||||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampPoint; // depth
|
||||
samplerStates[1] = SamplerClampLinear; // viz color lookup
|
||||
};
|
||||
|
||||
new GFXStateBlockData( AL_DefaultVisualizeState )
|
||||
{
|
||||
blendDefined = true;
|
||||
blendEnable = true;
|
||||
blendSrc = GFXBlendSrcAlpha;
|
||||
blendDest = GFXBlendInvSrcAlpha;
|
||||
|
||||
zDefined = true;
|
||||
zEnable = false;
|
||||
zWriteEnable = false;
|
||||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampPoint; // #prepass
|
||||
samplerStates[1] = SamplerClampLinear; // depthviz
|
||||
};
|
||||
|
||||
new ShaderData( AL_DepthVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgDepthVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgDepthVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassTex";
|
||||
samplerNames[1] = "depthViz";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_DepthVisualize )
|
||||
{
|
||||
shader = AL_DepthVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#prepass";
|
||||
texture[1] = "tools/worldEditor/images/depthviz";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function AL_DepthVisualize::onEnabled( %this )
|
||||
{
|
||||
AL_NormalsVisualize.disable();
|
||||
AL_LightColorVisualize.disable();
|
||||
AL_LightSpecularVisualize.disable();
|
||||
$AL_NormalsVisualizeVar = false;
|
||||
$AL_LightColorVisualizeVar = false;
|
||||
$AL_LightSpecularVisualizeVar = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
new ShaderData( AL_GlowVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgGlowVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgGlowVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "glowBuffer";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_GlowVisualize )
|
||||
{
|
||||
shader = AL_GlowVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#glowbuffer";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
new ShaderData( AL_NormalsVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgNormalVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgNormalVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_NormalsVisualize )
|
||||
{
|
||||
shader = AL_NormalsVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#prepass";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function AL_NormalsVisualize::onEnabled( %this )
|
||||
{
|
||||
AL_DepthVisualize.disable();
|
||||
AL_LightColorVisualize.disable();
|
||||
AL_LightSpecularVisualize.disable();
|
||||
$AL_DepthVisualizeVar = false;
|
||||
$AL_LightColorVisualizeVar = false;
|
||||
$AL_LightSpecularVisualizeVar = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
new ShaderData( AL_LightColorVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgLightColorVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgLightColorVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightPrePassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_LightColorVisualize )
|
||||
{
|
||||
shader = AL_LightColorVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#lightinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function AL_LightColorVisualize::onEnabled( %this )
|
||||
{
|
||||
AL_NormalsVisualize.disable();
|
||||
AL_DepthVisualize.disable();
|
||||
AL_LightSpecularVisualize.disable();
|
||||
$AL_NormalsVisualizeVar = false;
|
||||
$AL_DepthVisualizeVar = false;
|
||||
$AL_LightSpecularVisualizeVar = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
new ShaderData( AL_LightSpecularVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgLightSpecularVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgLightSpecularVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightPrePassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_LightSpecularVisualize )
|
||||
{
|
||||
shader = AL_LightSpecularVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#lightinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function AL_LightSpecularVisualize::onEnabled( %this )
|
||||
{
|
||||
AL_NormalsVisualize.disable();
|
||||
AL_DepthVisualize.disable();
|
||||
AL_LightColorVisualize.disable();
|
||||
$AL_NormalsVisualizeVar = false;
|
||||
$AL_DepthVisualizeVar = false;
|
||||
$AL_LightColorVisualizeVar = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL depth buffer.
|
||||
function toggleDepthViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_DepthVisualizeVar = AL_DepthVisualize.isEnabled() ? false : true;
|
||||
AL_DepthVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_DepthVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_DepthVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL depth buffer.
|
||||
function toggleGlowViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_GlowVisualizeVar = AL_GlowVisualize.isEnabled() ? false : true;
|
||||
AL_GlowVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_GlowVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_GlowVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL normals buffer.
|
||||
function toggleNormalsViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_NormalsVisualizeVar = AL_NormalsVisualize.isEnabled() ? false : true;
|
||||
AL_NormalsVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_NormalsVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_NormalsVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL lighting color buffer.
|
||||
function toggleLightColorViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_LightColorVisualizeVar = AL_LightColorVisualize.isEnabled() ? false : true;
|
||||
AL_LightColorVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_LightColorVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_LightColorVisualize.disable();
|
||||
}
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleLightSpecularViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_LightSpecularVisualizeVar = AL_LightSpecularVisualize.isEnabled() ? false : true;
|
||||
AL_LightSpecularVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_LightSpecularVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_LightSpecularVisualize.disable();
|
||||
}
|
||||
|
||||
function toggleBackbufferViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_BackbufferVisualizeVar = AL_DeferredShading.isEnabled() ? true : false;
|
||||
AL_DeferredShading.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_DeferredShading.disable();
|
||||
else if ( !%enable )
|
||||
AL_DeferredShading.enable();
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D colorBufferTex;
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = vec4(texture( colorBufferTex, uv0 ).rgb, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return float4(TORQUE_TEX2D( colorBufferTex, IN.uv0 ).rgb, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler1D depthViz;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = prepassUncondition( prepassTex, uv0 ).w;
|
||||
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
#include "core/shaders/shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
|
||||
return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D glowBuffer;
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = texture(glowBuffer, uv0);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
return TORQUE_TEX2D(glowBuffer, IN.uv0);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D lightPrePassTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 lightColor = texture( lightPrePassTex, uv0 );
|
||||
OUT_col = vec4( lightColor.rgb, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/shaderModelAutoGen.hlsl"
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float4 lightColor = TORQUE_TEX2D( lightPrePassTex, IN.uv0 );
|
||||
return float4( lightColor.rgb, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D lightPrePassTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float specular = texture( lightPrePassTex, uv0 ).a;
|
||||
OUT_col = vec4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float specular = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ).a;
|
||||
return float4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D prepassTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 normal = prepassUncondition( prepassTex, uv0 ).xyz;
|
||||
OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
#include "core/shaders/shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float3 normal = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).xyz;
|
||||
return float4( ( normal + 1.0 ) * 0.5, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler1D depthViz;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = saturate( texture( shadowMap, uv0 ).r );
|
||||
OUT_col = vec4( texture( depthViz, depth ).rgb, 1 );
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/shaderModel.hlsl"
|
||||
|
||||
struct MaterialDecoratorConnectV
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 0);
|
||||
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
|
||||
|
||||
float4 main( MaterialDecoratorConnectV IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float depth = saturate( TORQUE_TEX2D( shadowMap, IN.uv0 ).r );
|
||||
return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1 );
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "core/shaders/gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D matinfoTex;
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float specular = texture( matinfoTex, uv0 ).a;
|
||||
OUT_FragColor0 = vec4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "core/shaders/postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(matinfoTex,0);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float specular = TORQUE_TEX2D( matinfoTex, IN.uv0 ).b;
|
||||
return float4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
116
Templates/BaseGame/game/tools/worldEditor/scripts/shadowViz.cs
Normal file
116
Templates/BaseGame/game/tools/worldEditor/scripts/shadowViz.cs
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
new ShaderData( AL_ShadowVisualizeShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/guiMaterialV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgShadowVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/guiMaterialV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgShadowVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "$shadowMap";
|
||||
samplerNames[1] = "$depthViz";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
new CustomMaterial( AL_ShadowVisualizeMaterial )
|
||||
{
|
||||
shader = AL_ShadowVisualizeShader;
|
||||
stateBlock = AL_DepthVisualizeState;
|
||||
|
||||
sampler["shadowMap"] = "#AL_ShadowVizTexture";
|
||||
sampler["depthViz"] = "tools/worldEditor/images/depthviz";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton GuiControlProfile( AL_ShadowLabelTextProfile )
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
justify = "left";
|
||||
fontSize = 14;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the pre-pass lighting buffer.
|
||||
function toggleShadowViz()
|
||||
{
|
||||
if ( AL_ShadowVizOverlayCtrl.isAwake() )
|
||||
{
|
||||
setShadowVizLight( 0 );
|
||||
Canvas.popDialog( AL_ShadowVizOverlayCtrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 );
|
||||
_setShadowVizLight( EWorldEditor.getSelectedObject( 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
/// Called from the WorldEditor when an object is selected.
|
||||
function _setShadowVizLight( %light, %force )
|
||||
{
|
||||
if ( !AL_ShadowVizOverlayCtrl.isAwake() )
|
||||
return;
|
||||
|
||||
if ( AL_ShadowVizOverlayCtrl.isLocked() && !%force )
|
||||
return;
|
||||
|
||||
// Resolve the object to the client side.
|
||||
if ( isObject( %light ) )
|
||||
{
|
||||
%clientLight = serverToClientObject( %light );
|
||||
%sizeAndAspect = setShadowVizLight( %clientLight );
|
||||
}
|
||||
|
||||
AL_ShadowVizOverlayCtrl-->MatCtrl.setMaterial( "AL_ShadowVisualizeMaterial" );
|
||||
|
||||
%text = "ShadowViz";
|
||||
if ( isObject( %light ) )
|
||||
%text = %text @ " : " @ getWord( %sizeAndAspect, 0 ) @ " x " @ getWord( %sizeAndAspect, 1 );
|
||||
|
||||
AL_ShadowVizOverlayCtrl-->WindowCtrl.text = %text;
|
||||
}
|
||||
|
||||
/// For convenience, push the viz dialog and set the light manually from the console.
|
||||
function showShadowVizForLight( %light )
|
||||
{
|
||||
if ( !AL_ShadowVizOverlayCtrl.isAwake() )
|
||||
Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 );
|
||||
_setShadowVizLight( %light, true );
|
||||
}
|
||||
|
||||
// Prevent shadowViz from changing lights in response to editor selection
|
||||
// events until unlock is called. The only way a vis light will change while locked
|
||||
// is if showShadowVizForLight is explicitly called by the user.
|
||||
function lockShadowViz()
|
||||
{
|
||||
AL_ShadowVizOverlayCtrl.islocked = true;
|
||||
}
|
||||
|
||||
function unlockShadowViz()
|
||||
{
|
||||
AL_ShadowVizOverlayCtrl.islocked = false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue