Merge branch 'Preview4_0' into feature-vfs-security

This commit is contained in:
Robert MacGregor 2022-06-13 08:05:26 -04:00
commit 161ffc62fe
3013 changed files with 348715 additions and 182470 deletions

View file

@ -71,6 +71,20 @@ function GameConnection::onControlObjectChange(%this)
//turnOffZoom();
}
function GameConnection::onConnectionTimedOut(%this)
{
// Called when an established connection times out
disconnectedCleanup();
MessageBoxOK( "TIMED OUT", "The server connection has timed out.");
}
function GameConnection::onConnectionDropped(%this, %msg)
{
// Established connection was dropped by the server
disconnectedCleanup();
MessageBoxOK( "DISCONNECT", "The server has dropped the connection: " @ %msg);
}
function GameConnection::onConnectionError(%this, %msg)
{
// General connection error, usually raised by ghosted objects

View file

@ -86,6 +86,13 @@ function loadMissionStage2()
// Create the mission group off the ServerGroup
$instantGroup = ServerGroup;
// Mission cleanup group. This is where run time components will reside. The MissionCleanup
// group will be added to the ServerGroup.
new SimGroup( MissionCleanup );
// Make the MissionCleanup group the place where all new objects will automatically be added.
$instantGroup = MissionCleanup;
// Make sure the mission exists
%file = $Server::MissionFile;
@ -120,12 +127,6 @@ function loadMissionStage2()
if( isObject( theLevelInfo ) )
$Server::MissionName = theLevelInfo.levelName;
// Mission cleanup group. This is where run time components will reside. The MissionCleanup
// group will be added to the ServerGroup.
new SimGroup( MissionCleanup );
// Make the MissionCleanup group the place where all new objects will automatically be added.
$instantGroup = MissionCleanup;
%hasGameMode = callGamemodeFunction("onCreateGame");

View file

@ -53,25 +53,10 @@ function ConsoleEntry::eval()
$Con::warnVoidAssignment = false;
echo("==>" @ %text);
if( !startsWith(%text, "function ")
&& !startsWith(%text, "datablock ")
&& !startsWith(%text, "foreach(")
&& !startsWith(%text, "foreach$(")
&& !startsWith(%text, "if(")
&& !startsWith(%text, "while(")
&& !startsWith(%text, "for(")
&& !startsWith(%text, "switch(")
&& !startsWith(%text, "switch$("))
%result = eval("return" SPC %text);
else
eval(%text);
eval(%text);
$Con::warnVoidAssignment = %oldWarnVoidAssignment;
ConsoleEntry.setValue("");
// Echo result.
if(%result !$= "")
echo(%result);
}
function ToggleConsole(%make)

View file

@ -0,0 +1,7 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="BasicRibbonMat"
scriptFile="@assetFile=BasicRibbonMat.tscript"
materialDefinitionName="BasicRibbonMat"
VersionId="1" />

View file

@ -0,0 +1,27 @@
singleton ShaderData( BasicRibbonShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/basicRibbonShaderV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/basicRibbonShaderP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/basicRibbonShaderV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/basicRibbonShaderP.glsl";
samplerNames[0] = "$ribTex";
pixVersion = 2.0;
};
singleton CustomMaterial( BasicRibbonMat )
{
shader = BasicRibbonShader;
version = 2.0;
emissive[0] = true;
doubleSided = true;
translucent = true;
BlendOp = AddAlpha;
translucentBlendOp = AddAlpha;
preload = true;
};

View file

@ -2,6 +2,13 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="DefaultDecalRoadMaterial"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="DefaultDecalRoadMaterial"
VersionId="1" />
VersionId="1">
<Material
Name="DefaultDecalRoadMaterial">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_GameObjects:defaultRoadTextureTop_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -2,6 +2,13 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="DefaultRoadMaterialOther"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="DefaultRoadMaterialOther"
VersionId="1" />
VersionId="1">
<Material
Name="DefaultRoadMaterialOther">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_GameObjects:defaultRoadTextureOther_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -2,6 +2,13 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="DefaultRoadMaterialTop"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="DefaultRoadMaterialTop"
VersionId="1" />
VersionId="1">
<Material
Name="DefaultRoadMaterialTop">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_GameObjects:defaultRoadTextureTop_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -2,6 +2,6 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="TexturedRibbonMat"
scriptFile="@assetFile=materials.tscript"
scriptFile="@assetFile=TexturedRibbonMat.tscript"
materialDefinitionName="TexturedRibbonMat"
VersionId="1" />

View file

@ -0,0 +1,29 @@
singleton ShaderData( TexturedRibbonShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/texRibbonShaderV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/texRibbonShaderP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/texRibbonShaderV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/texRibbonShaderP.glsl";
samplerNames[0] = "$ribTex";
pixVersion = 2.0;
};
singleton CustomMaterial( TexturedRibbonMat )
{
shader = TexturedRibbonShader;
version = 2.0;
emissive[0] = true;
doubleSided = true;
translucent = true;
BlendOp = AddAlpha;
translucentBlendOp = AddAlpha;
sampler["ribTex"] = "core/gameObjects/images/ribTex.png";
preload = true;
};

View file

@ -1,78 +0,0 @@
singleton ShaderData( BasicRibbonShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/basicRibbonShaderV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/basicRibbonShaderP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/basicRibbonShaderV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/basicRibbonShaderP.glsl";
samplerNames[0] = "$ribTex";
pixVersion = 2.0;
};
singleton CustomMaterial( BasicRibbonMat )
{
shader = BasicRibbonShader;
version = 2.0;
emissive[0] = true;
doubleSided = true;
translucent = true;
BlendOp = AddAlpha;
translucentBlendOp = AddAlpha;
preload = true;
};
singleton ShaderData( TexturedRibbonShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/texRibbonShaderV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/texRibbonShaderP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/texRibbonShaderV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/ribbons/gl/texRibbonShaderP.glsl";
samplerNames[0] = "$ribTex";
pixVersion = 2.0;
};
singleton CustomMaterial( TexturedRibbonMat )
{
shader = TexturedRibbonShader;
version = 2.0;
emissive[0] = true;
doubleSided = true;
translucent = true;
BlendOp = AddAlpha;
translucentBlendOp = AddAlpha;
sampler["ribTex"] = "core/gameObjects/images/ribTex.png";
preload = true;
};
singleton Material(DefaultDecalRoadMaterial)
{
diffuseMapAsset[0] = "Core_GameObjects:defaultRoadTextureTop_image";
mapTo = "unmapped_mat";
materialTag0 = "RoadAndPath";
};
singleton Material(DefaultRoadMaterialTop)
{
mapTo = "unmapped_mat";
diffuseMapAsset[0] = "Core_GameObjects:defaultRoadTextureTop_image";
materialTag0 = "RoadAndPath";
};
singleton Material(DefaultRoadMaterialOther)
{
mapTo = "unmapped_mat";
diffuseMapAsset[0] = "Core_GameObjects:defaultRoadTextureOther_image";
materialTag0 = "RoadAndPath";
};

View file

@ -1 +0,0 @@
constuctorFileName="@assetFile=camera.tscript" />

View file

@ -2,6 +2,19 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="CameraMat"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="CameraMat"
VersionId="1" />
VersionId="1">
<Material
Name="CameraMat"
doubleSided="1"
translucent="1"
translucentBlendOp="LerpAlpha"
castShadows="0">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_GameObjects:camera_image"
diffuseColor="0 0.627451 1 1"
emissive="1"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Green"
scriptFile="@assetFile=green"
materialDefinitionName="Green"
originalFilePath="D:/Gamedev/Projects/Catographer/GameBuild/Templates/BaseGame/game/core/gameObjects/shapes/green" />

View file

@ -2,6 +2,18 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="OctahedronMat"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="OctahedronMat"
VersionId="1" />
VersionId="1">
<Material
Name="OctahedronMat"
mapTo="green"
translucent="1"
translucentBlendOp="PreMul"
castShadows="0">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_GameObjects:camera_image"
diffuseColor="0 1 0 1"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,196 +0,0 @@
//--- OBJECT WRITE BEGIN ---
new Material(OctahedronMat) {
mapTo = "green";
diffuseColor[0] = "0 1 0 1";
diffuseColor[1] = "1 1 1 1";
diffuseColor[2] = "1 1 1 1";
diffuseColor[3] = "1 1 1 1";
DiffuseMap[0] = "core/gameObjects/images/camera";
diffuseMapSRGB[0] = "1";
diffuseMapSRGB[1] = "1";
diffuseMapSRGB[2] = "1";
diffuseMapSRGB[3] = "1";
detailScale[0] = "2 2";
detailScale[1] = "2 2";
detailScale[2] = "2 2";
detailScale[3] = "2 2";
detailNormalMapStrength[0] = "1";
detailNormalMapStrength[1] = "1";
detailNormalMapStrength[2] = "1";
detailNormalMapStrength[3] = "1";
roughness[0] = "1";
roughness[1] = "1";
roughness[2] = "1";
roughness[3] = "1";
metalness[0] = "0";
metalness[1] = "0";
metalness[2] = "0";
metalness[3] = "0";
glowMul[0] = "0";
glowMul[1] = "0";
glowMul[2] = "0";
glowMul[3] = "0";
accuEnabled[0] = "0";
accuEnabled[1] = "0";
accuEnabled[2] = "0";
accuEnabled[3] = "0";
accuScale[0] = "1";
accuScale[1] = "1";
accuScale[2] = "1";
accuScale[3] = "1";
accuDirection[0] = "1";
accuDirection[1] = "1";
accuDirection[2] = "1";
accuDirection[3] = "1";
accuStrength[0] = "0.6";
accuStrength[1] = "0.6";
accuStrength[2] = "0.6";
accuStrength[3] = "0.6";
accuCoverage[0] = "0.9";
accuCoverage[1] = "0.9";
accuCoverage[2] = "0.9";
accuCoverage[3] = "0.9";
accuSpecular[0] = "16";
accuSpecular[1] = "16";
accuSpecular[2] = "16";
accuSpecular[3] = "16";
isSRGB[0] = "0";
isSRGB[1] = "0";
isSRGB[2] = "0";
isSRGB[3] = "0";
invertRoughness[0] = "0";
invertRoughness[1] = "0";
invertRoughness[2] = "0";
invertRoughness[3] = "0";
roughnessChan[0] = "0";
roughnessChan[1] = "0";
roughnessChan[2] = "0";
roughnessChan[3] = "0";
AOChan[0] = "1";
AOChan[1] = "1";
AOChan[2] = "1";
AOChan[3] = "1";
metalChan[0] = "2";
metalChan[1] = "2";
metalChan[2] = "2";
metalChan[3] = "2";
glow[0] = "0";
glow[1] = "0";
glow[2] = "0";
glow[3] = "0";
parallaxScale[0] = "0";
parallaxScale[1] = "0";
parallaxScale[2] = "0";
parallaxScale[3] = "0";
useAnisotropic[0] = "1";
useAnisotropic[1] = "1";
useAnisotropic[2] = "1";
useAnisotropic[3] = "1";
vertLit[0] = "0";
vertLit[1] = "0";
vertLit[2] = "0";
vertLit[3] = "0";
vertColor[0] = "0";
vertColor[1] = "0";
vertColor[2] = "0";
vertColor[3] = "0";
minnaertConstant[0] = "-1";
minnaertConstant[1] = "-1";
minnaertConstant[2] = "-1";
minnaertConstant[3] = "-1";
subSurface[0] = "0";
subSurface[1] = "0";
subSurface[2] = "0";
subSurface[3] = "0";
subSurfaceColor[0] = "1 0.2 0.2 1";
subSurfaceColor[1] = "1 0.2 0.2 1";
subSurfaceColor[2] = "1 0.2 0.2 1";
subSurfaceColor[3] = "1 0.2 0.2 1";
subSurfaceRolloff[0] = "0.2";
subSurfaceRolloff[1] = "0.2";
subSurfaceRolloff[2] = "0.2";
subSurfaceRolloff[3] = "0.2";
emissive[0] = "0";
emissive[1] = "0";
emissive[2] = "0";
emissive[3] = "0";
foreground[0] = "0";
foreground[1] = "0";
foreground[2] = "0";
foreground[3] = "0";
doubleSided = "0";
animFlags[0] = "0x00000000";
animFlags[1] = "0x00000000";
animFlags[2] = "0x00000000";
animFlags[3] = "0x00000000";
scrollDir[0] = "0 0";
scrollDir[1] = "0 0";
scrollDir[2] = "0 0";
scrollDir[3] = "0 0";
scrollSpeed[0] = "0";
scrollSpeed[1] = "0";
scrollSpeed[2] = "0";
scrollSpeed[3] = "0";
rotSpeed[0] = "0";
rotSpeed[1] = "0";
rotSpeed[2] = "0";
rotSpeed[3] = "0";
rotPivotOffset[0] = "0 0";
rotPivotOffset[1] = "0 0";
rotPivotOffset[2] = "0 0";
rotPivotOffset[3] = "0 0";
waveType[0] = "Sin";
waveType[1] = "Sin";
waveType[2] = "Sin";
waveType[3] = "Sin";
waveFreq[0] = "0";
waveFreq[1] = "0";
waveFreq[2] = "0";
waveFreq[3] = "0";
waveAmp[0] = "0";
waveAmp[1] = "0";
waveAmp[2] = "0";
waveAmp[3] = "0";
sequenceFramePerSec[0] = "0";
sequenceFramePerSec[1] = "0";
sequenceFramePerSec[2] = "0";
sequenceFramePerSec[3] = "0";
sequenceSegmentSize[0] = "0";
sequenceSegmentSize[1] = "0";
sequenceSegmentSize[2] = "0";
sequenceSegmentSize[3] = "0";
cellIndex[0] = "0 0";
cellIndex[1] = "0 0";
cellIndex[2] = "0 0";
cellIndex[3] = "0 0";
cellLayout[0] = "0 0";
cellLayout[1] = "0 0";
cellLayout[2] = "0 0";
cellLayout[3] = "0 0";
cellSize[0] = "0";
cellSize[1] = "0";
cellSize[2] = "0";
cellSize[3] = "0";
bumpAtlas[0] = "0";
bumpAtlas[1] = "0";
bumpAtlas[2] = "0";
bumpAtlas[3] = "0";
castShadows = "0";
planarReflection = "0";
translucent = "1";
translucentBlendOp = "PreMul";
translucentZWrite = "0";
alphaTest = "0";
alphaRef = "1";
dynamicCubemap = "0";
showFootprints = "1";
showDust = "0";
effectColor[0] = "0 0 0 0";
effectColor[1] = "0 0 0 0";
footstepSoundId = "-1";
impactSoundId = "-1";
ImpactFXIndex = "-1";
canSave = "1";
canSaveDynamicFields = "1";
};
//--- OBJECT WRITE END ---

View file

@ -1,95 +0,0 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
singleton Material(OctahedronMat)
{
mapTo = "green";
diffuseMapAsset[0] = "Core_GameObjects:camera_image";
translucent = "1";
translucentBlendOp = "PreMul";
emissive = "0";
castShadows = "0";
diffuseColor[0] = "0 1 0 1";
};
//--- camera.dts MATERIALS BEGIN ---
singleton Material(CameraMat)
{
mapTo = "pasted__phongE1";
diffuseMapAsset[0] = "Core_GameObjects:camera_image";
diffuseColor[0] = "0 0.627451 1 1";
specular[0] = "1 1 1 1";
specularPower[0] = 211;
pixelSpecular[0] = 1;
emissive[0] = 1;
doubleSided = 1;
translucent = true;
translucentBlendOp = "LerpAlpha";
castShadows = false;
materialTag0 = "Miscellaneous";
};
//--- camera.dts MATERIALS END ---
//--- noshapetext.dae MATERIALS BEGIN ---
singleton Material(noshapetext_lambert1)
{
mapTo = "lambert1";
diffuseMapAsset[0] = "";
diffuseColor[0] = "0.4 0.4 0.4 1";
specular[0] = "1 1 1 1";
specularPower[0] = 8;
pixelSpecular[0] = false;
emissive[0] = true;
doubleSided = false;
translucent = false;
translucentBlendOp = "None";
};
singleton Material(noshapetext_noshape_mat)
{
mapTo = "noshape_mat";
diffuseMapAsset[0] = "";
diffuseColor[0] = "0.4 0.3504 0.363784 0.33058";
specular[0] = "1 1 1 1";
specularPower[0] = 8;
pixelSpecular[0] = false;
emissive[0] = true;
doubleSided = false;
translucent = true;
translucentBlendOp = "None";
};
//--- noshapetext.dae MATERIALS END ---

View file

@ -3,4 +3,5 @@
canSaveDynamicFields="true"
AssetName="noshape"
fileName="@assetFile=noshape.dts"
materialSlot0="@asset=Core_Rendering:noShapeMat"
constuctorFileName="@assetFile=noshape.tscript" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="noshape_NoShape"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="noshape_NoShape"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="noshapetext_lambert1"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="noshapetext_lambert1"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="noshapetext_noshape_mat"
scriptFile="@assetFile=materials.tscript"
materialDefinitionName="noshapetext_noshape_mat"
VersionId="1" />

View file

@ -115,7 +115,7 @@ function configureCanvas()
"--Screen Mode : " @ %fsLabel NL
"--Bits Per Pixel : " @ %bpp NL
"--Refresh Rate : " @ %rate NL
"--FSAA Level : " @ %aa NL
"--FXAA Level : " @ %aa NL
"--------------");
// Actually set the new video mode

View file

@ -26,6 +26,10 @@ if($Gui::fontCacheDirectory $= "")
$Gui::fontCacheDirectory = expandFilename("data/cache/fonts");
}
$TextMediumEmphasisColor = "200 200 200";
$TextHighEmphasisColor = "224 224 224";
$TextDisabledColor = "108 108 108";
// ----------------------------------------------------------------------------
// GuiDefaultProfile is a special profile that all other profiles inherit
// defaults from. It must exist.
@ -77,6 +81,12 @@ new GuiControlProfile (GuiDefaultProfile)
cursorColor = "0 0 0 255";
};
if(!isObject(GuiNonModalDefaultProfile))
new GuiControlProfile (GuiNonModalDefaultProfile : GuiDefaultProfile)
{
modal = false;
};
if(!isObject(GuiToolTipProfile))
new GuiControlProfile (GuiToolTipProfile)
{
@ -137,13 +147,20 @@ new GuiControlProfile(GuiTextEditProfile)
category = "Core";
};
if(!isObject(GuiScrollProfile))
new GuiControlProfile(GuiScrollProfile)
if(!isObject(GuiMenuScrollProfile))
new GuiControlProfile(GuiMenuScrollProfile)
{
opaque = true;
fillcolor = "255 255 255";
fontColor = "0 0 0";
fontColorHL = "150 150 150";
fontColor = $TextMediumEmphasisColor;
fontColorHL = $TextMediumEmphasisColor;
fontColorNA = $TextDisabledColor;
fontColorSEL = $TextMediumEmphasisColor;
fillColor = "40 40 40";
fillColorHL = "56 56 56";
fillColorNA = "40 40 40";
borderColor = "87 87 87";
borderColorNA = "0 0 0";
borderColorHL = "255 255 255";
border = true;
bitmapAsset = "Core_GUI:scrollBar_image";
hasBitmapArray = true;
@ -234,3 +251,11 @@ new GuiControlProfile( GuiSliderProfile )
bitmapAsset = "Core_GUI:slider_image";
category = "Core";
};
//
if(!isObject(GuiScrollProfile))
new GuiControlProfile(GuiScrollProfile)
{
bitmapAsset = "Core_GUI:scrollBar_image";
category = "Core";
};

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AL_ConvexLightState"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="AL_ConvexLightState"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AL_DefaultDeferredMaterial"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="AL_DefaultDeferredMaterial"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AL_DefaultShadowMaterial"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="AL_DefaultShadowMaterial"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AL_ParticlePointLightShader"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="AL_ParticlePointLightShader"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AL_SpotLightShader"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="AL_SpotLightShader"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="BL_ProjectedShadowRPM"
scriptFile="@assetFile=basicLighting_Init.tscript"
materialDefinitionName="BL_ProjectedShadowRPM"
VersionId="1" />

View file

@ -1,7 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="IrradianceShader"
scriptFile="@assetFile=advancedLighting_Shaders.tscript"
materialDefinitionName="IrradianceShader"
VersionId="1" />

View file

@ -474,7 +474,7 @@ function DepthOfFieldPostFX::populatePostFXSettings(%this)
function PostEffectEditorInspector::toggleDepthOfFieldPostFX(%this)
{
if($PostFX::DepthOfFieldPostFX::Enabled)
if($PostFX::DepthOfFieldPostFX::Enabled && $pref::PostFX::EnableDOF)
DepthOfFieldPostFX.enable();
else
DepthOfFieldPostFX.disable();
@ -482,7 +482,7 @@ function PostEffectEditorInspector::toggleDepthOfFieldPostFX(%this)
function DepthOfFieldPostFX::applyFromPreset(%this)
{
if($PostFX::DepthOfFieldPostFX::Enabled)
if($PostFX::DepthOfFieldPostFX::Enabled && $pref::PostFX::EnableDOF)
DepthOfFieldPostFX.enable();
else
DepthOfFieldPostFX.disable();

View file

@ -126,7 +126,7 @@ function LightRayPostFX::populatePostFXSettings(%this)
function PostEffectEditorInspector::toggleLightRayPostFX(%this)
{
if($PostFX::LightRayPostFX::Enabled)
if($PostFX::LightRayPostFX::Enabled && $pref::PostFX::EnableLightRays)
LightRayPostFX.enable();
else
LightRayPostFX.disable();
@ -134,7 +134,7 @@ function PostEffectEditorInspector::toggleLightRayPostFX(%this)
function LightRayPostFX::applyFromPreset(%this)
{
if($PostFX::LightRayPostFX::Enabled)
if($PostFX::LightRayPostFX::Enabled && $pref::PostFX::EnableLightRays)
%this.enable();
else
%this.disable();

View file

@ -15,4 +15,6 @@ singleton PostEffect( reflectionProbeArrayPostFX )
texture[0] = "#deferred";
texture[1] = "#color";
texture[2] = "#matinfo";
allowReflectPass = true;
};

View file

@ -165,7 +165,7 @@ function SSAOPostFx::populatePostFXSettings(%this)
function PostEffectEditorInspector::toggleSSAOPostFx(%this)
{
if($PostFX::SSAOPostFx::Enabled)
if($PostFX::SSAOPostFx::Enabled && $pref::PostFX::EnableSSAO)
SSAOPostFx.enable();
else
SSAOPostFx.disable();
@ -173,7 +173,7 @@ function PostEffectEditorInspector::toggleSSAOPostFx(%this)
function SSAOPostFx::applyFromPreset(%this)
{
if($PostFXManager::PostFX::Enable)
if($PostFXManager::PostFX::Enable && $pref::PostFX::EnableSSAO)
%this.enable();
else
%this.disable();

View file

@ -91,7 +91,7 @@ function VignettePostFX::populatePostFXSettings(%this)
//Allow us to easily toggle the postFX and have it respond immediately
function PostEffectEditorInspector::toggleVignettePostFX(%this)
{
if($PostFX::VignettePostFX::Enabled)
if($PostFX::VignettePostFX::Enabled && $pref::PostFX::EnableVignette)
VignettePostFX.enable();
else
VignettePostFX.disable();
@ -102,7 +102,7 @@ function PostEffectEditorInspector::toggleVignettePostFX(%this)
//when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them
function VignettePostFX::applyFromPreset(%this)
{
if($PostFX::VignettePostFX::Enabled)
if($PostFX::VignettePostFX::Enabled && $pref::PostFX::EnableVignette)
%this.enable();
else
%this.disable();

View file

@ -5,8 +5,6 @@ function Core_Rendering::onCreate(%this)
$Core::UnAvailableTexturePath = "core/rendering/images/unavailable";
$Core::WarningTexturePath = "core/rendering/images/warnMat";
$Core::CommonShaderPath = "core/rendering/shaders";
$Core::DefaultIrradianceCubemap = "core/rendering/images/default_irradiance.dds";
$Core::DefaultPrefilterCubemap = "core/rendering/images/default_prefilter.dds";
$Core::BRDFTexture = "core/rendering/images/brdfTexture.dds";
$Core::NoImageAssetFallback = "Core_Rendering:missingTexture_image";
@ -56,11 +54,11 @@ function Core_Rendering::initClient(%this)
%prefPath = getPrefpath();
if ( isFile( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ) )
exec( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension );
postFXInit();
configureCanvas();
postFXInit();
//Autodetect settings if it's our first time
if($pref::Video::autoDetect)
AutodetectGraphics();

View file

@ -0,0 +1,14 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="WarningMaterial"
materialDefinitionName="WarningMaterial"
VersionId="1">
<Material
Name="WarningMaterial">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_Rendering:missingTexture_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="default_irradiance_image"
imageFile="@assetFile=default_irradiance.dds"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="default_prefilter_image"
imageFile="@assetFile=default_prefilter.dds"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -1,32 +0,0 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
singleton Material( Empty )
{
};
singleton Material(WarningMaterial) {
detailMapAsset[0] = "Core_Rendering:missingTexture_image";
diffuseColor[0] = "25 16 0";
emissive[0] = false;
translucent = false;
};

View file

@ -2,6 +2,6 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="BlankSkyMat"
scriptFile="@assetFile=materials.tscript"
scriptFile="@assetFile=BlankSkyMat.tscript"
materialDefinitionName="BlankSkyMat"
VersionId="1" />

View file

@ -2,6 +2,6 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="NightSkyMat"
scriptFile="@assetFile=materials.tscript"
scriptFile="@assetFile=NightSkyMat.tscript"
materialDefinitionName="NightSkyMat"
VersionId="1" />

View file

@ -0,0 +1,15 @@
singleton CubemapData( NightCubemap )
{
cubeMapFaceAsset[0] = "Core_Rendering:NightSkybox_1";
cubeMapFaceAsset[1] = "Core_Rendering:NightSkybox_2";
cubeMapFaceAsset[2] = "Core_Rendering:NightSkybox_3";
cubeMapFaceAsset[3] = "Core_Rendering:NightSkybox_4";
cubeMapFaceAsset[4] = "Core_Rendering:NightSkybox_5";
cubeMapFaceAsset[5] = "Core_Rendering:NightSkybox_6";
};
singleton Material( NightSkyMat )
{
cubemap = NightCubemap;
materialTag0 = "Skies";
};

View file

@ -2,5 +2,13 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="NoMaterial"
scriptFile="@assetFile=NoMaterial"
materialDefinitionName="NoMaterial" />
materialDefinitionName="NoMaterial">
<Material
Name="NoMaterial"
mapTo="NoMaterial">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_Rendering:warnMat_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,6 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(NoMaterial) {
mapTo="NoMaterial";
DiffuseMapAsset[0] = "Core_Rendering:warnMat_image";
};
//--- OBJECT WRITE END ---

View file

@ -1,65 +0,0 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//--- OBJECT WRITE BEGIN ---
singleton CubemapData( NightCubemap )
{
cubeMapFaceAsset[0] = "Core_Rendering:NightSkybox_1";
cubeMapFaceAsset[1] = "Core_Rendering:NightSkybox_2";
cubeMapFaceAsset[2] = "Core_Rendering:NightSkybox_3";
cubeMapFaceAsset[3] = "Core_Rendering:NightSkybox_4";
cubeMapFaceAsset[4] = "Core_Rendering:NightSkybox_5";
cubeMapFaceAsset[5] = "Core_Rendering:NightSkybox_6";
};
singleton Material( NightSkyMat )
{
cubemap = NightCubemap;
materialTag0 = "Skies";
};
singleton Material(moon_noglow) {
mapTo="moon_noglow";
DiffuseMapAsset = "Core_Rendering:moon_noglow_image";
emissive = true;
translucent = true;
vertColor[ 0 ] = true;
};
singleton Material(moon_wglow) {
mapTo="moon_wglow";
DiffuseMapAsset = "Core_Rendering:moon_wglow_image";
emissive = true;
translucent = true;
vertColor[ 0 ] = true;
};
singleton Material(moon_wcorona) {
mapTo="moon_wcorona";
DiffuseMapAsset = "Core_Rendering:moon_wcorona_image";
emissive = true;
translucent = true;
vertColor[ 0 ] = true;
};
//--- OBJECT WRITE END ---

View file

@ -2,6 +2,17 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="moon_noglow"
scriptFile="@assetFile=moon_noglow.tscript"
materialDefinitionName="moon_noglow"
imageMap0="@Asset=Core_Rendering:moon_noglow_image"/>
VersionId="1">
<Material
Name="moon_noglow"
mapTo="moon_noglow"
emissive="1"
translucent="1">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_Rendering:moon_noglow_image"
vertColor="1"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,9 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(moon_noglow) {
mapTo="moon_noglow";
DiffuseMapAsset = "Core_Rendering:moon_noglow_image";
emissive = true;
translucent = true;
vertColor[ 0 ] = true;
};
//--- OBJECT WRITE END ---

View file

@ -1,7 +1,7 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="moon_wcorona"
AssetName="moon_wcorona_image"
imageFile="@assetFile=moon_wcorona.png"
UseMips="true"
isHDRImage="false"

View file

@ -0,0 +1,18 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="moon_wcorona"
materialDefinitionName="moon_wcorona"
VersionId="1">
<Material
Name="moon_wcorona"
mapTo="moon_wcorona"
emissive="1"
translucent="1">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_Rendering:moon_wcorona_image"
vertColor="1"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -2,6 +2,17 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="moon_wglow"
scriptFile="@assetFile=moon_wglow.tscript"
materialDefinitionName="moon_wglow"
imageMap0="@Asset=Core_Rendering:moon_wglow_image"/>
VersionId="1">
<Material
Name="moon_wglow"
mapTo="moon_wglow"
emissive="1"
translucent="1">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Core_Rendering:moon_wglow_image"
vertColor="1";/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -1,9 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(moon_wglow) {
mapTo="moon_wglow";
DiffuseMapAsset = "Core_Rendering:moon_wglow_image";
emissive = true;
translucent = true;
vertColor[ 0 ] = true;
};
//--- OBJECT WRITE END ---

View file

@ -453,7 +453,7 @@ new SimGroup( LightingQualityList )
class = "GraphicsQualityLevel";
caseSensitive = true;
displayName = "High";
displayName = "Highest";
key["$pref::maximumNumOfLights"] = -1;
key["$pref::useLightFade"] = false;
@ -687,7 +687,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
$pref::PostFX::EnableVignette = false;
$pref::Video::AA = 0;
$pref::Video::disableVerticalSync = 0;
$pref::Video::defaultAnisotropy = 0;
}
else
{
@ -713,7 +713,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
$pref::PostFX::EnableVignette = false;
$pref::Video::AA = 0;
$pref::Video::disableVerticalSync = 0;
$pref::Video::defaultAnisotropy = 0;
}
}
else
@ -743,7 +743,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
$pref::PostFX::EnableVignette = true;
$pref::Video::AA = 4;
$pref::Video::disableVerticalSync = 16;
$pref::Video::defaultAnisotropy = 16;
}
else if ( %videoMem > 400 || %videoMem == 0 )
{
@ -769,7 +769,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
$pref::PostFX::EnableVignette = true;
$pref::Video::AA = 4;
$pref::Video::disableVerticalSync = 4;
$pref::Video::defaultAnisotropy = 4;
if ( %videoMem == 0 )
echo("Torque was unable to detect available video memory. Applying 'Medium' quality.");
@ -798,7 +798,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
$pref::PostFX::EnableVignette = false;
$pref::Video::AA = 0;
$pref::Video::disableVerticalSync = 0;
$pref::Video::defaultAnisotropy = 0;
}
}
@ -821,6 +821,11 @@ function _makePrettyResString( %resString, %giveAspectRation )
%width = getWord( %resString, $WORD::RES_X );
%height = getWord( %resString, $WORD::RES_Y );
//If it's an x, it means we've got the human-readable 'x' in the middle
//so skip it
if(%height $= "x")
%height = getWord( %resString, 2 );
%aspect = %width / %height;
%aspect = mRound( %aspect * 100 ) * 0.01;

View file

@ -23,6 +23,8 @@
#include "./torque.glsl"
#include "./brdf.glsl"
uniform float maxProbeDrawDistance;
#ifndef TORQUE_SHADERGEN
#line 27
// These are the uniforms used by most lighting shaders.
@ -330,7 +332,7 @@ float defineSphereSpaceInfluence(vec3 wsPosition, vec3 wsProbePosition, float ra
{
vec3 L = wsProbePosition.xyz - wsPosition;
float contribution = 1.0 - length(L) / radius;
return contribution;
return saturate(contribution);
}
float getDistBoxToPoint(vec3 pt, vec3 extents)
@ -342,10 +344,9 @@ float getDistBoxToPoint(vec3 pt, vec3 extents)
float defineBoxSpaceInfluence(vec3 wsPosition, mat4 worldToObj, float attenuation)
{
vec3 surfPosLS = tMul(worldToObj, vec4(wsPosition, 1.0)).xyz;
float atten = 1.0 - attenuation;
float baseVal = 0.25;
float dist = getDistBoxToPoint(surfPosLS, vec3(baseVal, baseVal, baseVal));
return saturate(smoothstep(baseVal + 0.0001, atten*baseVal, dist));
return saturate(smoothstep(baseVal, (baseVal-attenuation/2), dist));
}
// Box Projected IBL Lighting
@ -367,9 +368,9 @@ vec3 boxProject(vec3 wsPosition, vec3 wsReflectVec, mat4 worldToObj, vec3 refSca
}
vec4 computeForwardProbes(Surface surface,
float cubeMips, int numProbes, mat4x4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, sampler2D BRDFTexture,
float cubeMips, int numProbes, mat4x4 inWorldToObjArray[MAX_FORWARD_PROBES], vec4 inProbeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 inRefScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
vec3 wsEyePos, float skylightCubemapIdx, sampler2D BRDFTexture,
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR)
{
int i = 0;
@ -384,47 +385,37 @@ vec4 computeForwardProbes(Surface surface,
for (i = 0; i < numProbes; ++i)
{
contribution[i] = 0;
if (probeConfigData[i].r == 0) //box
float atten = 1.0-(length(wsEyePos-inProbePosArray[i].xyz)/maxProbeDrawDistance);
if (inProbeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
if (contribution[i] > 0.0)
probehits++;
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b)*atten;
}
else if (probeConfigData[i].r == 1) //sphere
else if (inProbeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
if (contribution[i] > 0.0)
probehits++;
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
}
contribution[i] = max(contribution[i], 0);
if (contribution[i]>0.0)
probehits++;
else
contribution[i] = 0.0;
blendSum += contribution[i];
invBlendSum += (1.0f - contribution[i]);
}
if (probehits > 1.0)
if (probehits > 1.0)//if we overlap
{
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
for (i = 0; i < numProbes; i++)
{
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
blendFactor[i] *= ((contribution[i]) / invBlendSum);
blendFactor[i] = saturate(blendFactor[i]);
blendFacSum += blendFactor[i];
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
blendFacSum += blendFactor[i]; //running tally of results
}
// Normalize blendVal
if (blendFacSum == 0.0f) // Possible with custom weight
{
blendFacSum = 1.0f;
}
float invBlendSumWeighted = 1.0f / blendFacSum;
for (i = 0; i < numProbes; ++i)
{
blendFactor[i] *= invBlendSumWeighted;
contribution[i] *= blendFactor[i];
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
}
}
@ -471,8 +462,8 @@ vec4 computeForwardProbes(Surface surface,
float contrib = contribution[i];
if (contrib > 0.0f)
{
float cubemapIdx = int(probeConfigData[i].a);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
int cubemapIdx = int(inProbeConfigData[i].a);
vec3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
@ -491,8 +482,8 @@ vec4 computeForwardProbes(Surface surface,
vec3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
vec2 envBRDF = textureLod(BRDFTexture, vec2(dfgNdotV, surface.roughness),0).rg;
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
@ -504,13 +495,16 @@ vec4 computeForwardProbes(Surface surface,
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
#if CAPTURING == 1
return vec4(mix(surface.baseColor.rgb,(irradiance + specular* horizon) ,surface.metalness/2),0);
#else
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
#endif
}
vec4 debugVizForwardProbes(Surface surface,
float cubeMips, int numProbes, mat4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float cubeMips, int numProbes, mat4 inWorldToObjArray[MAX_FORWARD_PROBES], vec4 inProbeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 inRefScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, sampler2D BRDFTexture,
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR, int showAtten, int showContrib, int showSpec, int showDiff)
{
@ -527,15 +521,15 @@ vec4 debugVizForwardProbes(Surface surface,
{
contribution[i] = 0;
if (probeConfigData[i].r == 0) //box
if (inProbeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b);
if (contribution[i] > 0.0)
probehits++;
}
else if (probeConfigData[i].r == 1) //sphere
else if (inProbeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
if (contribution[i] > 0.0)
probehits++;
}
@ -620,8 +614,8 @@ vec4 debugVizForwardProbes(Surface surface,
float contrib = contribution[i];
if (contrib > 0.0f)
{
float cubemapIdx = probeConfigData[i].a;
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
float cubemapIdx = inProbeConfigData[i].a;
vec3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
@ -663,5 +657,5 @@ vec4 debugVizForwardProbes(Surface surface,
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
}

View file

@ -24,6 +24,9 @@
#include "./brdf.hlsl"
#include "./shaderModelAutoGen.hlsl"
//globals
uniform float3 eyePosWorld;
uniform float maxProbeDrawDistance;
#ifndef TORQUE_SHADERGEN
// These are the uniforms used by most lighting shaders.
@ -333,7 +336,7 @@ float defineSphereSpaceInfluence(float3 wsPosition, float3 wsProbePosition, floa
{
float3 L = wsProbePosition.xyz - wsPosition;
float contribution = 1.0 - length(L) / radius;
return contribution;
return saturate(contribution);
}
float getDistBoxToPoint(float3 pt, float3 extents)
@ -345,10 +348,9 @@ float getDistBoxToPoint(float3 pt, float3 extents)
float defineBoxSpaceInfluence(float3 wsPosition, float4x4 worldToObj, float attenuation)
{
float3 surfPosLS = mul(worldToObj, float4(wsPosition, 1.0)).xyz;
float atten = 1.0 - attenuation;
float baseVal = 0.25;
float dist = getDistBoxToPoint(surfPosLS, float3(baseVal, baseVal, baseVal));
return saturate(smoothstep(baseVal + 0.0001, atten*baseVal, dist));
return saturate(smoothstep(baseVal, (baseVal-attenuation/2), dist));
}
// Box Projected IBL Lighting
@ -370,9 +372,9 @@ float3 boxProject(float3 wsPosition, float3 wsReflectVec, float4x4 worldToObj, f
}
float4 computeForwardProbes(Surface surface,
float cubeMips, int numProbes, float4x4 worldToObjArray[MAX_FORWARD_PROBES], float4 probeConfigData[MAX_FORWARD_PROBES],
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 refScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
float cubeMips, int numProbes, float4x4 inWorldToObjArray[MAX_FORWARD_PROBES], float4 inProbeConfigData[MAX_FORWARD_PROBES],
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 inRefScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
float3 wsEyePos, float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
TORQUE_SAMPLERCUBEARRAY(irradianceCubemapAR), TORQUE_SAMPLERCUBEARRAY(specularCubemapAR))
{
int i = 0;
@ -384,50 +386,41 @@ float4 computeForwardProbes(Surface surface,
float probehits = 0;
//Set up our struct data
float contribution[MAX_FORWARD_PROBES];
//Process prooooobes
for (i = 0; i < numProbes; ++i)
{
contribution[i] = 0;
if (probeConfigData[i].r == 0) //box
contribution[i] = 0.0;
float atten = 1.0-(length(wsEyePos-inProbePosArray[i].xyz)/maxProbeDrawDistance);
if (inProbeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
if (contribution[i] > 0.0)
probehits++;
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b)*atten;
}
else if (probeConfigData[i].r == 1) //sphere
else if (inProbeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
if (contribution[i] > 0.0)
probehits++;
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
}
contribution[i] = max(contribution[i], 0);
if (contribution[i]>0.0)
probehits++;
else
contribution[i] = 0.0;
blendSum += contribution[i];
invBlendSum += (1.0f - contribution[i]);
}
if (probehits > 1.0)
if (probehits > 1.0)//if we overlap
{
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
for (i = 0; i < numProbes; i++)
{
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
blendFactor[i] *= ((contribution[i]) / invBlendSum);
blendFactor[i] = saturate(blendFactor[i]);
blendFacSum += blendFactor[i];
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
blendFacSum += blendFactor[i]; //running tally of results
}
// Normalize blendVal
if (blendFacSum == 0.0f) // Possible with custom weight
{
blendFacSum = 1.0f;
}
float invBlendSumWeighted = 1.0f / blendFacSum;
for (i = 0; i < numProbes; ++i)
{
blendFactor[i] *= invBlendSumWeighted;
contribution[i] *= blendFactor[i];
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
}
}
@ -474,8 +467,8 @@ float4 computeForwardProbes(Surface surface,
float contrib = contribution[i];
if (contrib > 0.0f)
{
int cubemapIdx = probeConfigData[i].a;
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
int cubemapIdx = inProbeConfigData[i].a;
float3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
@ -494,8 +487,8 @@ float4 computeForwardProbes(Surface surface,
float3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(dfgNdotV, surface.roughness,0,0)).rg;
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
@ -507,13 +500,16 @@ float4 computeForwardProbes(Surface surface,
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return float4((irradiance + specular) * horizon, 0);//alpha writes disabled
#if CAPTURING == 1
return float4(lerp(surface.baseColor.rgb,(irradiance + specular* horizon) ,surface.metalness/2),0);
#else
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
#endif
}
float4 debugVizForwardProbes(Surface surface,
float cubeMips, int numProbes, float4x4 worldToObjArray[MAX_FORWARD_PROBES], float4 probeConfigData[MAX_FORWARD_PROBES],
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 refScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
float cubeMips, int numProbes, float4x4 inWorldToObjArray[MAX_FORWARD_PROBES], float4 inProbeConfigData[MAX_FORWARD_PROBES],
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 inRefScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
TORQUE_SAMPLERCUBEARRAY(irradianceCubemapAR), TORQUE_SAMPLERCUBEARRAY(specularCubemapAR), int showAtten, int showContrib, int showSpec, int showDiff)
{
@ -530,15 +526,15 @@ float4 debugVizForwardProbes(Surface surface,
{
contribution[i] = 0;
if (probeConfigData[i].r == 0) //box
if (inProbeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b);
if (contribution[i] > 0.0)
probehits++;
}
else if (probeConfigData[i].r == 1) //sphere
else if (inProbeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
if (contribution[i] > 0.0)
probehits++;
}
@ -623,8 +619,8 @@ float4 debugVizForwardProbes(Surface surface,
float contrib = contribution[i];
if (contrib > 0.0f)
{
int cubemapIdx = probeConfigData[i].a;
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
int cubemapIdx = inProbeConfigData[i].a;
float3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
@ -666,5 +662,5 @@ float4 debugVizForwardProbes(Surface surface,
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return float4((irradiance + specular) * horizon, 0);//alpha writes disabled
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
}

View file

@ -196,6 +196,38 @@ void main()
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif
#ifdef DIFFUSE_LIGHT_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
vec3 final = max(0.0f, diffuse);
OUT_col = vec4(final, 0);
return
#endif
#ifdef SPECULAR_LIGHT_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
vec3 final = max(0.0f, diffuse);
OUT_col = vec4(final, 0);
return
#endif
#ifdef DETAIL_LIGHTING_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F);
OUT_col = vec4(final, 0);
return
#endif
//get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
}

View file

@ -12,6 +12,7 @@ uniform sampler2D colorBuffer;
uniform sampler2D matInfoBuffer;
uniform sampler2D BRDFTexture;
uniform vec3 ambientColor;
uniform vec4 rtParams0;
uniform vec4 vsFarPlane;
uniform mat4 cameraToWorld;
@ -84,78 +85,57 @@ void main()
{
contribution[i] = 0;
float atten =1.0-(length(eyePosWorld-probePosArray[i].xyz)/maxProbeDrawDistance);
if (probeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
if (contribution[i]>0.0)
probehits++;
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b)*atten;
}
else if (probeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g);
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
}
if (contribution[i]>0.0)
probehits++;
}
contribution[i] = max(contribution[i],0);
else
contribution[i] = 0;
blendSum += contribution[i];
invBlendSum += (1.0f - contribution[i]);
}
// Weight0 = normalized NDF, inverted to have 1 at center, 0 at boundary.
// And as we invert, we need to divide by Num-1 to stay normalized (else sum is > 1).
// respect constraint B.
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
// and respect constraint A.
if (probehits > 1.0)
if (probehits > 1.0)//if we overlap
{
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
for (i = 0; i < numProbes; i++)
{
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
blendFactor[i] *= ((contribution[i]) / invBlendSum);
blendFactor[i] = saturate(blendFactor[i]);
blendFacSum += blendFactor[i];
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
blendFacSum += blendFactor[i]; //running tally of results
}
// Normalize blendVal
if (blendFacSum == 0.0f) // Possible with custom weight
{
blendFacSum = 1.0f;
}
float invBlendSumWeighted = 1.0f / blendFacSum;
for (i = 0; i < numProbes; ++i)
{
blendFactor[i] *= invBlendSumWeighted;
contribution[i] *= blendFactor[i];
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
}
}
#if DEBUGVIZ_ATTENUATION == 1
float contribAlpha = 1;
float contribAlpha = 0;
for (i = 0; i < numProbes; ++i)
{
contribAlpha -= contribution[i];
contribAlpha += contribution[i];
}
OUT_col = vec4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
OUT_col = vec4(contribAlpha,contribAlpha,contribAlpha, 1);
return;
#endif
#if DEBUGVIZ_CONTRIB == 1
vec3 finalContribColor = vec3(0, 0, 0);
float contribAlpha = 1;
for (i = 0; i < numProbes; ++i)
{
finalContribColor += contribution[i] *probeContribColors[i].rgb;
contribAlpha -= contribution[i];
finalContribColor += contribution[i] * vec3(fmod(i+1,2),fmod(i+1,3),fmod(i+1,4));
}
//Skylight coloration for anything not covered by probes above
if(skylightCubemapIdx != -1)
finalContribColor += vec3(0, 1, 0) * contribAlpha;
OUT_col = vec4(finalContribColor, 1);
return;
#endif
@ -178,7 +158,7 @@ void main()
float contrib = contribution[i];
if (contrib > 0.0f)
{
float cubemapIdx = probeConfigData[i].a;
int cubemapIdx = int(probeConfigData[i].a);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, refPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
@ -188,7 +168,7 @@ void main()
}
#endif
if (skylightCubemapIdx != -1 && alpha > 0.001)
if (skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance = lerp(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz,alpha);
specular = lerp(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz,alpha);
@ -220,6 +200,9 @@ void main()
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
OUT_col = vec4(irradiance + specular, 0);//alpha writes disabled
#if CAPTURING == 1
OUT_col = vec4(mix(surface.baseColor.rgb,(irradiance + specular* horizon) ,surface.metalness/2),0);
#else
OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
#endif
}

View file

@ -96,6 +96,8 @@ void main()
if(dist < lightRange)
{
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
vec3 lightCol = lightColor.rgb;
#ifdef NO_SHADOW
float shadowed = 1.0;
#else
@ -107,19 +109,52 @@ void main()
//distance to light in shadow map space
float distToLight = pxlPosLightProj.z / lightRange;
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
#ifdef USE_COOKIE_TEX
// Lookup the cookie sample.
vec4 cookie = texture(cookieMap, shadowCoord);
// Multiply the light with the cookie tex.
lightCol *= cookie.rgb;
// Use a maximum channel luminance to attenuate
// the lighting else we get specular in the dark
// regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif
#endif
vec3 lightCol = lightColor.rgb;
#ifdef USE_COOKIE_TEX
// Lookup the cookie sample.
vec4 cookie = texture(cookieMap, tMul(worldToLightProj, -surfaceToLight.L));
// Multiply the light with the cookie tex.
lightCol *= cookie.rgb;
// Use a maximum channel luminance to attenuate
// the lighting else we get specular in the dark
// regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#ifdef DIFFUSE_LIGHT_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
vec3 final = max(0.0f, diffuse) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
OUT_col = vec4(final, 0);
return;
#endif
#ifdef SPECULAR_LIGHT_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
vec3 final = max(0.0f, diffuse) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
OUT_col = vec4(final, 0);
return;
#endif
#ifdef DETAIL_LIGHTING_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
OUT_col = vec4(final, 0);
return;
#endif
//get Punctual light contribution

View file

@ -216,15 +216,46 @@ void main()
lightingColor = shadowed_colors.rgb;
#endif
shadow = lerp( shadow, 1.0, saturate( fadeOutAmt ) );
shadow = mix( shadow, 1.0, saturate( fadeOutAmt ) );
#ifdef PSSM_DEBUG_RENDER
if ( fadeOutAmt > 1.0 )
lightingColor = 1.0;
lightingColor = vec3(1.0,1.0,1.0);
#endif
#endif //NO_SHADOW
#ifdef DIFFUSE_LIGHT_VIZ
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f,0.0f,0.0f), diffuse);
OUT_col = vec4(final, 0);
return;
#endif
#ifdef SPECULAR_LIGHT_VIZ
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
vec3 spec = BRDF_GetDebugSpecular(surface, surfaceToLight) * factor;
vec3 final = max(vec3(0.0f,0.0f,0.0f), factor);
OUT_col = vec4(final, 0);
return;
#endif
#ifdef DETAIL_LIGHTING_VIZ
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f,0.0f,0.0f), diffuse + spec);
OUT_col = vec4(final, 0);
return;
#endif
//get directional light contribution
vec3 lighting = getDirectionalLight(surface, surfaceToLight, lightingColor.rgb, lightBrightness, shadow);

View file

@ -134,7 +134,6 @@ uniform float shadowSoftness;
uniform float4x4 worldToCamera;
uniform float3x3 worldToLightProj;
uniform float3 eyePosWorld;
uniform float4x4 cameraToWorld;
float4 main( ConvexConnectP IN ) : SV_TARGET
@ -218,12 +217,12 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
#ifdef DETAIL_LIGHTING_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
float3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
float3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F);
float3 final = max(float3(0.0f), diffuse + spec * surface.F);
return final;
#endif

View file

@ -8,11 +8,10 @@ TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 1);
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 2);
TORQUE_UNIFORM_SAMPLER2D(BRDFTexture, 3);
uniform float3 ambientColor;
uniform float4 rtParams0;
uniform float4 vsFarPlane;
uniform float4x4 cameraToWorld;
uniform float3 eyePosWorld;
//cubemap arrays require all the same size. so shared mips# value
uniform float cubeMips;
@ -76,79 +75,58 @@ float4 main(PFXVertToPix IN) : SV_TARGET
//Process prooooobes
for (i = 0; i < numProbes; ++i)
{
contribution[i] = 0;
contribution[i] = 0.0;
float atten =1.0-(length(eyePosWorld-probePosArray[i].xyz)/maxProbeDrawDistance);
if (probeConfigData[i].r == 0) //box
{
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
if (contribution[i]>0.0)
probehits++;
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b)*atten;
}
else if (probeConfigData[i].r == 1) //sphere
{
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g);
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
}
if (contribution[i]>0.0)
probehits++;
}
contribution[i] = max(contribution[i],0);
else
contribution[i] = 0.0;
blendSum += contribution[i];
invBlendSum += (1.0f - contribution[i]);
}
// Weight0 = normalized NDF, inverted to have 1 at center, 0 at boundary.
// And as we invert, we need to divide by Num-1 to stay normalized (else sum is > 1).
// respect constraint B.
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
// and respect constraint A.
if (probehits > 1.0)
if (probehits > 1.0)//if we overlap
{
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
for (i = 0; i < numProbes; i++)
{
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
blendFactor[i] *= ((contribution[i]) / invBlendSum);
blendFactor[i] = saturate(blendFactor[i]);
blendFacSum += blendFactor[i];
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
blendFacSum += blendFactor[i]; //running tally of results
}
// Normalize blendVal
if (blendFacSum == 0.0f) // Possible with custom weight
{
blendFacSum = 1.0f;
}
float invBlendSumWeighted = 1.0f / blendFacSum;
for (i = 0; i < numProbes; ++i)
{
blendFactor[i] *= invBlendSumWeighted;
contribution[i] *= blendFactor[i];
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
}
}
#if DEBUGVIZ_ATTENUATION == 1
float contribAlpha = 1;
float contribAlpha = 0;
for (i = 0; i < numProbes; ++i)
{
contribAlpha -= contribution[i];
contribAlpha += contribution[i];
}
return float4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
return float4(contribAlpha,contribAlpha,contribAlpha, 1);
#endif
#if DEBUGVIZ_CONTRIB == 1
float3 finalContribColor = float3(0, 0, 0);
float contribAlpha = 1;
for (i = 0; i < numProbes; ++i)
{
finalContribColor += contribution[i] *probeContribColors[i].rgb;
contribAlpha -= contribution[i];
finalContribColor += contribution[i] * float3(fmod(i+1,2),fmod(i+1,3),fmod(i+1,4));
}
//Skylight coloration for anything not covered by probes above
if(skylightCubemapIdx != -1)
finalContribColor += float3(0, 1, 0) * contribAlpha;
return float4(finalContribColor, 1);
#endif
}
@ -209,6 +187,9 @@ float4 main(PFXVertToPix IN) : SV_TARGET
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return float4((irradiance + specular) * horizon, 0);//alpha writes disabled
#if CAPTURING == 1
return float4(lerp(surface.baseColor.rgb,(irradiance + specular* horizon) ,surface.metalness/2),0);
#else
return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
#endif
}

View file

@ -43,7 +43,7 @@ TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
#ifdef USE_COOKIE_TEX
/// The texture for cookie rendering.
TORQUE_UNIFORM_SAMPLER2D(cookieMap, 3);
TORQUE_UNIFORM_SAMPLER2D(cookieMap, 2);
#endif
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 5);
@ -67,7 +67,6 @@ uniform float4x4 worldToLightProj;
uniform float4 lightParams;
uniform float shadowSoftness;
uniform float3 eyePosWorld;
uniform float4x4 cameraToWorld;
uniform float4x4 worldToCamera;
@ -102,6 +101,8 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
if(dist < lightRange)
{
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
float3 lightCol = lightColor.rgb;
#ifdef NO_SHADOW
float shadowed = 1.0;
#else
@ -109,23 +110,20 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
float4 pxlPosLightProj = mul( worldToLightProj, float4( surface.P, 1 ) );
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
shadowCoord.y = 1.0f - shadowCoord.y;
//distance to light in shadow map space
//distance to light in shadow map space
float distToLight = pxlPosLightProj.z / lightRange;
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
#endif
float3 lightCol = lightColor.rgb;
#ifdef USE_COOKIE_TEX
// Lookup the cookie sample.
float4 cookie = TORQUE_TEXCUBE(cookieMap, mul(worldToLightProj, -surfaceToLight.L));
// Multiply the light with the cookie tex.
lightCol *= cookie.rgb;
// Use a maximum channel luminance to attenuate
// the lighting else we get specular in the dark
// regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif
#ifdef USE_COOKIE_TEX
// Lookup the cookie sample.
float4 cookie = TORQUE_TEX2D(cookieMap, shadowCoord);
// Multiply the light with the cookie tex.
lightCol *= cookie.rgb;
// Use a maximum channel luminance to attenuate
// the lighting else we get specular in the dark
// regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif
#endif
#ifdef DIFFUSE_LIGHT_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
@ -147,12 +145,12 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
#ifdef DETAIL_LIGHTING_VIZ
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
float3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
float3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
vec3 final = max(float3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
return final;
#endif

View file

@ -42,7 +42,6 @@ uniform float4 lightColor;
uniform float4 lightAmbient;
uniform float shadowSoftness;
uniform float3 eyePosWorld;
uniform float4 atlasXOffset;
uniform float4 atlasYOffset;

View file

@ -1,16 +0,0 @@
//--- noshape.dts MATERIALS BEGIN ---
singleton Material(noshape_NoShape)
{
mapTo = "NoShape";
diffuseMapAsset[0] = "";
diffuseColor[0] = "0.8 0.003067 0 .8";
emissive[0] = 0;
doubleSided = false;
translucent = 1;
translucentBlendOp = "LerpAlpha";
castShadows = false;
materialTag0 = "WorldEditor";
};
//--- noshape.dts MATERIALS END ---

View file

@ -0,0 +1,18 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="NoShapeMat"
materialDefinitionName="NoShapeMat"
VersionId="1">
<Material
Name="NoShapeMat"
mapTo="NoShape"
translucent="1"
translucentBlendOp="LerpAlpha";
castShadows="0">
<Material.Stages>
<Stages_beginarray
diffuseColor="0.8 0.003067 0 .8"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -3,4 +3,5 @@
canSaveDynamicFields="true"
AssetName="noshape"
fileName="@assetFile=noshape.dts"
materialSlot0="@asset=Core_Rendering:NoShapeMat"
VersionId="1" />

View file

@ -6,7 +6,8 @@ if (!isObject(ExecFilesList))
function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
{
//clear per module group file execution chain
ExecFilesList.empty();
%execArray = new ArrayObject("callOn" @ %functionName @ "_" @ %moduleGroup);
ExecFilesList.push_back(%execArray);
//Get our modules so we can exec any specific client-side loading/handling
%modulesList = ModuleDatabase.findModules(false);
for(%i=0; %i < getWordCount(%modulesList); %i++)
@ -23,12 +24,22 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3,
%module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6);
}
%execFilecount = ExecFilesList.count();
%execFilecount = %execArray.count();
if($traceModuleCalls)
{
error("ExecFilesList at actual exec point:");
%execArray.echo();
}
for (%i=0;%i<%execFilecount;%i++)
{
%filename = ExecFilesList.getKey(%i);
%filename = %execArray.getKey(%i);
exec(%filename);
}
ExecFilesList.pop_back(); //cleanup
%execArray.delete();
}
function loadModuleMaterials(%moduleGroup)
@ -213,7 +224,7 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
return;
}
if(!isObject(ExecFilesList))
if(!isObject(ExecFilesList) || ExecFilesList.count() == 0)
{
error("Module::queueExec() - ExecFilesList array object doesn't exist!");
return;
@ -225,10 +236,11 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
%fullPath = pathConcat(%moduleDef.ModulePath, %execFilePath);
///go through all entries
%locked = false;
%execFilecount = ExecFilesList.count();
%execFileList = ExecFilesList.getKey(ExecFilesList.count()-1);
%execFilecount = %execFileList.count();
for (%i=0;%i<%execFilecount;%i++)
{
%check = ExecFilesList.getKey(%i);
%check = %execFileList.getKey(%i);
//look for a substring match
%isMatch = strIsMatchExpr("*"@ strReplace(%execFilePath,"./","/"),%check );
if (%isMatch)
@ -237,13 +249,13 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
//and kill off any duplicates
//do note that doing it in this order means setting exclusive twice
//allows one to override exclusive with exclusive
%locked = ExecFilesList.getValue(%i);
%locked = %execFileList.getValue(%i);
if ((%locked && !%isExclusive)&&($reportModuleFileConflicts))
error("found" SPC %execFilePath SPC "duplicate file!");
if (%isExclusive)
{ // Replacing an existing entry, update in-place
ExecFilesList.setKey(%fullPath, %i);
ExecFilesList.setValue(%isExclusive, %i);
%execFileList.setKey(%fullPath, %i);
%execFileList.setValue(%isExclusive, %i);
%locked = true; //Done, but don't return and bypass trace logging below
}
break;
@ -251,9 +263,9 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
}
//if we're not locked, go ahead and add it to the pile
if (!%locked)
ExecFilesList.add(%fullPath,%isExclusive);
%execFileList.add(%fullPath,%isExclusive);
if ($traceModuleCalls)
ExecFilesList.echo();
%execFileList.echo();
}
function SimSet::unQueueExec(%scopeSet, %execFilePath)
@ -269,7 +281,7 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath)
return;
}
if(!isObject(ExecFilesList))
if(!isObject(ExecFilesList) || ExecFilesList.count() == 0)
{
error("Module::unRegisterDatablock() - ExecFilesList array object doesn't exist!");
return;
@ -280,23 +292,24 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath)
%fullPath = pathConcat(%moduleDef.ModulePath, %relativePath);
///go through all entries
%locked = false;
%execFilecount = ExecFilesList.count();
%execFileList = ExecFilesList.getKey(ExecFilesList.count()-1);
%execFilecount = %execFileList.count();
for (%i=0;%i<%execFilecount;%i++)
{
%check = ExecFilesList.getKey(%i);
%check = %execFileList.getKey(%i);
//look for a substring match
%isMatch = strIsMatchExpr("*"@ %execFilePath,%check );
if (%isMatch)
{
//check if we're already locked in. if not, kill it.
%locked = ExecFilesList.getValue(%i);
%locked = %execFileList.getValue(%i);
if (!%locked)
{
ExecFilesList.erase(%i);
%execFileList.erase(%i);
}
}
}
if ($traceModuleCalls)
ExecFilesList.echo();
%execFileList.echo();
}

View file

@ -1,15 +1,11 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="ExampleModule"
VersionId="1"
Group="Game"
scriptFile="ExampleModule"
scriptFile="ExampleModule.tscript"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
Recurse="true"/>
</ModuleDefinition>

View file

@ -1,108 +1,60 @@
//This is our create function. It's pointed to, by name, via a field defined in
//the ExampleModule.module file, which contains our module definition. It is called
//when the module is initially loaded by the engine. Generally, only common, base-level
//stuff is created(or destroyed, in the companion function), like things utilized or
//shared on both the client and server, or things that need to be loaded before anything
//else.
function ExampleModule::onCreate(%this)
{
}
//Similar to the create function, this is defined in thye module file, and called
//when the module is destroyed, usually as part of the game shutting down.
function ExampleModule::onDestroy(%this)
{
}
//This is called when the server part of the application is initially created. Torque3D
//assumes, even in a single player context, that there is ultimately a 'server' and a 'client'
//So during initial launch and startup of the engine, the server side is initialized in
//core/clientServer/scripts/server/server.tscript - in the initServer() function where this is called.
//This is called on all modules that have this function defined. This is important for
//any persistant parts of the server that always need to run such as gameplay scripts
//
//Importantly, when the gane session server is created, several functions are called to as part of the gamemode logic
//The script below contains the callbacks so the gamemode can actually be set up, but the server-side callbacks in question:
//ExampleGameMode::onMissionStart
//ExampleGameMode::onMissionEnded
//ExampleGameMode::onMissionReset
//Are called during the startup, shut down, and resetting of any and all active gamemodes, as informed by the loaded scenes
//when the game server is processed.
//These callbacks are activated in core/clientServer/scripts/server/levelLoad.tscript
//This is called when the server is initially set up by the game application
function ExampleModule::initServer(%this)
{
//This script contains our ExampleGameMode logic
%this.queueExec("./scripts/ExampleGamemodeScript");
%this.queueExec("./scripts/server/ExampleGameMode");
}
//This is called when a game session server is actually created so the game may be played. It's called
//from core/clientServer/scripts/server/server.tscript - in the createServer() function, which is called when
//A game session is actually launched, and the server is generated so game clients can connect to it.
//This is utilized to set up common things that need to be set up each time the game session server is
//created, such as common variables, datablocks to be transmitted to the client, etc.
//This is called when the server is created for an actual game/map to be played
function ExampleModule::onCreateGameServer(%this)
{
//In particular, the default client/server module handles the transmission of datablocks from
//server to client automatically as part of the connection and prepping process alongside
//validation and tramission of level objects. It does this in an abstracted way by adding
//the file paths to a master DatablockFilesList array as per below. When the server is created in
//onServerCreated(), it loads the datablocks via this array, and when when the server goes
//to pass data to the client, it iterates over this list and processes it, ensuring all datablocks
//are the most up to date possible for transmission to the connecting client
//%this.registerDatablock("./datablocks/ExampleDatablock." @ $TorqueScriptFileExtension);
//These are common managed data files. For any datablock-based stuff that gets generated by the editors
//(that doesn't have a specific associated file, like data for a player class) will go into these.
//So we'll register them now if they exist.
if(isFile("./scripts/managedData/managedDatablocks." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedDatablocks");
if(isFile("./scripts/managedData/managedForestItemData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedForestItemData");
if(isFile("./scripts/managedData/managedForestBrushData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedForestBrushData");
if(isFile("./scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
if(isFile("./scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension))
%this.registerDatablock("./scripts/managedData/managedParticleData");
}
//This is called when a game session server is destroyed, when the game shuts down. It's called from
//core/clientServer/scripts/server/server.tscript - in the destroyServer() function, which just cleans up anything
//The module may have set up as part of the game server being created.
//This is called when the server is shut down due to the game/map being exited
function ExampleModule::onDestroyGameServer(%this)
{
}
//Similar to initServer, this is called during the initial launch of the application and the client component
//is set up. The difference is that the client may not actually be created, such as in the case for dedicated servers
//Where no UI or gameplay interface is required. It's called from core/clientServer/scripts/client/client.tscript -
//in the initClient() function. It sets up common elements that the client will always need, such as scripts, GUIs
//and the like
//This is called when the client is initially set up by the game application
function ExampleModule::initClient(%this)
{
AssetDatabase.acquireAsset("ExampleModule:exampleDatablock");
AssetDatabase.acquireAsset("ExampleModule:examplePostEffect");
AssetDatabase.acquireAsset("ExampleModule:exampleGUI");
//client scripts
//Here, we exec out keybind scripts so the player is able to move when they get into a game
%this.queueExec("./scripts/default.keybinds");
%this.queueExec("./scripts/client/inputCommands");
//client scripts
exec("./scripts/client/defaultkeybinds");
%prefPath = getPrefpath();
if(isFile(%prefPath @ "/keybinds." @ $TorqueScriptFileExtension))
exec(%prefPath @ "/keybinds." @ $TorqueScriptFileExtension);
%this.queueExec("./scripts/inputCommands");
if(isScriptFile(%prefPath @ "/keybinds"))
exec(%prefPath @ "/keybinds");
}
//This is called when a game session client successfuly connects to a game server.
//It's called from core/clientServer/scripts/client/connectionToServer.tscript - in the GameConnection::onConnectionAccepted() function
//It's used for any client-side specific game session stuff that the client needs to load or pass to the server, such as profile data
//account progress, preferences, etc.
//
//When a client is connected, the gamemode logic also has a callback activated - ExampleGameMode::onClientEnterGame().
//This is called when a client connects to a server
function ExampleModule::onCreateClientConnection(%this)
{
//This will push our keybind movemap onto the input stack, so we can control our camera in our ExampleGameMode
ExampleMoveMap.push();
ExampleMovemap.push();
}
//This is called when a client game session disconnects from a game server
//It's called from core/clientServer/scripts/client/connectionToServer.tscript - in the disconnectedCleanup() function
//It's used to clean up and potentially write out any client-side stuff that needs housekeeping when disconnecting for any reason.
//It will be called if the connection is manually terminated, or lost due to any sort of connection issue.
//
//When a client disconnects, the gamemode logic has a callback activated - ExampleGameMode::onClientLeaveGame().
//This is called when a client disconnects from a server
function ExampleModule::onDestroyClientConnection(%this)
{
//This will pop the keybind, cleaning it up from the input stack, as it no longer applies
ExampleMoveMap.pop();
}
}

View file

@ -1,7 +0,0 @@
<GUIAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExampleGUI"
scriptFile="@assetFile=ExampleGUI.gui"
GUIFile="@assetFile=ExampleGUI.gui"
VersionId="1" />

View file

@ -1,7 +0,0 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(ExampleGUI)
{
position = "0 0";
extent = "100 100";
};
//--- OBJECT WRITE END ---

View file

@ -1,9 +0,0 @@
function ExampleGUI::onWake(%this)
{
}
function ExampleGUI::onSleep(%this)
{
}

View file

@ -1,9 +0,0 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExampleComponent"
componentName="ExampleComponent"
componentClass="Component"
description="An example script component."
scriptFile="@assetFile=ExampleComponent.cs"
VersionId="1" />

View file

@ -1,26 +0,0 @@
//onAdd is called when the component is created and then added to it's owner entity.
//You would also add any script-defined component fields via addComponentField().
function ExampleComponent::onAdd(%this)
{
}
//onRemove is called when the component is removed and deleted from it's owner entity.
function ExampleComponent::onRemove(%this)
{
}
//onClientConnect is called any time a new client connects to the server.
function ExampleComponent::onClientConnect(%this, %client)
{
}
//onClientDisconnect is called any time a client disconnects from the server.
function ExampleComponent::onClientDisconnect(%this, %client)
{
}
//update is called when the component does an update tick.
function ExampleComponent::Update(%this)
{
}

View file

@ -1,7 +0,0 @@
<ScriptAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExampleDatablock"
scriptFile="@assetFile=ExampleDatablock.cs"
dependency0="@Asset=UI:guiSounds"
VersionId="1" />

View file

@ -1,4 +0,0 @@
new ScriptObject(DummyObjectTestThing)
{
};

View file

@ -1,9 +1,10 @@
<LevelAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExampleLevel"
AssetDescription="A simple example level players can fly around in."
LevelFile="@assetFile=ExampleLevel.mis"
LevelName="Example Level"
isSubScene="false"
Description="An example level asset"
VersionId="1" />
PostFXPresetFile="@assetFile=ExampleLevel.postfxpreset.tscript"
DecalsFile="@assetFile=ExampleLevel.mis.decals"
ForestFile="@assetFile=ExampleLevel.forest"
NavmeshFile="@assetFile=ExampleLevel.nav"
VersionId="1"/>

View file

@ -1,105 +1,86 @@
//--- OBJECT WRITE BEGIN ---
new Scene(EditorTemplateLevel) {
canSave = "1";
canSaveDynamicFields = "1";
isSubScene = "0";
isEditing = "0";
isDirty = "0";
gameModeName = "ExampleGameMode";
cdTrack = "2";
CTF_scoreLimit = "5";
Enabled = "1";
musicTrack = "lush";
new Scene(ExampleLevel) {
Enabled = "1";
gameModeName="ExampleGameMode";
new LevelInfo(theLevelInfo) {
nearClip = "0.1";
visibleDistance = "1000";
visibleGhostDistance = "0";
decalBias = "0.0015";
fogColor = "0.6 0.6 0.7 1";
fogDensity = "0";
fogDensityOffset = "700";
fogAtmosphereHeight = "0";
canvasClearColor = "0 0 0 255";
ambientLightBlendPhase = "1";
ambientLightBlendCurve = "0 0 -1 -1";
soundAmbience = "AudioAmbienceDefault";
soundDistanceModel = "Linear";
canSave = "1";
canSaveDynamicFields = "1";
advancedLightmapSupport = "0";
desc0 = "A blank room template that acts as a starting point.";
Enabled = "1";
LevelName = "Blank Room Template";
advancedLightmapSupport = "0";
Enabled = "1";
};
new SkyBox(theSky) {
Material = "BlankSkyMat";
MaterialAsset = "Core_Rendering:BlankSkyMat";
drawBottom = "0";
dirtyGameObject = "0";
};
new Sun(theSun) {
azimuth = "230.396";
elevation = "45";
color = "0.968628 0.901961 0.901961 1";
ambient = "0.337255 0.533333 0.619608 1";
texSize = "2048";
overDarkFactor = "3000 1500 750 250";
shadowDistance = "200";
shadowSoftness = "0.25";
logWeight = "0.9";
fadeStartDistance = "0";
bias = "0.1";
Blur = "1";
dirtyGameObject = "0";
dynamicRefreshFreq = "8";
Enabled = "1";
height = "1024";
lightBleedFactor = "0.8";
minVariance = "0";
pointShadowType = "PointShadowType_Paraboloid";
shadowBox = "-100 -100 -100 100 100 100";
splitFadeDistances = "1 1 1 1";
staticRefreshFreq = "250";
width = "3072";
};
new GroundPlane() {
squareSize = "128";
scaleU = "25";
scaleV = "25";
MaterialAsset = "Prototyping:FloorGray";
canSave = "1";
canSaveDynamicFields = "1";
Enabled = "1";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
};
new ScatterSky() {
skyBrightness = "25";
sunSize = "1";
colorizeAmount = "0";
colorize = "0 0 0 1";
rayleighScattering = "0.0035";
sunScale = "1 1 1 1";
ambientScale = "1 1 1 1";
fogScale = "1 1 1 1";
exposure = "1";
zOffset = "0";
azimuth = "0";
elevation = "35";
moonAzimuth = "0";
moonElevation = "45";
castShadows = "1";
staticRefreshFreq = "8";
dynamicRefreshFreq = "8";
brightness = "1";
flareScale = "1";
nightColor = "0.0196078 0.0117647 0.109804 1";
nightFogColor = "0.0196078 0.0117647 0.109804 1";
moonEnabled = "1";
moonMat = "Moon_Glow_Mat";
moonScale = "0.2";
moonLightColor = "0.192157 0.192157 0.192157 1";
useNightCubemap = "1";
nightCubemap = "NightCubemap";
attenuationRatio = "0 1 1";
shadowType = "PSSM";
texSize = "1024";
overDarkFactor = "2000 1000 500 100";
shadowDistance = "400";
shadowSoftness = "0.15";
numSplits = "4";
logWeight = "0.91";
fadeStartDistance = "0";
lastSplitTerrainOnly = "0";
representedInLightmap = "0";
shadowDarkenColor = "0 0 0 -1";
includeLightmappedGeometryInShadow = "0";
position = "-19.4839 100.725 -19.5889";
dirtyGameObject = "0";
Enabled = "1";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
mieScattering = "0.0045";
};
new Skylight() {
Enabled = "1";
ReflectionMode = "Baked Cubemap";
position = "-2.09752 10.8435 53.7998";
rotation = "1 0 0 0";
position = "1.37009 -5.23561 46.5817";
persistentId = "d5eb3afb-dced-11e9-a423-bb0e346e3870";
dirtyGameObject = "0";
};
new SimGroup(CameraSpawnPoints) {
canSave = "1";
canSaveDynamicFields = "1";
persistentId = "fff282f5-dced-11e9-a423-bb0e346e3870";
enabled = "1";
new SpawnSphere(DefaultCameraSpawnSphere) {
autoSpawn = "0";
spawnTransform = "0";
radius = "1";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
isAIControlled = "0";
dataBlock = "SpawnSphereMarker";
position = "0 0 10";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
homingCount = "0";
lockCount = "0";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,14 @@
$PostFX::HDRPostFX::Enabled = 1;
$PostFX::HDRPostFX::minLuminace = 0.001;
$PostFX::HDRPostFX::whiteCutoff = 1;
$PostFX::HDRPostFX::adaptRate = 2;
$PostFX::HDRPostFX::tonemapMode = "ACES";
$PostFX::HDRPostFX::enableBloom = 1;
$PostFX::HDRPostFX::brightPassThreshold = 1;
$PostFX::HDRPostFX::gaussMultiplier = 0.3;
$PostFX::HDRPostFX::gaussMean = 0;
$PostFX::HDRPostFX::gaussStdDev = 0.8;
$PostFX::HDRPostFX::enableAutoExposure = "0";
$PostFX::HDRPostFX::keyValue = 0.18;
$PostFX::HDRPostFX::enableBlueShift = 0;
$PostFX::HDRPostFX::blueShiftColor = "1.05 0.97 1.27";

View file

@ -1,6 +0,0 @@
<PostEffectAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExamplePostEffect"
scriptFile="@assetFile=ExamplePostEffect.cs"
VersionId="1" />

View file

@ -1,131 +0,0 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
singleton ShaderData( ExamplePostEffect_Shader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = $Core:modulePath @ "ExamplePostEffectP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core:modulePath @ "ExamplePostEffectP.glsl";
samplerNames[0] = "$inputTex";
pixVersion = 3.0;
};
singleton GFXStateBlockData( ExamplePostEffect_StateBlock )
{
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
samplerStates[1] = SamplerClampLinear;
samplerStates[2] = SamplerClampLinear;
samplerStates[3] = SamplerClampLinear;
blendDefined = true;
blendDest = GFXBlendOne;
blendSrc = GFXBlendZero;
zDefined = true;
zEnable = false;
zWriteEnable = false;
cullDefined = true;
cullMode = GFXCullNone;
};
function ExamplePostEffect::setShaderConsts( %this )
{
}
function ExamplePostEffect::preProcess( %this )
{
}
function ExamplePostEffect::onAdd(%this)
{
//Register the postFX with the manager
PostFXManager.registerPostEffect(%this);
}
function ExamplePostEffect::onEnabled( %this )
{
return true;
}
function ExamplePostEffect::onDisabled( %this )
{
}
//This is used to populate the PostFXEditor's settings so the post FX can be edited
//This is automatically polled for any postFX that has been registered(in our onAdd) and the settings
//are thus exposed for editing
function ExamplePostEffect::populatePostFXSettings(%this)
{
PostEffectEditorInspector.startGroup("ExamplePostEffect - General");
PostEffectEditorInspector.addField("$PostFXManager::Settings::EnabledExamplePostEffect", "Enabled", "bool", "", $PostFXManager::PostFX::EnableExamplePostEffect, "");
PostEffectEditorInspector.endGroup();
}
//This function pair(applyFromPreset and settingsApply) are done the way they are, with the separated variables
//so that we can effectively store the 'settings' away from the live variables that the postFX's actually utilize
//when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them
function ExamplePostEffect::applyFromPreset(%this)
{
//ExamplePostEffect Settings
$PostFXManager::PostFX::EnableExamplePostEffect = $PostFXManager::Settings::EnabledExamplePostEffect;
if($PostFXManager::PostFX::EnableExamplePostEffect)
%this.enable();
else
%this.disable();
}
function ExamplePostEffect::settingsApply(%this)
{
$PostFXManager::Settings::EnabledExamplePostEffect = $PostFXManager::PostFX::EnableExamplePostEffect;
}
singleton PostEffect( ExamplePostEffect )
{
isEnabled = false;
allowReflectPass = false;
// Resolve the HDR before we render any editor stuff
// and before we resolve the scene to the backbuffer.
renderTime = "PFXBeforeBin";
renderBin = "EditorBin";
renderPriority = 9999;
// The bright pass generates a bloomed version of
// the scene for pixels which are brighter than a
// fixed threshold value.
//
// This is then used in the final HDR combine pass
// at the end of this post effect chain.
shader = ExamplePostEffect_Shader;
stateBlock = ExamplePostEffect_StateBlock;
texture[0] = "$backBuffer";
target = "$outTex";
targetFormat = "GFXFormatR16G16B16A16F";
targetScale = "1 1";
};

View file

@ -1,6 +0,0 @@
<ScriptAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ExampleGamemodeScript"
scriptFile="@assetFile=ExampleGamemodeScript.cs"
VersionId="1" />

View file

@ -1,156 +0,0 @@
//-----------------------------------------------------------------------------
// The server has started up so do some game start up
//-----------------------------------------------------------------------------
//This file implements game mode logic for an Example gamemode. The primary functions:
//ExampleGameMode::onMissionStart
//ExampleGameMode::onMissionReset
//ExampleGameMode::onMissionEnd
//Are the primary hooks for the server to start, restart and end any active gamemodes
//onMissionStart, for example is called from core/clientServer/scripts/server/levelLoad.tscript
//It's called once the server has successfully loaded the level, and has parsed
//through any active scenes to get GameModeNames defined by them. It then iterates
//over them and calls these callbacks to envoke gamemode behaviors. This allows multiple
//gamemodes to be in effect at one time. Modules can implement as many gamemodes as you want.
//
//For levels that can be reused for multiple gammodes, the general setup would be a primary level file
//with the Scene in it having the main geometry, weapons, terrain, etc. You would then have subScenes that
//each contain what's necessary for the given gamemode, such as a subScene that just adds the flags and capture
//triggers for a CTF mode. The subscene would then have it's GameModeName defined to run the CTF gamemode logic
//and the levelLoad code will execute it.
function ExampleGameMode::onCreateGame()
{
// Note: The Game object will be cleaned up by MissionCleanup. Therefore its lifetime is
// limited to that of the mission.
new ScriptObject(ExampleGameMode){};
return ExampleGameMode;
}
//This function is called when the level finishes loading. It sets up the initial configuration, variables and
//spawning and dynamic objects, timers or rules needed for the gamemode to run
function ExampleGameMode::onMissionStart(%this)
{
//set up the game and game variables
%this.initGameVars();
if (%this.running)
{
error("onMissionStart: End the game first!");
return;
}
// Start the game timer
if (%this.duration)
%this.gameSchedule = schedule(%this.duration * 1000, 0, "onGameDurationEnd");
%this.running = true;
}
//This function is called when the level ends. It can be envoked due to the gamemode ending
//but is also kicked off when the game server is shut down as a form of cleanup for anything the gamemode
//created or is managing like the above mentioned dynamic objects or timers
function ExampleGameMode::onMissionEnded(%this)
{
if (!%this.running)
{
error("onMissionEnded: No game running!");
return;
}
// Stop any game timers
cancel(%this.gameSchedule);
%this.running = false;
}
//This function is called in the event the server resets and is used to re-initialize the gamemode
function ExampleGameMode::onMissionReset(%this)
{
// Called by resetMission(), after all the temporary mission objects
// have been deleted.
%this.initGameVars();
}
//This sets up our gamemode's duration time
function ExampleGameMode::initGameVars(%this)
{
// Set the gameplay parameters
%this.duration = 30 * 60;
}
//This is called when the timer runs out, allowing the gamemode to end
function ExampleGameMode::onGameDurationEnd(%this)
{
//we don't end if we're currently editing the level
if (%this.duration && !(EditorIsActive() && GuiEditorIsActive()))
%this.onMissionEnded();
}
//This is called to actually spawn a control object for the player to utilize
//A player character, spectator camera, etc.
function ExampleGameMode::spawnControlObject(%this, %client)
{
//In this example, we just spawn a camera
if (!isObject(%client.camera))
{
if(!isObject(Observer))
{
datablock CameraData(Observer)
{
mode = "Observer";
};
}
%client.camera = spawnObject("Camera", Observer);
}
// If we have a camera then set up some properties
if (isObject(%client.camera))
{
MissionCleanup.add( %this.camera );
%client.camera.scopeToClient(%client);
%client.setControlObject(%client.camera);
%client.camera.setTransform("0 0 1 0 0 0 0");
}
}
//This is called when the client has initially established a connection to the game server
//It's used for setting up anything ahead of time for the client, such as loading in client-passed
//config stuffs, saved data or the like that should be handled BEFORE the client has actually entered
//the game itself
function ExampleGameMode::onClientConnect(%this, %client)
{
}
//This is called when a client enters the game server. It's used to spawn a player object
//set up any client-specific properties such as saved configs, values, their name, etc
//These callbacks are activated in core/clientServer/scripts/server/levelDownload.tscript
function ExampleGameMode::onClientEnterGame(%this, %client)
{
//Set the player name based on the client's connection data
%client.setPlayerName(%client.connectData);
%this.spawnControlObject(%client);
}
//This is called when the player leaves the game server. It's used to clean up anything that
//was spawned or setup for the client when it connected, in onClientEnterGame
//These callbacks are activated in core/clientServer/scripts/server/levelDownload.tscript
function ExampleGameMode::onClientLeaveGame(%this, %client)
{
// Cleanup the camera
if (isObject(%client.camera))
%client.camera.delete();
}
//This is called when the player has connected and finaly setup is done and control is handed
//over to the client. It allows a point to special-case setting the client's canvas content
//(Such as a gamemode-specific GUI) or setting up gamemode-specific keybinds/control schemes
function ExampleGameMode::onInitialControlSet(%this)
{
}

View file

@ -1,25 +1,3 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
$RemapName[$RemapCount] = "Forward";
$RemapCmd[$RemapCount] = "moveforward";
$RemapActionMap[$RemapCount] = "ExampleMoveMap";
@ -92,21 +70,9 @@ ExampleMoveMap.humanReadableName = "Example Movement";
// Non-remapable binds
//------------------------------------------------------------------------------
ExampleMoveMap.bind( keyboard, F2, showPlayerList );
ExampleMoveMap.bind(keyboard, "ctrl h", hideHUDs);
ExampleMoveMap.bind(keyboard, "alt p", doScreenShotHudless);
function openPauseMenu(%val)
{
if(%val && PauseMenu.isAwake() == false)
{
echo("PUSHING PAUSE MENU");
Canvas.pushDialog(PauseMenu);
}
}
ExampleMoveMap.bind(keyboard, "escape", openPauseMenu);
ExampleMoveMap.bindCmd(keyboard, "escape", "", "Canvas.pushDialog(PauseMenu);");
//------------------------------------------------------------------------------
// Movement Keys
@ -128,21 +94,27 @@ ExampleMoveMap.bind( keyboard, space, jump );
ExampleMoveMap.bind( mouse, xaxis, yaw );
ExampleMoveMap.bind( mouse, yaxis, pitch );
ExampleMoveMap.bind( gamepad, rxaxis, "D", "-0.23 0.23", gamepadYaw );
ExampleMoveMap.bind( gamepad, ryaxis, "D", "-0.23 0.23", gamepadPitch );
ExampleMoveMap.bind( gamepad, xaxis, "D", "-0.23 0.23", gamePadMoveX );
ExampleMoveMap.bind( gamepad, yaxis, "D", "-0.23 0.23", gamePadMoveY );
ExampleMoveMap.bind( gamepad, thumbrx, "D", "-0.23 0.23", gamepadYaw );
ExampleMoveMap.bind( gamepad, thumbry, "D", "-0.23 0.23", gamepadPitch );
ExampleMoveMap.bind( gamepad, thumblx, "D", "-0.23 0.23", gamePadMoveX );
ExampleMoveMap.bind( gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY );
ExampleMoveMap.bind( gamepad, btn_a, jump );
ExampleMoveMap.bind( gamepad, btn_x, moveup );
ExampleMoveMap.bind( gamepad, btn_y, movedown );
ExampleMoveMap.bindCmd( gamepad, btn_start, "Canvas.pushDialog(PauseMenu);", "" );
ExampleMoveMap.bindCmd( gamepad, btn_back, "disconnect();", "" );
//------------------------------------------------------------------------------
// Demo recording functions
//------------------------------------------------------------------------------
ExampleMoveMap.bind( keyboard, F3, startRecordingDemo );
ExampleMoveMap.bind( keyboard, F4, stopRecordingDemo );
//------------------------------------------------------------------------------
// Helper Functions
//------------------------------------------------------------------------------
GlobalActionMap.bind(keyboard, "ctrl F3", doProfile);
//------------------------------------------------------------------------------
// Misc.
//------------------------------------------------------------------------------
GlobalActionMap.bind(keyboard, "tilde", toggleConsole);
GlobalActionMap.bindCmd(keyboard, "alt k", "cls();","");
GlobalActionMap.bindCmd(keyboard, "alt enter", "", "Canvas.toggleFullscreen();");
GlobalActionMap.bindCmd(keyboard, "F1", "", "contextHelp();");
ExampleMoveMap.bindCmd(keyboard, "n", "toggleNetGraph();", "");

View file

@ -1,29 +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.
//-----------------------------------------------------------------------------
function escapeFromGame()
{
disconnect();
}
function showPlayerList(%val)
{
if (%val)
PlayerListGui.toggle();
}
function hideHUDs(%val)
{
if (%val)
HudlessPlayGui.toggle();
}
function doScreenShotHudless(%val)
{
if(%val)
{
canvas.setContent(HudlessPlayGui);
//doScreenshot(%val);
schedule(10, 0, "doScreenShot", %val);
}
else
{
%playGUIName = ProjectSettings.value("UI/playGUIName");
Canvas.setContent(%playGUIName);
}
}
$movementSpeed = 1; // m/s
function setSpeed(%speed)
@ -147,8 +153,6 @@ function gamePadMoveX( %val )
function gamePadMoveY( %val )
{
%val *= -1;
if(%val > 0)
{
$mvForwardAction = %val * $movementSpeed;
@ -185,8 +189,6 @@ function gamepadYaw(%val)
function gamepadPitch(%val)
{
%val *= -1;
%pitchAdj = getGamepadAdjustAmount(%val);
if(ServerConnection.isControlObjectRotDampedCamera())
{
@ -205,4 +207,55 @@ function gamepadPitch(%val)
$mvPitchDownSpeed = 0;
$mvPitchUpSpeed = -%pitchAdj;
}
}
function startRecordingDemo( %val )
{
if ( %val )
startDemoRecord();
}
function stopRecordingDemo( %val )
{
if ( %val )
stopDemoRecord();
}
//------------------------------------------------------------------------------
// Debugging Functions
//------------------------------------------------------------------------------
function showMetrics(%val)
{
if(%val)
{
if(!Canvas.isMember(FrameOverlayGui))
metrics("fps gfx shadow sfx terrain groundcover forest net");
else
metrics("");
}
}
GlobalActionMap.bind(keyboard, "ctrl F2", showMetrics);
//------------------------------------------------------------------------------
//
// Start profiler by pressing ctrl f3
// ctrl f3 - starts profile that will dump to console and file
//
function doProfile(%val)
{
if (%val)
{
// key down -- start profile
echo("Starting profile session...");
profilerReset();
profilerEnable(true);
}
else
{
// key up -- finish off profile
echo("Ending profile session...");
profilerDumpToFile("profilerDumpToFile" @ getSimTime() @ ".txt");
profilerEnable(false);
}
}

Some files were not shown because too many files have changed in this diff Show more