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:
Areloch 2017-02-27 15:29:35 -06:00
parent 1ed8b05169
commit 1520bc83b2
333 changed files with 498 additions and 508 deletions

View file

@ -36,3 +36,4 @@ exec("./guiObjectInspector.ed.cs");
exec("./uvEditor.ed.gui");
exec("./objectSelection.ed.cs");
exec("./guiPlatformGenericMenubar.ed.cs");
exec("./postFxManager.gui");

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<EditorSettings>
<Group name="GuiEditor">
<Setting name="previewResolution">1280 1024</Setting>
<Setting name="lastPath">E:/gamedev/T3DMIT/CLEAN/My Projects/TemplateTest/game/data/scripts/gui</Setting>
<Group name="EngineDevelopment">
<Setting name="toggleIntoEditor">0</Setting>
<Setting name="showEditorProfiles">0</Setting>
<Setting name="showEditorGuis">0</Setting>
</Group>
<Setting name="previewResolution">1280 1024</Setting>
<Group name="Help">
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
</Group>
<Group name="Rendering">
<Setting name="drawBorderLines">1</Setting>
<Setting name="drawGuides">1</Setting>
<Setting name="drawBorderLines">1</Setting>
</Group>
<Group name="EngineDevelopment">
<Setting name="showEditorGuis">0</Setting>
<Setting name="toggleIntoEditor">0</Setting>
<Setting name="showEditorProfiles">0</Setting>
</Group>
<Group name="Snapping">
<Setting name="snap2Grid">0</Setting>
<Setting name="snapToGuides">1</Setting>
<Setting name="snap2GridSize">8</Setting>
<Setting name="snapToEdges">1</Setting>
<Setting name="snapToCanvas">1</Setting>
<Setting name="snapToCenters">1</Setting>
<Setting name="snapToCanvas">1</Setting>
<Setting name="sensitivity">2</Setting>
<Setting name="snapToControls">1</Setting>
<Setting name="snap2Grid">0</Setting>
</Group>
<Group name="Selection">
<Setting name="fullBox">0</Setting>
@ -34,160 +34,160 @@
<Setting name="viewType">Categorized</Setting>
</Group>
</Group>
<Group name="ShapeEditor">
<Setting name="showBounds">0</Setting>
<Setting name="gridSize">0.1</Setting>
<Setting name="SunAngleZ">135</Setting>
<Setting name="gridDimension">40 40</Setting>
<Setting name="SunDiffuseColor">255 255 255 255</Setting>
<Setting name="SunAmbientColor">180 180 180 255</Setting>
<Setting name="AdvancedWndVisible">1</Setting>
<Setting name="showObjBox">1</Setting>
<Setting name="renderMounts">1</Setting>
<Setting name="RenderCollision">0</Setting>
<Setting name="ShowGrid">1</Setting>
<Setting name="backgroundColor">0 0 0 100</Setting>
<Setting name="highlightMaterial">1</Setting>
<Setting name="showNodes">1</Setting>
<Setting name="SunAngleX">45</Setting>
</Group>
<Group name="WorldEditor">
<Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
<Setting name="dropType">screenCenter</Setting>
<Setting name="orthoFOV">50</Setting>
<Setting name="orthoShowGrid">1</Setting>
<Setting name="forceLoadDAE">0</Setting>
<Setting name="displayType">6</Setting>
<Setting name="undoLimit">40</Setting>
<Group name="Docs">
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
</Group>
<Group name="Color">
<Setting name="dragRectColor">255 255 0 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="selectionBoxColor">255 255 0 255</Setting>
<Setting name="objMouseOverColor">0 255 0 255</Setting>
</Group>
<Setting name="dropType">screenCenter</Setting>
<Setting name="orthoShowGrid">1</Setting>
<Setting name="displayType">6</Setting>
<Group name="Tools">
<Setting name="objectsUseBoxCenter">1</Setting>
<Setting name="snapSoft">0</Setting>
<Setting name="snapGround">0</Setting>
<Setting name="boundingBoxCollision">0</Setting>
<Setting name="snapSoftSize">2</Setting>
<Setting name="snapGround">0</Setting>
<Setting name="dropAtScreenCenterMax">100</Setting>
<Setting name="dropAtScreenCenterScalar">1</Setting>
</Group>
<Group name="Images">
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
<Setting name="objectsUseBoxCenter">1</Setting>
</Group>
<Group name="Grid">
<Setting name="gridSnap">1</Setting>
<Setting name="gridMinorColor">51 51 51 100</Setting>
<Setting name="gridOriginColor">255 255 255 100</Setting>
<Setting name="gridSize">1</Setting>
<Setting name="gridColor">102 102 102 100</Setting>
<Setting name="gridSnap">0</Setting>
</Group>
<Group name="ObjectIcons">
<Setting name="fadeIconsEndDist">20</Setting>
<Setting name="fadeIcons">1</Setting>
<Setting name="fadeIconsStartAlpha">255</Setting>
<Setting name="fadeIconsEndAlpha">0</Setting>
<Setting name="fadeIconsStartDist">8</Setting>
<Setting name="fadeIconsEndDist">20</Setting>
</Group>
<Group name="Color">
<Setting name="objMouseOverColor">0 255 0 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="dragRectColor">255 255 0 255</Setting>
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="selectionBoxColor">255 255 0 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
</Group>
<Group name="Docs">
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
</Group>
<Group name="Render">
<Setting name="renderObjHandle">1</Setting>
<Setting name="renderObjText">1</Setting>
<Setting name="renderSelectionBox">1</Setting>
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderPopupBackground">1</Setting>
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderObjText">1</Setting>
<Setting name="renderObjHandle">1</Setting>
</Group>
<Group name="Images">
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
</Group>
</Group>
<Group name="TerrainEditor">
<Setting name="currentAction">raiseHeight</Setting>
<Group name="ActionValues">
<Setting name="scaleVal">1</Setting>
<Setting name="SlopeMinAngle">0</Setting>
<Setting name="SlopeMaxAngle">90</Setting>
<Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="smoothFactor">0.1</Setting>
<Setting name="noiseFactor">1</Setting>
<Setting name="softSelectRadius">50</Setting>
<Setting name="setHeightVal">100</Setting>
<Setting name="adjustHeightVal">10</Setting>
<Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
</Group>
<Group name="Brush">
<Setting name="maxBrushSize">40 40</Setting>
<Setting name="brushType">ellipse</Setting>
<Setting name="brushPressure">1</Setting>
<Setting name="brushSize">1 1</Setting>
<Setting name="brushSoftness">1</Setting>
</Group>
</Group>
<Group name="ShapeEditor">
<Setting name="SunDiffuseColor">255 255 255 255</Setting>
<Setting name="ShowGrid">1</Setting>
<Setting name="highlightMaterial">1</Setting>
<Setting name="RenderCollision">0</Setting>
<Setting name="SunAngleZ">135</Setting>
<Setting name="SunAngleX">45</Setting>
<Setting name="showNodes">1</Setting>
<Setting name="backgroundColor">0 0 0 100</Setting>
<Setting name="gridDimension">40 40</Setting>
<Setting name="AdvancedWndVisible">1</Setting>
<Setting name="SunAmbientColor">180 180 180 255</Setting>
<Setting name="showBounds">0</Setting>
<Setting name="showObjBox">1</Setting>
<Setting name="renderMounts">1</Setting>
<Setting name="gridSize">0.1</Setting>
</Group>
<Group name="RoadEditor">
<Setting name="materialName">DefaultDecalRoadMaterial</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
</Group>
<Group name="AxisGizmo">
<Setting name="snapRotations">0</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="renderInfoText">1</Setting>
<Setting name="rotationSnap">15</Setting>
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Group name="Grid">
<Setting name="gridSize">10 10 10</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="renderPlaneHashes">0</Setting>
<Setting name="snapToGrid">1</Setting>
<Setting name="planeDim">500</Setting>
<Setting name="renderPlane">0</Setting>
</Group>
</Group>
<Group name="MeshRoadEditor">
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="DefaultDepth">5</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="topMaterialName">DefaultRoadMaterialTop</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="sideMaterialName">DefaultRoadMaterialOther</Setting>
<Setting name="bottomMaterialName">DefaultRoadMaterialOther</Setting>
</Group>
<Group name="RiverEditor">
<Setting name="DefaultDepth">5</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
</Group>
<Group name="NavEditor">
<Setting name="SpawnClass">AIPlayer</Setting>
<Setting name="spawnDatablock">DefaultPlayerData</Setting>
<Setting name="backgroundBuild">1</Setting>
</Group>
<Group name="RoadEditor">
<Setting name="DefaultWidth">10</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="materialName">DefaultDecalRoadMaterial</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
</Group>
<Group name="TerrainEditor">
<Setting name="currentAction">raiseHeight</Setting>
<Group name="ActionValues">
<Setting name="softSelectRadius">50</Setting>
<Setting name="SlopeMinAngle">0</Setting>
<Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="SlopeMaxAngle">90</Setting>
<Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="setHeightVal">100</Setting>
<Setting name="adjustHeightVal">10</Setting>
<Setting name="noiseFactor">1</Setting>
<Setting name="scaleVal">1</Setting>
<Setting name="smoothFactor">0.1</Setting>
</Group>
<Group name="Brush">
<Setting name="brushSoftness">1</Setting>
<Setting name="brushType">ellipse</Setting>
<Setting name="maxBrushSize">40 40</Setting>
<Setting name="brushPressure">1</Setting>
<Setting name="brushSize">1 1</Setting>
</Group>
</Group>
<Group name="MeshRoadEditor">
<Setting name="bottomMaterialName">DefaultRoadMaterialOther</Setting>
<Setting name="topMaterialName">DefaultRoadMaterialTop</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="DefaultDepth">5</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="sideMaterialName">DefaultRoadMaterialOther</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="DefaultWidth">10</Setting>
</Group>
<Group name="RiverEditor">
<Setting name="DefaultDepth">5</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
</Group>
<Group name="AxisGizmo">
<Setting name="rotationSnap">15</Setting>
<Setting name="snapRotations">0</Setting>
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Setting name="renderInfoText">1</Setting>
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Group name="Grid">
<Setting name="planeDim">500</Setting>
<Setting name="renderPlane">0</Setting>
<Setting name="gridSize">10 10 10</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="renderPlaneHashes">0</Setting>
<Setting name="snapToGrid">0</Setting>
</Group>
</Group>
<Group name="DatablockEditor">
<Setting name="libraryTab">0</Setting>
</Group>
<Group name="ConvexEditor">
<Setting name="materialName">Grid512_OrangeLines_Mat</Setting>
</Group>
<Group name="LevelInformation">
<Group name="levels">
<Group name="EmptyLevel.mis">
<Setting name="cameraSpeed">25</Setting>
</Group>
<Group name="BlankRoom.mis">
<Setting name="cameraSpeed">25</Setting>
</Group>
@ -199,4 +199,7 @@
</Group>
</Group>
</Group>
<Group name="ConvexEditor">
<Setting name="materialName">Grid512_OrangeLines_Mat</Setting>
</Group>
</EditorSettings>

View 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 ---

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

View file

@ -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"));

View 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();
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View 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;
}