Clear out old core structure before adding the new module-ified structure.
|
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
function CoreComponentsModule::onCreate(%this)
|
|
||||||
{
|
|
||||||
%classList = enumerateConsoleClasses( "Component" );
|
|
||||||
|
|
||||||
foreach$( %componentClass in %classList )
|
|
||||||
{
|
|
||||||
echo("Native Component of type: " @ %componentClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<ModuleDefinition
|
|
||||||
ModuleId="CoreComponentsModule"
|
|
||||||
VersionId="1"
|
|
||||||
Description="Module that implements the core engine-level components for the game."
|
|
||||||
ScriptFile="CoreComponents.cs"
|
|
||||||
CreateFunction="onCreate"
|
|
||||||
DestroyFunction="onDestroy"
|
|
||||||
Group="Game">
|
|
||||||
<DeclaredAssets
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
Extension="asset.taml"
|
|
||||||
Recurse="true" />
|
|
||||||
<AutoloadAssets
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetType="ComponentAsset"
|
|
||||||
Recurse="true" />
|
|
||||||
</ModuleDefinition>
|
|
||||||
|
|
@ -1,436 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Source groups.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton SFXDescription( AudioMaster );
|
|
||||||
singleton SFXSource( AudioChannelMaster )
|
|
||||||
{
|
|
||||||
description = AudioMaster;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton SFXDescription( AudioChannel )
|
|
||||||
{
|
|
||||||
sourceGroup = AudioChannelMaster;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton SFXSource( AudioChannelDefault )
|
|
||||||
{
|
|
||||||
description = AudioChannel;
|
|
||||||
};
|
|
||||||
singleton SFXSource( AudioChannelGui )
|
|
||||||
{
|
|
||||||
description = AudioChannel;
|
|
||||||
};
|
|
||||||
singleton SFXSource( AudioChannelEffects )
|
|
||||||
{
|
|
||||||
description = AudioChannel;
|
|
||||||
};
|
|
||||||
singleton SFXSource( AudioChannelMessages )
|
|
||||||
{
|
|
||||||
description = AudioChannel;
|
|
||||||
};
|
|
||||||
singleton SFXSource( AudioChannelMusic )
|
|
||||||
{
|
|
||||||
description = AudioChannel;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set default playback states of the channels.
|
|
||||||
|
|
||||||
AudioChannelMaster.play();
|
|
||||||
AudioChannelDefault.play();
|
|
||||||
|
|
||||||
AudioChannelGui.play();
|
|
||||||
AudioChannelMusic.play();
|
|
||||||
AudioChannelMessages.play();
|
|
||||||
|
|
||||||
// Stop in-game effects channels.
|
|
||||||
AudioChannelEffects.stop();
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Master SFXDescriptions.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Master description for interface audio.
|
|
||||||
singleton SFXDescription( AudioGui )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
sourceGroup = AudioChannelGui;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Master description for game effects audio.
|
|
||||||
singleton SFXDescription( AudioEffect )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
sourceGroup = AudioChannelEffects;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Master description for audio in notifications.
|
|
||||||
singleton SFXDescription( AudioMessage )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
sourceGroup = AudioChannelMessages;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Master description for music.
|
|
||||||
singleton SFXDescription( AudioMusic )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
sourceGroup = AudioChannelMusic;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// SFX Functions.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/// This initializes the sound system device from
|
|
||||||
/// the defaults in the $pref::SFX:: globals.
|
|
||||||
function sfxStartup()
|
|
||||||
{
|
|
||||||
echo( "\nsfxStartup..." );
|
|
||||||
|
|
||||||
// If we have a provider set, try initialize a device now.
|
|
||||||
|
|
||||||
if( $pref::SFX::provider !$= "" )
|
|
||||||
{
|
|
||||||
if( sfxInit() )
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Force auto-detection.
|
|
||||||
$pref::SFX::autoDetect = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If enabled autodetect a safe device.
|
|
||||||
|
|
||||||
if( ( !isDefined( "$pref::SFX::autoDetect" ) || $pref::SFX::autoDetect ) &&
|
|
||||||
sfxAutodetect() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Failure.
|
|
||||||
|
|
||||||
error( " Failed to initialize device!\n\n" );
|
|
||||||
|
|
||||||
$pref::SFX::provider = "";
|
|
||||||
$pref::SFX::device = "";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// This initializes the sound system device from
|
|
||||||
/// the defaults in the $pref::SFX:: globals.
|
|
||||||
function sfxInit()
|
|
||||||
{
|
|
||||||
// If already initialized, shut down the current device first.
|
|
||||||
|
|
||||||
if( sfxGetDeviceInfo() !$= "" )
|
|
||||||
sfxShutdown();
|
|
||||||
|
|
||||||
// Start it up!
|
|
||||||
%maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers;
|
|
||||||
if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// This returns a tab seperated string with
|
|
||||||
// the initialized system info.
|
|
||||||
%info = sfxGetDeviceInfo();
|
|
||||||
$pref::SFX::provider = getField( %info, 0 );
|
|
||||||
$pref::SFX::device = getField( %info, 1 );
|
|
||||||
$pref::SFX::useHardware = getField( %info, 2 );
|
|
||||||
%useHardware = $pref::SFX::useHardware ? "Yes" : "No";
|
|
||||||
%maxBuffers = getField( %info, 3 );
|
|
||||||
|
|
||||||
echo( " Provider: " @ $pref::SFX::provider );
|
|
||||||
echo( " Device: " @ $pref::SFX::device );
|
|
||||||
echo( " Hardware: " @ %useHardware );
|
|
||||||
echo( " Max Buffers: " @ %maxBuffers );
|
|
||||||
echo( " " );
|
|
||||||
|
|
||||||
if( isDefined( "$pref::SFX::distanceModel" ) )
|
|
||||||
sfxSetDistanceModel( $pref::SFX::distanceModel );
|
|
||||||
if( isDefined( "$pref::SFX::dopplerFactor" ) )
|
|
||||||
sfxSetDopplerFactor( $pref::SFX::dopplerFactor );
|
|
||||||
if( isDefined( "$pref::SFX::rolloffFactor" ) )
|
|
||||||
sfxSetRolloffFactor( $pref::SFX::rolloffFactor );
|
|
||||||
|
|
||||||
// Restore master volume.
|
|
||||||
|
|
||||||
sfxSetMasterVolume( $pref::SFX::masterVolume );
|
|
||||||
|
|
||||||
// Restore channel volumes.
|
|
||||||
|
|
||||||
for( %channel = 0; %channel <= 8; %channel ++ )
|
|
||||||
sfxSetChannelVolume( %channel, $pref::SFX::channelVolume[ %channel ] );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Destroys the current sound system device.
|
|
||||||
function sfxShutdown()
|
|
||||||
{
|
|
||||||
// Store volume prefs.
|
|
||||||
|
|
||||||
$pref::SFX::masterVolume = sfxGetMasterVolume();
|
|
||||||
|
|
||||||
for( %channel = 0; %channel <= 8; %channel ++ )
|
|
||||||
$pref::SFX::channelVolume[ %channel ] = sfxGetChannelVolume( %channel );
|
|
||||||
|
|
||||||
// We're assuming here that a null info
|
|
||||||
// string means that no device is loaded.
|
|
||||||
if( sfxGetDeviceInfo() $= "" )
|
|
||||||
return;
|
|
||||||
|
|
||||||
sfxDeleteDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Determines which of the two SFX providers is preferable.
|
|
||||||
function sfxCompareProvider( %providerA, %providerB )
|
|
||||||
{
|
|
||||||
if( %providerA $= %providerB )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch$( %providerA )
|
|
||||||
{
|
|
||||||
// Always prefer FMOD over anything else.
|
|
||||||
case "FMOD":
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// Prefer OpenAL over anything but FMOD.
|
|
||||||
case "OpenAL":
|
|
||||||
if( %providerB $= "FMOD" )
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// choose XAudio over DirectSound
|
|
||||||
case "XAudio":
|
|
||||||
if( %providerB $= "FMOD" || %providerB $= "OpenAL" )
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case "DirectSound":
|
|
||||||
if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" )
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Try to detect and initalize the best SFX device available.
|
|
||||||
function sfxAutodetect()
|
|
||||||
{
|
|
||||||
// Get all the available devices.
|
|
||||||
|
|
||||||
%devices = sfxGetAvailableDevices();
|
|
||||||
|
|
||||||
// Collect and sort the devices by preferentiality.
|
|
||||||
|
|
||||||
%deviceTrySequence = new ArrayObject();
|
|
||||||
%bestMatch = -1;
|
|
||||||
%count = getRecordCount( %devices );
|
|
||||||
for( %i = 0; %i < %count; %i ++ )
|
|
||||||
{
|
|
||||||
%info = getRecord( %devices, %i );
|
|
||||||
%provider = getField( %info, 0 );
|
|
||||||
|
|
||||||
%deviceTrySequence.push_back( %provider, %info );
|
|
||||||
}
|
|
||||||
|
|
||||||
%deviceTrySequence.sortfkd( "sfxCompareProvider" );
|
|
||||||
|
|
||||||
// Try the devices in order.
|
|
||||||
|
|
||||||
%count = %deviceTrySequence.count();
|
|
||||||
for( %i = 0; %i < %count; %i ++ )
|
|
||||||
{
|
|
||||||
%provider = %deviceTrySequence.getKey( %i );
|
|
||||||
%info = %deviceTrySequence.getValue( %i );
|
|
||||||
|
|
||||||
$pref::SFX::provider = %provider;
|
|
||||||
$pref::SFX::device = getField( %info, 1 );
|
|
||||||
$pref::SFX::useHardware = getField( %info, 2 );
|
|
||||||
|
|
||||||
// By default we've decided to avoid hardware devices as
|
|
||||||
// they are buggy and prone to problems.
|
|
||||||
$pref::SFX::useHardware = false;
|
|
||||||
|
|
||||||
if( sfxInit() )
|
|
||||||
{
|
|
||||||
$pref::SFX::autoDetect = false;
|
|
||||||
%deviceTrySequence.delete();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Found no suitable device.
|
|
||||||
|
|
||||||
error( "sfxAutodetect - Could not initialize a valid SFX device." );
|
|
||||||
|
|
||||||
$pref::SFX::provider = "";
|
|
||||||
$pref::SFX::device = "";
|
|
||||||
$pref::SFX::useHardware = "";
|
|
||||||
|
|
||||||
%deviceTrySequence.delete();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Backwards-compatibility with old channel system.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Volume channel IDs for backwards-compatibility.
|
|
||||||
|
|
||||||
$GuiAudioType = 1; // Interface.
|
|
||||||
$SimAudioType = 2; // Game.
|
|
||||||
$MessageAudioType = 3; // Notifications.
|
|
||||||
$MusicAudioType = 4; // Music.
|
|
||||||
|
|
||||||
$AudioChannels[ 0 ] = AudioChannelDefault;
|
|
||||||
$AudioChannels[ $GuiAudioType ] = AudioChannelGui;
|
|
||||||
$AudioChannels[ $SimAudioType ] = AudioChannelEffects;
|
|
||||||
$AudioChannels[ $MessageAudioType ] = AudioChannelMessages;
|
|
||||||
$AudioChannels[ $MusicAudioType ] = AudioChannelMusic;
|
|
||||||
|
|
||||||
function sfxOldChannelToGroup( %channel )
|
|
||||||
{
|
|
||||||
return $AudioChannels[ %channel ];
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxGroupToOldChannel( %group )
|
|
||||||
{
|
|
||||||
%id = %group.getId();
|
|
||||||
for( %i = 0;; %i ++ )
|
|
||||||
if( !isObject( $AudioChannels[ %i ] ) )
|
|
||||||
return -1;
|
|
||||||
else if( $AudioChannels[ %i ].getId() == %id )
|
|
||||||
return %i;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxSetMasterVolume( %volume )
|
|
||||||
{
|
|
||||||
AudioChannelMaster.setVolume( %volume );
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxGetMasterVolume( %volume )
|
|
||||||
{
|
|
||||||
return AudioChannelMaster.getVolume();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxStopAll( %channel )
|
|
||||||
{
|
|
||||||
// Don't stop channel itself since that isn't quite what the function
|
|
||||||
// here intends.
|
|
||||||
|
|
||||||
%channel = sfxOldChannelToGroup( %channel );
|
|
||||||
if (isObject(%channel))
|
|
||||||
{
|
|
||||||
foreach( %source in %channel )
|
|
||||||
%source.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxGetChannelVolume( %channel )
|
|
||||||
{
|
|
||||||
%obj = sfxOldChannelToGroup( %channel );
|
|
||||||
if( isObject( %obj ) )
|
|
||||||
return %obj.getVolume();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sfxSetChannelVolume( %channel, %volume )
|
|
||||||
{
|
|
||||||
%obj = sfxOldChannelToGroup( %channel );
|
|
||||||
if( isObject( %obj ) )
|
|
||||||
%obj.setVolume( %volume );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*singleton SimSet( SFXPausedSet );
|
|
||||||
|
|
||||||
|
|
||||||
/// Pauses the playback of active sound sources.
|
|
||||||
///
|
|
||||||
/// @param %channels An optional word list of channel indices or an empty
|
|
||||||
/// string to pause sources on all channels.
|
|
||||||
/// @param %pauseSet An optional SimSet which is filled with the paused
|
|
||||||
/// sources. If not specified the global SfxSourceGroup
|
|
||||||
/// is used.
|
|
||||||
///
|
|
||||||
/// @deprecated
|
|
||||||
///
|
|
||||||
function sfxPause( %channels, %pauseSet )
|
|
||||||
{
|
|
||||||
// Did we get a set to populate?
|
|
||||||
if ( !isObject( %pauseSet ) )
|
|
||||||
%pauseSet = SFXPausedSet;
|
|
||||||
|
|
||||||
%count = SFXSourceSet.getCount();
|
|
||||||
for ( %i = 0; %i < %count; %i++ )
|
|
||||||
{
|
|
||||||
%source = SFXSourceSet.getObject( %i );
|
|
||||||
|
|
||||||
%channel = sfxGroupToOldChannel( %source.getGroup() );
|
|
||||||
if( %channels $= "" || findWord( %channels, %channel ) != -1 )
|
|
||||||
{
|
|
||||||
%source.pause();
|
|
||||||
%pauseSet.add( %source );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Resumes the playback of paused sound sources.
|
|
||||||
///
|
|
||||||
/// @param %pauseSet An optional SimSet which contains the paused sound
|
|
||||||
/// sources to be resumed. If not specified the global
|
|
||||||
/// SfxSourceGroup is used.
|
|
||||||
/// @deprecated
|
|
||||||
///
|
|
||||||
function sfxResume( %pauseSet )
|
|
||||||
{
|
|
||||||
if ( !isObject( %pauseSet ) )
|
|
||||||
%pauseSet = SFXPausedSet;
|
|
||||||
|
|
||||||
%count = %pauseSet.getCount();
|
|
||||||
for ( %i = 0; %i < %count; %i++ )
|
|
||||||
{
|
|
||||||
%source = %pauseSet.getObject( %i );
|
|
||||||
%source.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear our pause set... the caller is left
|
|
||||||
// to clear his own if he passed one.
|
|
||||||
%pauseSet.clear();
|
|
||||||
}*/
|
|
||||||
|
|
@ -1,162 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function createCanvas(%windowTitle)
|
|
||||||
{
|
|
||||||
if ($isDedicated)
|
|
||||||
{
|
|
||||||
GFXInit::createNullDevice();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the Canvas
|
|
||||||
$GameCanvas = new GuiCanvas(Canvas)
|
|
||||||
{
|
|
||||||
displayWindow = $platform !$= "windows";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set the window title
|
|
||||||
if (isObject(Canvas))
|
|
||||||
{
|
|
||||||
Canvas.setWindowTitle(%windowTitle @ " - " @ $pref::Video::displayDevice);
|
|
||||||
configureCanvas();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error("Canvas creation failed. Shutting down.");
|
|
||||||
quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constants for referencing video resolution preferences
|
|
||||||
$WORD::RES_X = 0;
|
|
||||||
$WORD::RES_Y = 1;
|
|
||||||
$WORD::FULLSCREEN = 2;
|
|
||||||
$WORD::BITDEPTH = 3;
|
|
||||||
$WORD::REFRESH = 4;
|
|
||||||
$WORD::AA = 5;
|
|
||||||
|
|
||||||
function configureCanvas()
|
|
||||||
{
|
|
||||||
// Setup a good default if we don't have one already.
|
|
||||||
if ($pref::Video::Resolution $= "")
|
|
||||||
$pref::Video::Resolution = "800 600";
|
|
||||||
if ($pref::Video::FullScreen $= "")
|
|
||||||
$pref::Video::FullScreen = false;
|
|
||||||
if ($pref::Video::BitDepth $= "")
|
|
||||||
$pref::Video::BitDepth = "32";
|
|
||||||
if ($pref::Video::RefreshRate $= "")
|
|
||||||
$pref::Video::RefreshRate = "60";
|
|
||||||
if ($pref::Video::AA $= "")
|
|
||||||
$pref::Video::AA = "4";
|
|
||||||
|
|
||||||
%resX = $pref::Video::Resolution.x;
|
|
||||||
%resY = $pref::Video::Resolution.y;
|
|
||||||
%fs = $pref::Video::FullScreen;
|
|
||||||
%bpp = $pref::Video::BitDepth;
|
|
||||||
%rate = $pref::Video::RefreshRate;
|
|
||||||
%aa = $pref::Video::AA;
|
|
||||||
|
|
||||||
if($cliFullscreen !$= "") {
|
|
||||||
%fs = $cliFullscreen;
|
|
||||||
$cliFullscreen = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo("--------------");
|
|
||||||
echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %aa @ "\"");
|
|
||||||
|
|
||||||
%deskRes = getDesktopResolution();
|
|
||||||
%deskResX = getWord(%deskRes, $WORD::RES_X);
|
|
||||||
%deskResY = getWord(%deskRes, $WORD::RES_Y);
|
|
||||||
%deskResBPP = getWord(%deskRes, 2);
|
|
||||||
|
|
||||||
// We shouldn't be getting this any more but just in case...
|
|
||||||
if (%bpp $= "Default")
|
|
||||||
%bpp = %deskResBPP;
|
|
||||||
|
|
||||||
// Make sure we are running at a valid resolution
|
|
||||||
if (%fs $= "0" || %fs $= "false")
|
|
||||||
{
|
|
||||||
// Windowed mode has to use the same bit depth as the desktop
|
|
||||||
%bpp = %deskResBPP;
|
|
||||||
|
|
||||||
// Windowed mode also has to run at a smaller resolution than the desktop
|
|
||||||
if ((%resX >= %deskResX) || (%resY >= %deskResY))
|
|
||||||
{
|
|
||||||
warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution");
|
|
||||||
|
|
||||||
%resCount = Canvas.getModeCount();
|
|
||||||
for (%i = (%resCount - 1); %i >= 0; %i--)
|
|
||||||
{
|
|
||||||
%testRes = Canvas.getMode(%i);
|
|
||||||
%testResX = getWord(%testRes, $WORD::RES_X);
|
|
||||||
%testResY = getWord(%testRes, $WORD::RES_Y);
|
|
||||||
%testBPP = getWord(%testRes, $WORD::BITDEPTH);
|
|
||||||
|
|
||||||
if (%testBPP != %bpp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((%testResX < %deskResX) && (%testResY < %deskResY))
|
|
||||||
{
|
|
||||||
// This will work as our new resolution
|
|
||||||
%resX = %testResX;
|
|
||||||
%resY = %testResY;
|
|
||||||
|
|
||||||
warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\"");
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pref::Video::Resolution = %resX SPC %resY;
|
|
||||||
$pref::Video::FullScreen = %fs;
|
|
||||||
$pref::Video::BitDepth = %bpp;
|
|
||||||
$pref::Video::RefreshRate = %rate;
|
|
||||||
$pref::Video::AA = %aa;
|
|
||||||
|
|
||||||
if (%fs == 1 || %fs $= "true")
|
|
||||||
%fsLabel = "Yes";
|
|
||||||
else
|
|
||||||
%fsLabel = "No";
|
|
||||||
|
|
||||||
echo("Accepted Mode: " NL
|
|
||||||
"--Resolution : " @ %resX SPC %resY NL
|
|
||||||
"--Full Screen : " @ %fsLabel NL
|
|
||||||
"--Bits Per Pixel : " @ %bpp NL
|
|
||||||
"--Refresh Rate : " @ %rate NL
|
|
||||||
"--AA TypeXLevel : " @ %aa NL
|
|
||||||
"--------------");
|
|
||||||
|
|
||||||
// Actually set the new video mode
|
|
||||||
Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa);
|
|
||||||
|
|
||||||
commandToServer('setClientAspectRatio', %resX, %resY);
|
|
||||||
|
|
||||||
// AA piggybacks on the AA setting in $pref::Video::mode.
|
|
||||||
// We need to parse the setting between AA modes, and then it's level
|
|
||||||
// It's formatted as AATypexAALevel
|
|
||||||
// So, FXAAx4 or MLAAx2
|
|
||||||
if ( isObject( FXAA_PostEffect ) )
|
|
||||||
FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="RigidBodyComponentAsset"
|
|
||||||
componentClass="RigidBodyComponent"
|
|
||||||
friendlyName="Rigid Body"
|
|
||||||
componentType="Physics"
|
|
||||||
description="Allows an entity to have rigid body physics." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="AnimationComponentAsset"
|
|
||||||
componentClass="AnimationComponent"
|
|
||||||
friendlyName="animation"
|
|
||||||
componentType="animation"
|
|
||||||
description="Allows a mesh component to be animated." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="CameraOrbiterComponentAsset"
|
|
||||||
componentClass="CameraOrbiterComponent"
|
|
||||||
friendlyName="Camera Orbiter"
|
|
||||||
componentType="Game"
|
|
||||||
description="Acts as a boon arm for a camera component." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="CollisionComponentAsset"
|
|
||||||
componentClass="CollisionComponent"
|
|
||||||
friendlyName="Collision"
|
|
||||||
componentType="Collision"
|
|
||||||
description="Enables an entity to collide with things." />
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="CameraComponentAsset"
|
|
||||||
componentClass="CameraComponent"
|
|
||||||
friendlyName="Camera"
|
|
||||||
componentType="Game"
|
|
||||||
description="Allows the component owner to operate as a camera."
|
|
||||||
scriptFile="core/components/game/camera.cs" />
|
|
||||||
|
|
@ -1,185 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function CameraComponent::onAdd(%this)
|
|
||||||
{
|
|
||||||
%this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
|
|
||||||
|
|
||||||
%test = %this.clientOwner;
|
|
||||||
|
|
||||||
%barf = ClientGroup.getCount();
|
|
||||||
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
if(%clientID && !isObject(%clientID.camera))
|
|
||||||
{
|
|
||||||
%this.scopeToClient(%clientID);
|
|
||||||
%this.setDirty();
|
|
||||||
|
|
||||||
%clientID.setCameraObject(%this.owner);
|
|
||||||
%clientID.setControlCameraFov(%this.FOV);
|
|
||||||
|
|
||||||
%clientID.camera = %this.owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
%res = $pref::Video::mode;
|
|
||||||
%derp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::onRemove(%this)
|
|
||||||
{
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
if(%clientID)
|
|
||||||
%clientID.clearCameraObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::onInspectorUpdate(%this)
|
|
||||||
{
|
|
||||||
//if(%this.clientOwner)
|
|
||||||
//%this.clientOwner.setCameraObject(%this.owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::getClientID(%this)
|
|
||||||
{
|
|
||||||
return ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::isClientCamera(%this, %client)
|
|
||||||
{
|
|
||||||
%clientID = ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
|
|
||||||
if(%client.getID() == %clientID)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::onClientConnect(%this, %client)
|
|
||||||
{
|
|
||||||
//if(%this.isClientCamera(%client) && !isObject(%client.camera))
|
|
||||||
//{
|
|
||||||
%this.scopeToClient(%client);
|
|
||||||
%this.setDirty();
|
|
||||||
|
|
||||||
%client.setCameraObject(%this.owner);
|
|
||||||
%client.setControlCameraFov(%this.FOV);
|
|
||||||
|
|
||||||
%client.camera = %this.owner;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::onClientDisconnect(%this, %client)
|
|
||||||
{
|
|
||||||
Parent::onClientDisconnect(%this, %client);
|
|
||||||
|
|
||||||
if(isClientCamera(%client)){
|
|
||||||
%this.clearScopeToClient(%client);
|
|
||||||
%client.clearCameraObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
///
|
|
||||||
///
|
|
||||||
|
|
||||||
function VRCameraComponent::onAdd(%this)
|
|
||||||
{
|
|
||||||
%this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
|
|
||||||
|
|
||||||
%test = %this.clientOwner;
|
|
||||||
|
|
||||||
%barf = ClientGroup.getCount();
|
|
||||||
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
if(%clientID && !isObject(%clientID.camera))
|
|
||||||
{
|
|
||||||
%this.scopeToClient(%clientID);
|
|
||||||
%this.setDirty();
|
|
||||||
|
|
||||||
%clientID.setCameraObject(%this.owner);
|
|
||||||
%clientID.setControlCameraFov(%this.FOV);
|
|
||||||
|
|
||||||
%clientID.camera = %this.owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
%res = $pref::Video::mode;
|
|
||||||
%derp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function VRCameraComponent::onRemove(%this)
|
|
||||||
{
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
if(%clientID)
|
|
||||||
%clientID.clearCameraObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
function CameraComponent::onInspectorUpdate(%this)
|
|
||||||
{
|
|
||||||
//if(%this.clientOwner)
|
|
||||||
//%this.clientOwner.setCameraObject(%this.owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function VRCameraComponent::getClientID(%this)
|
|
||||||
{
|
|
||||||
return ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function VRCameraComponent::isClientCamera(%this, %client)
|
|
||||||
{
|
|
||||||
%clientID = ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
|
|
||||||
if(%client.getID() == %clientID)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function VRCameraComponent::onClientConnect(%this, %client)
|
|
||||||
{
|
|
||||||
//if(%this.isClientCamera(%client) && !isObject(%client.camera))
|
|
||||||
//{
|
|
||||||
%this.scopeToClient(%client);
|
|
||||||
%this.setDirty();
|
|
||||||
|
|
||||||
%client.setCameraObject(%this.owner);
|
|
||||||
%client.setControlCameraFov(%this.FOV);
|
|
||||||
|
|
||||||
%client.camera = %this.owner;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
function VRCameraComponent::onClientDisconnect(%this, %client)
|
|
||||||
{
|
|
||||||
Parent::onClientDisconnect(%this, %client);
|
|
||||||
|
|
||||||
if(isClientCamera(%client)){
|
|
||||||
%this.clearScopeToClient(%client);
|
|
||||||
%client.clearCameraObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="ControlObjectComponentAsset"
|
|
||||||
componentName="ControlObjectComponent"
|
|
||||||
componentClass="Component"
|
|
||||||
friendlyName="Control Object"
|
|
||||||
componentType="Game"
|
|
||||||
description="Allows the component owner to be controlled by a client."
|
|
||||||
scriptFile="core/components/game/controlObject.cs" />
|
|
||||||
|
|
@ -1,89 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera.");
|
|
||||||
|
|
||||||
function ControlObjectComponent::onAdd(%this)
|
|
||||||
{
|
|
||||||
%this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", "");
|
|
||||||
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
|
|
||||||
if(%clientID && !isObject(%clientID.getControlObject()))
|
|
||||||
%clientID.setControlObject(%this.owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::onRemove(%this)
|
|
||||||
{
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
|
|
||||||
if(%clientID)
|
|
||||||
%clientID.setControlObject(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::onClientConnect(%this, %client)
|
|
||||||
{
|
|
||||||
if(%this.isControlClient(%client) && !isObject(%client.getControlObject()))
|
|
||||||
%client.setControlObject(%this.owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::onClientDisconnect(%this, %client)
|
|
||||||
{
|
|
||||||
if(%this.isControlClient(%client))
|
|
||||||
%client.setControlObject(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::getClientID(%this)
|
|
||||||
{
|
|
||||||
return ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::isControlClient(%this, %client)
|
|
||||||
{
|
|
||||||
%clientID = ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
|
|
||||||
if(%client.getID() == %clientID)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlObjectComponent::onInspectorUpdate(%this, %field)
|
|
||||||
{
|
|
||||||
%clientID = %this.getClientID();
|
|
||||||
|
|
||||||
if(%clientID && !isObject(%clientID.getControlObject()))
|
|
||||||
%clientID.setControlObject(%this.owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchControlObject(%client, %newControlEntity)
|
|
||||||
{
|
|
||||||
if(!isObject(%client) || !isObject(%newControlEntity))
|
|
||||||
return error("SwitchControlObject: No client or target controller!");
|
|
||||||
|
|
||||||
%control = %newControlEntity.getComponent(ControlObjectComponent);
|
|
||||||
|
|
||||||
if(!isObject(%control))
|
|
||||||
return error("SwitchControlObject: Target controller has no conrol object behavior!");
|
|
||||||
|
|
||||||
%client.setControlObject(%newControlEntity);
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="ItemRotationComponentAsset"
|
|
||||||
componentName="ItemRotationComponent"
|
|
||||||
componentClass="Component"
|
|
||||||
friendlyName="Item Rotation"
|
|
||||||
componentType="Game"
|
|
||||||
description="Rotates the entity around an axis, like an item pickup."
|
|
||||||
scriptFile="core/components/game/itemRotate.cs" />
|
|
||||||
|
|
@ -1,49 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//registerComponent("ItemRotationComponent", "Component", "Item Rotation", "Game", false, "Rotates the entity around the z axis, like an item pickup.");
|
|
||||||
|
|
||||||
function ItemRotationComponent::onAdd(%this)
|
|
||||||
{
|
|
||||||
%this.addComponentField(rotationsPerMinute, "Number of rotations per minute", "float", "5", "");
|
|
||||||
%this.addComponentField(forward, "Rotate forward or backwards", "bool", "1", "");
|
|
||||||
%this.addComponentField(horizontal, "Rotate horizontal or verticle, true for horizontal", "bool", "1", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function ItemRotationComponent::Update(%this)
|
|
||||||
{
|
|
||||||
%tickRate = 0.032;
|
|
||||||
|
|
||||||
//Rotations per second is calculated based on a standard update tick being 32ms. So we scale by the tick speed, then add that to our rotation to
|
|
||||||
//get a nice rotation speed.
|
|
||||||
if(%this.horizontal)
|
|
||||||
{
|
|
||||||
if(%this.forward)
|
|
||||||
%this.owner.rotation.z += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
|
||||||
else
|
|
||||||
%this.owner.rotation.z -= ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%this.owner.rotation.x += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="PlayerSpawnerComponentAsset"
|
|
||||||
componentName="PlayerSpawner"
|
|
||||||
componentClass="Component"
|
|
||||||
friendlyName="Player Spawner"
|
|
||||||
componentType="Game"
|
|
||||||
description="When a client connects, it spawns a player object for them and attaches them to it."
|
|
||||||
scriptFile="core/components/game/playerSpawner.cs" />
|
|
||||||
|
|
@ -1,78 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//registerComponent("PlayerSpawner", "Component",
|
|
||||||
// "Player Spawner", "Game", false, "When a client connects, it spawns a player object for them and attaches them to it");
|
|
||||||
|
|
||||||
function PlayerSpawner::onAdd(%this)
|
|
||||||
{
|
|
||||||
%this.clientCount = 1;
|
|
||||||
%this.friendlyName = "Player Spawner";
|
|
||||||
%this.componentType = "Spawner";
|
|
||||||
|
|
||||||
%this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PlayerSpawner::onClientConnect(%this, %client)
|
|
||||||
{
|
|
||||||
%playerObj = spawnGameObject(%this.GameObjectName, false);
|
|
||||||
|
|
||||||
if(!isObject(%playerObj))
|
|
||||||
return;
|
|
||||||
|
|
||||||
%playerObj.position = %this.owner.position;
|
|
||||||
|
|
||||||
%playerObj.notify("onClientConnect", %client);
|
|
||||||
|
|
||||||
switchControlObject(%client, %playerObj);
|
|
||||||
switchCamera(%client, %playerObj);
|
|
||||||
|
|
||||||
%client.player = %playerObj;
|
|
||||||
%client.camera = %playerObj;
|
|
||||||
|
|
||||||
%inventory = %playerObj.getComponent(InventoryController);
|
|
||||||
|
|
||||||
if(isObject(%inventory))
|
|
||||||
{
|
|
||||||
for(%i=0; %i<5; %i++)
|
|
||||||
{
|
|
||||||
%arrow = spawnGameObject(ArrowProjectile, false);
|
|
||||||
|
|
||||||
%inventory.addItem(%arrow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%playerObj.position = %this.owner.position;
|
|
||||||
%playerObj.rotation = "0 0 0";
|
|
||||||
|
|
||||||
%this.clientCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
function PlayerSpawner::onClientDisConnect(%this, %client)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PlayerSpawner::getClientID(%this)
|
|
||||||
{
|
|
||||||
return ClientGroup.getObject(%this.clientOwner-1);
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="FPSControlsComponentAsset"
|
|
||||||
componentName="FPSControls"
|
|
||||||
componentClass="Component"
|
|
||||||
friendlyName="FPS Controls"
|
|
||||||
componentType="Input"
|
|
||||||
description="First Person Shooter-type controls." />
|
|
||||||
|
|
@ -1,247 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//registerComponent("FPSControls", "Component", "FPS Controls", "Input", false, "First Person Shooter-type controls");
|
|
||||||
|
|
||||||
function FPSControls::onAdd(%this)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
%this.beginGroup("Keys");
|
|
||||||
%this.addComponentField(forwardKey, "Key to bind to vertical thrust", keybind, "keyboard w");
|
|
||||||
%this.addComponentField(backKey, "Key to bind to vertical thrust", keybind, "keyboard s");
|
|
||||||
%this.addComponentField(leftKey, "Key to bind to horizontal thrust", keybind, "keyboard a");
|
|
||||||
%this.addComponentField(rightKey, "Key to bind to horizontal thrust", keybind, "keyboard d");
|
|
||||||
|
|
||||||
%this.addComponentField(jump, "Key to bind to horizontal thrust", keybind, "keyboard space");
|
|
||||||
%this.endGroup();
|
|
||||||
|
|
||||||
%this.beginGroup("Mouse");
|
|
||||||
%this.addComponentField(pitchAxis, "Key to bind to horizontal thrust", keybind, "mouse yaxis");
|
|
||||||
%this.addComponentField(yawAxis, "Key to bind to horizontal thrust", keybind, "mouse xaxis");
|
|
||||||
%this.endGroup();
|
|
||||||
|
|
||||||
%this.addComponentField(moveSpeed, "Horizontal thrust force", float, 300.0);
|
|
||||||
%this.addComponentField(jumpStrength, "Vertical thrust force", float, 3.0);
|
|
||||||
//
|
|
||||||
|
|
||||||
%control = %this.owner.getComponent( ControlObjectComponent );
|
|
||||||
if(!%control)
|
|
||||||
return echo("SPECTATOR CONTROLS: No Control Object behavior!");
|
|
||||||
|
|
||||||
//%this.Physics = %this.owner.getComponent( PlayerPhysicsComponent );
|
|
||||||
|
|
||||||
//%this.Animation = %this.owner.getComponent( AnimationComponent );
|
|
||||||
|
|
||||||
//%this.Camera = %this.owner.getComponent( MountedCameraComponent );
|
|
||||||
|
|
||||||
//%this.Animation.playThread(0, "look");
|
|
||||||
|
|
||||||
%this.setupControls(%control.getClientID());
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls::onRemove(%this)
|
|
||||||
{
|
|
||||||
Parent::onBehaviorRemove(%this);
|
|
||||||
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.forwardKey);
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.backKey);
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.leftKey);
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.rightKey);
|
|
||||||
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.pitchAxis);
|
|
||||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.yawAxis);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls::onBehaviorFieldUpdate(%this, %field)
|
|
||||||
{
|
|
||||||
%controller = %this.owner.getBehavior( ControlObjectBehavior );
|
|
||||||
commandToClient(%controller.clientOwnerID, 'updateInput', %this.getFieldValue(%field), %field);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls::onClientConnect(%this, %client)
|
|
||||||
{
|
|
||||||
%this.setupControls(%client);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function FPSControls::setupControls(%this, %client)
|
|
||||||
{
|
|
||||||
%control = %this.owner.getComponent( ControlObjectComponent );
|
|
||||||
if(!%control.isControlClient(%client))
|
|
||||||
{
|
|
||||||
echo("FPS CONTROLS: Client Did Not Match");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
%inputCommand = "FPSControls";
|
|
||||||
|
|
||||||
%test = %this.forwardKey;
|
|
||||||
|
|
||||||
/*SetInput(%client, %this.forwardKey.x, %this.forwardKey.y, %inputCommand@"_forwardKey");
|
|
||||||
SetInput(%client, %this.backKey.x, %this.backKey.y, %inputCommand@"_backKey");
|
|
||||||
SetInput(%client, %this.leftKey.x, %this.leftKey.y, %inputCommand@"_leftKey");
|
|
||||||
SetInput(%client, %this.rightKey.x, %this.rightKey.y, %inputCommand@"_rightKey");
|
|
||||||
|
|
||||||
SetInput(%client, %this.jump.x, %this.jump.y, %inputCommand@"_jump");
|
|
||||||
|
|
||||||
SetInput(%client, %this.pitchAxis.x, %this.pitchAxis.y, %inputCommand@"_pitchAxis");
|
|
||||||
SetInput(%client, %this.yawAxis.x, %this.yawAxis.y, %inputCommand@"_yawAxis");*/
|
|
||||||
|
|
||||||
SetInput(%client, "keyboard", "w", %inputCommand@"_forwardKey");
|
|
||||||
SetInput(%client, "keyboard", "s", %inputCommand@"_backKey");
|
|
||||||
SetInput(%client, "keyboard", "a", %inputCommand@"_leftKey");
|
|
||||||
SetInput(%client, "keyboard", "d", %inputCommand@"_rightKey");
|
|
||||||
|
|
||||||
SetInput(%client, "keyboard", "space", %inputCommand@"_jump");
|
|
||||||
|
|
||||||
SetInput(%client, "mouse", "yaxis", %inputCommand@"_pitchAxis");
|
|
||||||
SetInput(%client, "mouse", "xaxis", %inputCommand@"_yawAxis");
|
|
||||||
|
|
||||||
SetInput(%client, "keyboard", "f", %inputCommand@"_flashlight");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls::onMoveTrigger(%this, %triggerID)
|
|
||||||
{
|
|
||||||
//check if our jump trigger was pressed!
|
|
||||||
if(%triggerID == 2)
|
|
||||||
{
|
|
||||||
%this.owner.applyImpulse("0 0 0", "0 0 " @ %this.jumpStrength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls::Update(%this)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
|
|
||||||
%moveVector = %this.owner.getMoveVector();
|
|
||||||
%moveRotation = %this.owner.getMoveRotation();
|
|
||||||
|
|
||||||
%this.Physics.moveVector = "0 0 0";
|
|
||||||
|
|
||||||
if(%moveVector.x != 0)
|
|
||||||
{
|
|
||||||
%fv = VectorNormalize(%this.owner.getRightVector());
|
|
||||||
|
|
||||||
%forMove = VectorScale(%fv, (%moveVector.x));// * (%this.moveSpeed * 0.032)));
|
|
||||||
|
|
||||||
//%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
|
||||||
|
|
||||||
%this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
|
|
||||||
|
|
||||||
//if(%forMove > 0)
|
|
||||||
// %this.Animation.playThread(1, "run");
|
|
||||||
}
|
|
||||||
/*else
|
|
||||||
{
|
|
||||||
%fv = VectorNormalize(%this.owner.getRightVector());
|
|
||||||
|
|
||||||
%forMove = VectorScale(%fv, (%moveVector.x * (%this.moveSpeed * 0.032)));
|
|
||||||
|
|
||||||
if(%forMove <= 0)
|
|
||||||
%this.Animation.stopThread(1);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if(%moveVector.y != 0)
|
|
||||||
{
|
|
||||||
%fv = VectorNormalize(%this.owner.getForwardVector());
|
|
||||||
|
|
||||||
%forMove = VectorScale(%fv, (%moveVector.y));// * (%this.moveSpeed * 0.032)));
|
|
||||||
|
|
||||||
//%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
|
||||||
|
|
||||||
%this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
|
|
||||||
|
|
||||||
//if(VectorLen(%this.Physics.velocity) < 2)
|
|
||||||
// %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if(%moveVector.z)
|
|
||||||
{
|
|
||||||
%fv = VectorNormalize(%this.owner.getUpVector());
|
|
||||||
|
|
||||||
%forMove = VectorScale(%fv, (%moveVector.z * (%this.moveSpeed * 0.032)));
|
|
||||||
|
|
||||||
%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if(%moveRotation.x != 0)
|
|
||||||
{
|
|
||||||
%look = mRadToDeg(%moveRotation.x) / 180;
|
|
||||||
|
|
||||||
//%this.Animation.setThreadPos(0, %look);
|
|
||||||
|
|
||||||
%this.owner.getComponent( MountedCameraComponent ).rotationOffset.x += mRadToDeg(%moveRotation.x);
|
|
||||||
|
|
||||||
//%this.Camera.rotationOffset.x += mRadToDeg(%moveRotation.x);
|
|
||||||
}
|
|
||||||
// %this.owner.rotation.x += mRadToDeg(%moveRotation.x);
|
|
||||||
|
|
||||||
if(%moveRotation.z != 0)
|
|
||||||
{
|
|
||||||
%zrot = mRadToDeg(%moveRotation.z);
|
|
||||||
%this.owner.getComponent( MountedCameraComponent ).rotationOffset.z += %zrot;
|
|
||||||
//%this.owner.rotation.z += %zrot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
function FPSControls_forwardKey(%val)
|
|
||||||
{
|
|
||||||
$mvForwardAction = %val;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_backKey(%val)
|
|
||||||
{
|
|
||||||
$mvBackwardAction = %val;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_leftKey(%val)
|
|
||||||
{
|
|
||||||
$mvLeftAction = %val;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_rightKey(%val)
|
|
||||||
{
|
|
||||||
$mvRightAction = %val;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_yawAxis(%val)
|
|
||||||
{
|
|
||||||
$mvYaw += getMouseAdjustAmount(%val);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_pitchAxis(%val)
|
|
||||||
{
|
|
||||||
$mvPitch += getMouseAdjustAmount(%val);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_jump(%val)
|
|
||||||
{
|
|
||||||
$mvTriggerCount2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
function FPSControls_flashLight(%val)
|
|
||||||
{
|
|
||||||
$mvTriggerCount3++;
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function SetInput(%client, %device, %key, %command, %bindMap, %behav)
|
|
||||||
{
|
|
||||||
commandToClient(%client, 'SetInput', %device, %key, %command, %bindMap, %behav);
|
|
||||||
}
|
|
||||||
|
|
||||||
function RemoveInput(%client, %device, %key, %command, %bindMap)
|
|
||||||
{
|
|
||||||
commandToClient(%client, 'removeInput', %device, %key, %command, %bindMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clientCmdSetInput(%device, %key, %command, %bindMap, %behav)
|
|
||||||
{
|
|
||||||
//if we're requesting a custom bind map, set that up
|
|
||||||
if(%bindMap $= "")
|
|
||||||
%bindMap = moveMap;
|
|
||||||
|
|
||||||
if (!isObject(%bindMap)){
|
|
||||||
new ActionMap(moveMap);
|
|
||||||
moveMap.push();
|
|
||||||
}
|
|
||||||
|
|
||||||
//get our local
|
|
||||||
//%localID = ServerConnection.resolveGhostID(%behav);
|
|
||||||
|
|
||||||
//%tmpl = %localID.getTemplate();
|
|
||||||
//%tmpl.insantiateNamespace(%tmpl.getName());
|
|
||||||
|
|
||||||
//first, check if we have an existing command
|
|
||||||
%oldBind = %bindMap.getBinding(%command);
|
|
||||||
if(%oldBind !$= "")
|
|
||||||
%bindMap.unbind(getField(%oldBind, 0), getField(%oldBind, 1));
|
|
||||||
|
|
||||||
//now, set the requested bind
|
|
||||||
%bindMap.bind(%device, %key, %command);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clientCmdRemoveSpecCtrlInput(%device, %key, %bindMap)
|
|
||||||
{
|
|
||||||
//if we're requesting a custom bind map, set that up
|
|
||||||
if(%bindMap $= "")
|
|
||||||
%bindMap = moveMap;
|
|
||||||
|
|
||||||
if (!isObject(%bindMap))
|
|
||||||
return;
|
|
||||||
|
|
||||||
%bindMap.unbind(%device, %key);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clientCmdSetupClientBehavior(%bhvrGstID)
|
|
||||||
{
|
|
||||||
%localID = ServerConnection.resolveGhostID(%bhvrGstID);
|
|
||||||
%tmpl = %localID.getTemplate();
|
|
||||||
%tmpl.insantiateNamespace(%tmpl.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMouseAdjustAmount(%val)
|
|
||||||
{
|
|
||||||
// based on a default camera FOV of 90'
|
|
||||||
return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="MeshComponentAsset"
|
|
||||||
componentClass="MeshComponent"
|
|
||||||
friendlyName="mesh"
|
|
||||||
componentType="Render"
|
|
||||||
description="Enables an entity to render a shape." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="PlayerControllerComponentAsset"
|
|
||||||
componentClass="PlayerControllerComponent"
|
|
||||||
friendlyName="Player Controller"
|
|
||||||
componentType="Game"
|
|
||||||
description="Enables an entity to move like a player object." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="SoundComponentAsset"
|
|
||||||
componentClass="SoundComponent"
|
|
||||||
friendlyName="Sound(Component)"
|
|
||||||
componentType="sound"
|
|
||||||
description="Stores up to 4 sounds for playback." />
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<ComponentAsset
|
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="StateMachineComponentAsset"
|
|
||||||
componentClass="StateMachineComponent"
|
|
||||||
friendlyName="State Machine"
|
|
||||||
componentType="Game"
|
|
||||||
description="Enables a state machine on the entity." />
|
|
||||||
|
|
@ -1,191 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
%guiContent = new GuiControl(ConsoleDlg) {
|
|
||||||
position = "0 0";
|
|
||||||
extent = "1024 768";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
|
|
||||||
new GuiConsoleEditCtrl(ConsoleEntry) {
|
|
||||||
useSiblingScroller = "1";
|
|
||||||
historySize = "40";
|
|
||||||
tabComplete = "0";
|
|
||||||
sinkAllKeyEvents = "1";
|
|
||||||
password = "0";
|
|
||||||
passwordMask = "*";
|
|
||||||
maxLength = "255";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "0 750";
|
|
||||||
extent = "1024 18";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "ConsoleTextEditProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
altCommand = "ConsoleEntry::eval();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiContainer() {
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "1 728";
|
|
||||||
extent = "1024 22";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiBitmapCtrl() {
|
|
||||||
bitmap = "data/ui/art/hudfill.png";
|
|
||||||
color = "255 255 255 255";
|
|
||||||
wrap = "0";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "1024 22";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) {
|
|
||||||
text = "Errors";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "ToggleButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "2 2";
|
|
||||||
extent = "113 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiCheckBoxProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) {
|
|
||||||
text = "Warnings";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "ToggleButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "119 2";
|
|
||||||
extent = "113 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiCheckBoxProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) {
|
|
||||||
text = "Normal Messages";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "ToggleButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "236 2";
|
|
||||||
extent = "113 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiCheckBoxProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiScrollCtrl() {
|
|
||||||
willFirstRespond = "1";
|
|
||||||
hScrollBar = "alwaysOn";
|
|
||||||
vScrollBar = "alwaysOn";
|
|
||||||
lockHorizScroll = "0";
|
|
||||||
lockVertScroll = "0";
|
|
||||||
constantThumbHeight = "0";
|
|
||||||
childMargin = "0 0";
|
|
||||||
mouseWheelScrollSpeed = "-1";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "1024 730";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "ConsoleScrollProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
internalName = "Scroll";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiConsole(ConsoleMessageLogView) {
|
|
||||||
position = "1 1";
|
|
||||||
extent = "622 324";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiConsoleProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,140 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
exec("./profiles.cs");
|
|
||||||
exec("./console.gui");
|
|
||||||
|
|
||||||
GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
|
|
||||||
|
|
||||||
function ConsoleEntry::eval()
|
|
||||||
{
|
|
||||||
%text = trim(ConsoleEntry.getValue());
|
|
||||||
if(%text $= "")
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If it's missing a trailing () and it's not a variable,
|
|
||||||
// append the parentheses.
|
|
||||||
if(strpos(%text, "(") == -1 && !isDefined(%text)) {
|
|
||||||
if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1) {
|
|
||||||
if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1) {
|
|
||||||
%text = %text @ "()";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append a semicolon if need be.
|
|
||||||
%pos = strlen(%text) - 1;
|
|
||||||
if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1) {
|
|
||||||
%text = %text @ ";";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn off warnings for assigning from void
|
|
||||||
// and evaluate the snippet.
|
|
||||||
if(!isDefined("$Con::warnVoidAssignment"))
|
|
||||||
%oldWarnVoidAssignment = true;
|
|
||||||
else
|
|
||||||
%oldWarnVoidAssignment = $Con::warnVoidAssignment;
|
|
||||||
$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$("))
|
|
||||||
eval("%result = " @ %text);
|
|
||||||
else
|
|
||||||
eval(%text);
|
|
||||||
$Con::warnVoidAssignment = %oldWarnVoidAssignment;
|
|
||||||
|
|
||||||
ConsoleEntry.setValue("");
|
|
||||||
|
|
||||||
// Echo result.
|
|
||||||
if(%result !$= "")
|
|
||||||
echo(%result);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ToggleConsole(%make)
|
|
||||||
{
|
|
||||||
if (%make) {
|
|
||||||
if (ConsoleDlg.isAwake()) {
|
|
||||||
// Deactivate the console.
|
|
||||||
Canvas.popDialog(ConsoleDlg);
|
|
||||||
} else {
|
|
||||||
Canvas.pushDialog(ConsoleDlg, 99);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlg::hideWindow(%this)
|
|
||||||
{
|
|
||||||
%this-->Scroll.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlg::showWindow(%this)
|
|
||||||
{
|
|
||||||
%this-->Scroll.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlg::onWake(%this)
|
|
||||||
{
|
|
||||||
ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter());
|
|
||||||
ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter());
|
|
||||||
ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter());
|
|
||||||
|
|
||||||
ConsoleMessageLogView.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlg::setAlpha( %this, %alpha)
|
|
||||||
{
|
|
||||||
if (%alpha $= "")
|
|
||||||
ConsoleScrollProfile.fillColor = $ConsoleDefaultFillColor;
|
|
||||||
else
|
|
||||||
ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlgErrorFilterBtn::onClick(%this)
|
|
||||||
{
|
|
||||||
ConsoleMessageLogView.toggleErrorFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlgWarnFilterBtn::onClick(%this)
|
|
||||||
{
|
|
||||||
|
|
||||||
ConsoleMessageLogView.toggleWarnFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleDlgNormalFilterBtn::onClick(%this)
|
|
||||||
{
|
|
||||||
ConsoleMessageLogView.toggleNormalFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount)
|
|
||||||
{
|
|
||||||
ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors");
|
|
||||||
ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings");
|
|
||||||
ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages");
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if(!isObject(GuiConsoleProfile))
|
|
||||||
new GuiControlProfile(GuiConsoleProfile)
|
|
||||||
{
|
|
||||||
fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console";
|
|
||||||
fontSize = ($platform $= "macos") ? 13 : 12;
|
|
||||||
fontColor = "255 255 255";
|
|
||||||
fontColorHL = "0 255 255";
|
|
||||||
fontColorNA = "255 0 0";
|
|
||||||
fontColors[6] = "100 100 100";
|
|
||||||
fontColors[7] = "100 100 0";
|
|
||||||
fontColors[8] = "0 0 100";
|
|
||||||
fontColors[9] = "0 100 0";
|
|
||||||
category = "Core";
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!isObject(GuiConsoleTextProfile))
|
|
||||||
new GuiControlProfile(GuiConsoleTextProfile)
|
|
||||||
{
|
|
||||||
fontColor = "0 0 0";
|
|
||||||
autoSizeWidth = true;
|
|
||||||
autoSizeHeight = true;
|
|
||||||
textOffset = "2 2";
|
|
||||||
opaque = true;
|
|
||||||
fillColor = "255 255 255";
|
|
||||||
border = true;
|
|
||||||
borderThickness = 1;
|
|
||||||
borderColor = "0 0 0";
|
|
||||||
category = "Core";
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!isObject(ConsoleScrollProfile))
|
|
||||||
new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile)
|
|
||||||
{
|
|
||||||
opaque = true;
|
|
||||||
fillColor = "0 0 0 175";
|
|
||||||
border = 1;
|
|
||||||
//borderThickness = 0;
|
|
||||||
borderColor = "0 0 0";
|
|
||||||
category = "Core";
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!isObject(ConsoleTextEditProfile))
|
|
||||||
new GuiControlProfile(ConsoleTextEditProfile : GuiTextEditProfile)
|
|
||||||
{
|
|
||||||
fillColor = "242 241 240 255";
|
|
||||||
fillColorHL = "255 255 255";
|
|
||||||
category = "Core";
|
|
||||||
};
|
|
||||||
|
|
@ -1,102 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// Cursor toggle functions.
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
$cursorControlled = true;
|
|
||||||
function showCursor()
|
|
||||||
{
|
|
||||||
if ($cursorControlled)
|
|
||||||
lockMouse(false);
|
|
||||||
Canvas.cursorOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideCursor()
|
|
||||||
{
|
|
||||||
if ($cursorControlled)
|
|
||||||
lockMouse(true);
|
|
||||||
Canvas.cursorOff();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas
|
|
||||||
// class, of which the global Canvas object is an instance. In this case, the behavior we want
|
|
||||||
// is for the cursor to automatically display, except when the only guis visible want no
|
|
||||||
// cursor - usually the in game interface.
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
package CanvasCursorPackage
|
|
||||||
{
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// checkCursor
|
|
||||||
// The checkCursor method iterates through all the root controls on the canvas checking each
|
|
||||||
// ones noCursor property. If the noCursor property exists as anything other than false or an
|
|
||||||
// empty string on every control, the cursor will be hidden.
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
function GuiCanvas::checkCursor(%this)
|
|
||||||
{
|
|
||||||
%count = %this.getCount();
|
|
||||||
for(%i = 0; %i < %count; %i++)
|
|
||||||
{
|
|
||||||
%control = %this.getObject(%i);
|
|
||||||
if ((%control.noCursor $= "") || !%control.noCursor)
|
|
||||||
{
|
|
||||||
showCursor();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we get here, every control requested a hidden cursor, so we oblige.
|
|
||||||
hideCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// The following functions override the GuiCanvas defaults that involve changing the content
|
|
||||||
// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one.
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
function GuiCanvas::setContent(%this, %ctrl)
|
|
||||||
{
|
|
||||||
Parent::setContent(%this, %ctrl);
|
|
||||||
%this.checkCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center)
|
|
||||||
{
|
|
||||||
Parent::pushDialog(%this, %ctrl, %layer, %center);
|
|
||||||
%this.checkCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiCanvas::popDialog(%this, %ctrl)
|
|
||||||
{
|
|
||||||
Parent::popDialog(%this, %ctrl);
|
|
||||||
%this.checkCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiCanvas::popLayer(%this, %layer)
|
|
||||||
{
|
|
||||||
Parent::popLayer(%this, %layer);
|
|
||||||
%this.checkCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
activatePackage(CanvasCursorPackage);
|
|
||||||
|
|
@ -1,55 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// CloudLayer
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( CloudLayerShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/cloudLayerV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/cloudLayerP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$normalHeightMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// BasicClouds
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( BasicCloudsShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/basicCloudsV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/basicCloudsP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,79 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Anim flag settings - must match material.h
|
|
||||||
// These cannot be enumed through script becuase it cannot
|
|
||||||
// handle the "|" operation for combining them together
|
|
||||||
// ie. Scroll | Wave does not work.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
$scroll = 1;
|
|
||||||
$rotate = 2;
|
|
||||||
$wave = 4;
|
|
||||||
$scale = 8;
|
|
||||||
$sequence = 16;
|
|
||||||
|
|
||||||
|
|
||||||
// Common stateblock definitions
|
|
||||||
new GFXSamplerStateData(SamplerClampLinear)
|
|
||||||
{
|
|
||||||
textureColorOp = GFXTOPModulate;
|
|
||||||
addressModeU = GFXAddressClamp;
|
|
||||||
addressModeV = GFXAddressClamp;
|
|
||||||
addressModeW = GFXAddressClamp;
|
|
||||||
magFilter = GFXTextureFilterLinear;
|
|
||||||
minFilter = GFXTextureFilterLinear;
|
|
||||||
mipFilter = GFXTextureFilterLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GFXSamplerStateData(SamplerClampPoint)
|
|
||||||
{
|
|
||||||
textureColorOp = GFXTOPModulate;
|
|
||||||
addressModeU = GFXAddressClamp;
|
|
||||||
addressModeV = GFXAddressClamp;
|
|
||||||
addressModeW = GFXAddressClamp;
|
|
||||||
magFilter = GFXTextureFilterPoint;
|
|
||||||
minFilter = GFXTextureFilterPoint;
|
|
||||||
mipFilter = GFXTextureFilterPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GFXSamplerStateData(SamplerWrapLinear)
|
|
||||||
{
|
|
||||||
textureColorOp = GFXTOPModulate;
|
|
||||||
addressModeU = GFXTextureAddressWrap;
|
|
||||||
addressModeV = GFXTextureAddressWrap;
|
|
||||||
addressModeW = GFXTextureAddressWrap;
|
|
||||||
magFilter = GFXTextureFilterLinear;
|
|
||||||
minFilter = GFXTextureFilterLinear;
|
|
||||||
mipFilter = GFXTextureFilterLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GFXSamplerStateData(SamplerWrapPoint)
|
|
||||||
{
|
|
||||||
textureColorOp = GFXTOPModulate;
|
|
||||||
addressModeU = GFXTextureAddressWrap;
|
|
||||||
addressModeV = GFXTextureAddressWrap;
|
|
||||||
addressModeW = GFXTextureAddressWrap;
|
|
||||||
magFilter = GFXTextureFilterPoint;
|
|
||||||
minFilter = GFXTextureFilterPoint;
|
|
||||||
mipFilter = GFXTextureFilterPoint;
|
|
||||||
};
|
|
||||||
|
|
@ -1,48 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
new GFXStateBlockData( ScatterSkySBData )
|
|
||||||
{
|
|
||||||
cullMode = "GFXCullNone";
|
|
||||||
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = true;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
vertexColorEnable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( ScatterSkyShaderData )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/scatterSkyV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/scatterSkyP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$nightSky";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,152 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// This file contains shader data necessary for various engine utility functions
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
singleton ShaderData( ParticlesShaderData )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/particlesV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/particlesP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particlesV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
samplerNames[1] = "$deferredTex";
|
|
||||||
samplerNames[2] = "$paraboloidLightMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( OffscreenParticleCompositeShaderData )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/particleCompositeV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/particleCompositeP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorSource";
|
|
||||||
samplerNames[1] = "$edgeSource";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Planar Reflection
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
new ShaderData( ReflectBump )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
samplerNames[1] = "$refractMap";
|
|
||||||
samplerNames[2] = "$bumpMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new ShaderData( Reflect )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
samplerNames[1] = "$refractMap";
|
|
||||||
|
|
||||||
pixVersion = 1.4;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// fxFoliageReplicator
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
new ShaderData( fxFoliageReplicatorShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
samplerNames[1] = "$alphaMap";
|
|
||||||
|
|
||||||
pixVersion = 1.4;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( VolumetricFogDeferredShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreP.glsl";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
singleton ShaderData( VolumetricFogShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredTex";
|
|
||||||
samplerNames[1] = "$depthBuffer";
|
|
||||||
samplerNames[2] = "$frontBuffer";
|
|
||||||
samplerNames[3] = "$density";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
singleton ShaderData( VolumetricFogReflectionShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogRefl.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
singleton ShaderData( CubemapSaveShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl";
|
|
||||||
DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl";
|
|
||||||
OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$cubemapTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,36 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/// Used when generating the blended base texture.
|
|
||||||
singleton ShaderData( TerrainBlendShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/terrain/blendV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/terrain/blendP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "layerTex";
|
|
||||||
samplerNames[1] = "textureMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,208 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Water
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( WaterShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$bumpMap"; // noise
|
|
||||||
samplerNames[1] = "$deferredTex"; // #deferred
|
|
||||||
samplerNames[2] = "$reflectMap"; // $reflectbuff
|
|
||||||
samplerNames[3] = "$refractBuff"; // $backbuff
|
|
||||||
samplerNames[4] = "$skyMap"; // $cubemap
|
|
||||||
samplerNames[5] = "$foamMap"; // foam
|
|
||||||
samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient )
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GFXSamplerStateData(WaterSampler)
|
|
||||||
{
|
|
||||||
textureColorOp = GFXTOPModulate;
|
|
||||||
addressModeU = GFXAddressWrap;
|
|
||||||
addressModeV = GFXAddressWrap;
|
|
||||||
addressModeW = GFXAddressWrap;
|
|
||||||
magFilter = GFXTextureFilterLinear;
|
|
||||||
minFilter = GFXTextureFilterAnisotropic;
|
|
||||||
mipFilter = GFXTextureFilterLinear;
|
|
||||||
maxAnisotropy = 4;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( WaterStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = WaterSampler; // noise
|
|
||||||
samplerStates[1] = SamplerClampPoint; // #deferred
|
|
||||||
samplerStates[2] = SamplerClampLinear; // $reflectbuff
|
|
||||||
samplerStates[3] = SamplerClampPoint; // $backbuff
|
|
||||||
samplerStates[4] = SamplerWrapLinear; // $cubemap
|
|
||||||
samplerStates[5] = SamplerWrapLinear; // foam
|
|
||||||
samplerStates[6] = SamplerClampLinear; // depthMap ( color gradient )
|
|
||||||
cullDefined = true;
|
|
||||||
cullMode = "GFXCullCCW";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock )
|
|
||||||
{
|
|
||||||
cullMode = "GFXCullCW";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton CustomMaterial( WaterMat )
|
|
||||||
{
|
|
||||||
sampler["deferredTex"] = "#deferred";
|
|
||||||
sampler["reflectMap"] = "$reflectbuff";
|
|
||||||
sampler["refractBuff"] = "$backbuff";
|
|
||||||
// These samplers are set in code not here.
|
|
||||||
// This is to allow different WaterObject instances
|
|
||||||
// to use this same material but override these textures
|
|
||||||
// per instance.
|
|
||||||
//sampler["bumpMap"] = "";
|
|
||||||
//sampler["skyMap"] = "";
|
|
||||||
//sampler["foamMap"] = "";
|
|
||||||
//sampler["depthGradMap"] = "";
|
|
||||||
|
|
||||||
shader = WaterShader;
|
|
||||||
stateBlock = WaterStateBlock;
|
|
||||||
version = 3.0;
|
|
||||||
|
|
||||||
useAnisotropic[0] = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Underwater
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( UnderWaterShader : WaterShader )
|
|
||||||
{
|
|
||||||
defines = "UNDERWATER";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton CustomMaterial( UnderwaterMat )
|
|
||||||
{
|
|
||||||
// These samplers are set in code not here.
|
|
||||||
// This is to allow different WaterObject instances
|
|
||||||
// to use this same material but override these textures
|
|
||||||
// per instance.
|
|
||||||
//sampler["bumpMap"] = "core/art/water/noise02";
|
|
||||||
//sampler["foamMap"] = "core/art/water/foam";
|
|
||||||
|
|
||||||
sampler["deferredTex"] = "#deferred";
|
|
||||||
sampler["refractBuff"] = "$backbuff";
|
|
||||||
|
|
||||||
shader = UnderWaterShader;
|
|
||||||
stateBlock = UnderWaterStateBlock;
|
|
||||||
specular = "0.75 0.75 0.75 1.0";
|
|
||||||
specularPower = 48.0;
|
|
||||||
version = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Basic Water
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( WaterBasicShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterBasicV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterBasicP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$bumpMap";
|
|
||||||
samplerNames[2] = "$reflectMap";
|
|
||||||
samplerNames[3] = "$refractBuff";
|
|
||||||
samplerNames[4] = "$skyMap";
|
|
||||||
samplerNames[5] = "$depthGradMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( WaterBasicStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = WaterSampler; // noise
|
|
||||||
samplerStates[2] = SamplerClampLinear; // $reflectbuff
|
|
||||||
samplerStates[3] = SamplerClampPoint; // $backbuff
|
|
||||||
samplerStates[4] = SamplerWrapLinear; // $cubemap
|
|
||||||
cullDefined = true;
|
|
||||||
cullMode = "GFXCullCCW";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( UnderWaterBasicStateBlock : WaterBasicStateBlock )
|
|
||||||
{
|
|
||||||
cullMode = "GFXCullCW";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton CustomMaterial( WaterBasicMat )
|
|
||||||
{
|
|
||||||
// These samplers are set in code not here.
|
|
||||||
// This is to allow different WaterObject instances
|
|
||||||
// to use this same material but override these textures
|
|
||||||
// per instance.
|
|
||||||
//sampler["bumpMap"] = "core/art/water/noise02";
|
|
||||||
//sampler["skyMap"] = "$cubemap";
|
|
||||||
|
|
||||||
//sampler["deferredTex"] = "#deferred";
|
|
||||||
sampler["reflectMap"] = "$reflectbuff";
|
|
||||||
sampler["refractBuff"] = "$backbuff";
|
|
||||||
|
|
||||||
cubemap = NewLevelSkyCubemap;
|
|
||||||
shader = WaterBasicShader;
|
|
||||||
stateBlock = WaterBasicStateBlock;
|
|
||||||
version = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Basic UnderWater
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( UnderWaterBasicShader : WaterBasicShader)
|
|
||||||
{
|
|
||||||
defines = "UNDERWATER";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton CustomMaterial( UnderwaterBasicMat )
|
|
||||||
{
|
|
||||||
// These samplers are set in code not here.
|
|
||||||
// This is to allow different WaterObject instances
|
|
||||||
// to use this same material but override these textures
|
|
||||||
// per instance.
|
|
||||||
//sampler["bumpMap"] = "core/art/water/noise02";
|
|
||||||
//samplers["skyMap"] = "$cubemap";
|
|
||||||
|
|
||||||
//sampler["deferredTex"] = "#deferred";
|
|
||||||
sampler["refractBuff"] = "$backbuff";
|
|
||||||
|
|
||||||
shader = UnderWaterBasicShader;
|
|
||||||
stateBlock = UnderWaterBasicStateBlock;
|
|
||||||
version = 2.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,36 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ATI Vendor Profile Script
|
|
||||||
//
|
|
||||||
// This script is responsible for setting global
|
|
||||||
// capability strings based on the nVidia vendor.
|
|
||||||
|
|
||||||
if(GFXCardProfiler::getVersion() < 64.44)
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = true;
|
|
||||||
$GFX::OutdatedDriversLink = "<a:www.ati.com>You can get newer drivers here.</a>.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// nVidia Vendor Profile Script
|
|
||||||
//
|
|
||||||
// This script is responsible for setting global
|
|
||||||
// capability strings based on the nVidia vendor.
|
|
||||||
|
|
||||||
if(GFXCardProfiler::getVersion() < 1.2)
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = true;
|
|
||||||
$GFX::OutdatedDriversLink = "<a:www.nvidia.com>You can get newer drivers here.</a>.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// nVidia Vendor Profile Script
|
|
||||||
//
|
|
||||||
// This script is responsible for setting global
|
|
||||||
// capability strings based on the nVidia vendor.
|
|
||||||
|
|
||||||
if(GFXCardProfiler::getVersion() < 53.82)
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = true;
|
|
||||||
$GFX::OutdatedDriversLink = "<a:www.nvidia.com>You can get newer drivers here.</a>.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Silly card has trouble with this!
|
|
||||||
GFXCardProfiler::setCapability("autoMipmapLevel", false);
|
|
||||||
|
|
@ -1,36 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// nVidia Vendor Profile Script
|
|
||||||
//
|
|
||||||
// This script is responsible for setting global
|
|
||||||
// capability strings based on the nVidia vendor.
|
|
||||||
|
|
||||||
if(GFXCardProfiler::getVersion() < 56.72)
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = true;
|
|
||||||
$GFX::OutdatedDriversLink = "<a:www.nvidia.com>You can get newer drivers here.</a>.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$GFX::OutdatedDrivers = false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Direct3D 9 Renderer Profile Script
|
|
||||||
//
|
|
||||||
// This script is responsible for setting global
|
|
||||||
// capability strings based on the D3D9 renderer type.
|
|
||||||
|
|
@ -1,102 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// DInput keyboard, mouse, and joystick prefs
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$pref::Input::MouseEnabled = 1;
|
|
||||||
$pref::Input::LinkMouseSensitivity = 1;
|
|
||||||
$pref::Input::KeyboardEnabled = 1;
|
|
||||||
$pref::Input::KeyboardTurnSpeed = 0.1;
|
|
||||||
$pref::Input::JoystickEnabled = 0;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Video Preferences
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Set directory paths for various data or default images.
|
|
||||||
$pref::Video::ProfilePath = "core/gfxprofile";
|
|
||||||
$pref::Video::missingTexturePath = "core/images/missingTexture.png";
|
|
||||||
$pref::Video::unavailableTexturePath = "core/images/unavailable.png";
|
|
||||||
$pref::Video::warningTexturePath = "core/images/warnMat.dds";
|
|
||||||
|
|
||||||
$pref::Video::disableVerticalSync = 1;
|
|
||||||
$pref::Video::mode = "800 600 false 32 60 4";
|
|
||||||
$pref::Video::defaultFenceCount = 0;
|
|
||||||
|
|
||||||
// This disables the hardware FSAA/MSAA so that we depend completely on the FXAA
|
|
||||||
// post effect which works on all cards and in deferred mode. Note that the new
|
|
||||||
// Intel Hybrid graphics on laptops will fail to initialize when hardware AA is
|
|
||||||
// enabled... so you've been warned.
|
|
||||||
$pref::Video::disableHardwareAA = true;
|
|
||||||
|
|
||||||
$pref::Video::disableNormalmapping = false;
|
|
||||||
$pref::Video::disablePixSpecular = false;
|
|
||||||
$pref::Video::disableCubemapping = false;
|
|
||||||
$pref::Video::disableParallaxMapping = false;
|
|
||||||
|
|
||||||
// The number of mipmap levels to drop on loaded textures to reduce video memory
|
|
||||||
// usage. It will skip any textures that have been defined as not allowing down
|
|
||||||
// scaling.
|
|
||||||
$pref::Video::textureReductionLevel = 0;
|
|
||||||
|
|
||||||
$pref::Video::defaultAnisotropy = 1;
|
|
||||||
//$pref::Video::Gamma = 1.0;
|
|
||||||
|
|
||||||
/// AutoDetect graphics quality levels the next startup.
|
|
||||||
$pref::Video::autoDetect = 1;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Shader stuff
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// This is the path used by ShaderGen to cache procedural shaders. If left
|
|
||||||
// blank ShaderGen will only cache shaders to memory and not to disk.
|
|
||||||
$shaderGen::cachePath = "data/shaderCache";
|
|
||||||
|
|
||||||
// Uncomment to disable ShaderGen, useful when debugging
|
|
||||||
//$ShaderGen::GenNewShaders = false;
|
|
||||||
|
|
||||||
// Uncomment to dump disassembly for any shader that is compiled to disk. These
|
|
||||||
// will appear as shadername_dis.txt in the same path as the shader file.
|
|
||||||
//$gfx::disassembleAllShaders = true;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Lighting and shadowing
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Uncomment to enable AdvancedLighting on the Mac (T3D 2009 Beta 3)
|
|
||||||
//$pref::machax::enableAdvancedLighting = true;
|
|
||||||
|
|
||||||
$sceneLighting::cacheSize = 20000;
|
|
||||||
$sceneLighting::purgeMethod = "lastCreated";
|
|
||||||
$sceneLighting::cacheLighting = 1;
|
|
||||||
|
|
||||||
$pref::Shadows::textureScalar = 1.0;
|
|
||||||
$pref::Shadows::disable = false;
|
|
||||||
|
|
||||||
// Sets the shadow filtering mode.
|
|
||||||
// None - Disables filtering.
|
|
||||||
// SoftShadow - Does a simple soft shadow
|
|
||||||
// SoftShadowHighQuality
|
|
||||||
$pref::Shadows::filterMode = "SoftShadow";
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 635 B |
|
|
@ -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) {
|
|
||||||
detailMap[0] = "missingTexture";
|
|
||||||
diffuseColor[0] = "25 16 0";
|
|
||||||
emissive[0] = false;
|
|
||||||
translucent = false;
|
|
||||||
};
|
|
||||||
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 778 B |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
|
@ -1,74 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function initLightingSystems(%manager)
|
|
||||||
{
|
|
||||||
echo( "\nInitializing Lighting Systems" );
|
|
||||||
|
|
||||||
// First exec the scripts for the different light managers
|
|
||||||
// in the lighting folder.
|
|
||||||
%pattern = "./lighting/*/init.cs";
|
|
||||||
%file = findFirstFile( %pattern );
|
|
||||||
if ( %file $= "" )
|
|
||||||
{
|
|
||||||
// Try for DSOs next.
|
|
||||||
%pattern = "./lighting/*/init.cs.dso";
|
|
||||||
%file = findFirstFile( %pattern );
|
|
||||||
}
|
|
||||||
|
|
||||||
while( %file !$= "" )
|
|
||||||
{
|
|
||||||
exec( %file );
|
|
||||||
%file = findNextFile( %pattern );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the perfered one first.
|
|
||||||
%success = setLightManager(%manager);
|
|
||||||
|
|
||||||
// Did we completely fail to initialize a light manager?
|
|
||||||
if (!%success)
|
|
||||||
{
|
|
||||||
// If we completely failed to initialize a light
|
|
||||||
// manager then the 3d scene cannot be rendered.
|
|
||||||
quitWithErrorMessage( "Failed to set a light manager!" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function onLightManagerActivate( %lmName )
|
|
||||||
{
|
|
||||||
// Call activation callbacks.
|
|
||||||
%activateNewFn = "onActivate" @ getWord( %lmName, 0 ) @ "LM";
|
|
||||||
if( isFunction( %activateNewFn ) )
|
|
||||||
eval( %activateNewFn @ "();" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function onLightManagerDeactivate( %lmName )
|
|
||||||
{
|
|
||||||
// Call deactivation callback.
|
|
||||||
%deactivateOldFn = "onDeactivate" @ getWord( %lmName, 0 ) @ "LM";
|
|
||||||
if( isFunction( %deactivateOldFn ) )
|
|
||||||
eval( %deactivateOldFn @ "();" );
|
|
||||||
}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
singleton ShaderData( ClearGBufferShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredClearGBufferP.glsl";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( DeferredColorShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredColorShaderP.glsl";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Primary Deferred Shader
|
|
||||||
new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
cullMode = GFXCullNone;
|
|
||||||
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendSrcAlpha;
|
|
||||||
blendDest = GFXBlendInvSrcAlpha;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerWrapLinear;
|
|
||||||
samplerStates[1] = SamplerWrapLinear;
|
|
||||||
samplerStates[2] = SamplerWrapLinear;
|
|
||||||
samplerStates[3] = SamplerWrapLinear;
|
|
||||||
samplerStates[4] = SamplerWrapLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
new ShaderData( AL_DeferredShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredShadingP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "colorBufferTex";
|
|
||||||
samplerNames[1] = "lightDeferredTex";
|
|
||||||
samplerNames[2] = "matInfoTex";
|
|
||||||
samplerNames[3] = "deferredTex";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( AL_DeferredShading )
|
|
||||||
{
|
|
||||||
renderTime = "PFXAfterBin";
|
|
||||||
renderBin = "SkyBin";
|
|
||||||
shader = AL_DeferredShader;
|
|
||||||
stateBlock = AL_DeferredShadingState;
|
|
||||||
texture[0] = "#color";
|
|
||||||
texture[1] = "#lightinfo";
|
|
||||||
texture[2] = "#matinfo";
|
|
||||||
texture[3] = "#deferred";
|
|
||||||
|
|
||||||
target = "$backBuffer";
|
|
||||||
renderPriority = 10000;
|
|
||||||
allowReflectPass = true;
|
|
||||||
};
|
|
||||||
|
|
@ -1,68 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Default Prefs
|
|
||||||
|
|
||||||
/*
|
|
||||||
$pref::LightManager::sgAtlasMaxDynamicLights = "16";
|
|
||||||
$pref::LightManager::sgDynamicShadowDetailSize = "0";
|
|
||||||
$pref::LightManager::sgDynamicShadowQuality = "0";
|
|
||||||
$pref::LightManager::sgLightingProfileAllowShadows = "1";
|
|
||||||
$pref::LightManager::sgLightingProfileQuality = "0";
|
|
||||||
$pref::LightManager::sgMaxBestLights = "10";
|
|
||||||
$pref::LightManager::sgMultipleDynamicShadows = "1";
|
|
||||||
$pref::LightManager::sgShowCacheStats = "0";
|
|
||||||
$pref::LightManager::sgUseBloom = "";
|
|
||||||
$pref::LightManager::sgUseDRLHighDynamicRange = "0";
|
|
||||||
$pref::LightManager::sgUseDynamicRangeLighting = "0";
|
|
||||||
$pref::LightManager::sgUseDynamicShadows = "1";
|
|
||||||
$pref::LightManager::sgUseToneMapping = "";
|
|
||||||
*/
|
|
||||||
|
|
||||||
exec( "./shaders.cs" );
|
|
||||||
exec( "./deferredShading.cs" );
|
|
||||||
|
|
||||||
function onActivateAdvancedLM()
|
|
||||||
{
|
|
||||||
// Enable the offscreen target so that AL will work
|
|
||||||
// with MSAA back buffers and for HDR rendering.
|
|
||||||
AL_FormatToken.enable();
|
|
||||||
|
|
||||||
// Activate Deferred Shading
|
|
||||||
AL_DeferredShading.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeactivateAdvancedLM()
|
|
||||||
{
|
|
||||||
// Disable the offscreen render target.
|
|
||||||
AL_FormatToken.disable();
|
|
||||||
|
|
||||||
// Deactivate Deferred Shading
|
|
||||||
AL_DeferredShading.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAdvancedLighting()
|
|
||||||
{
|
|
||||||
setLightManager( "Advanced Lighting" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,276 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// Vector Light State
|
|
||||||
new GFXStateBlockData( AL_VectorLightState )
|
|
||||||
{
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendOne;
|
|
||||||
blendDest = GFXBlendOne;
|
|
||||||
blendOp = GFXBlendOpAdd;
|
|
||||||
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint; // G-buffer
|
|
||||||
mSamplerNames[0] = "deferredBuffer";
|
|
||||||
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
|
|
||||||
mSamplerNames[1] = "shadowMap";
|
|
||||||
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
|
|
||||||
mSamplerNames[2] = "dynamicShadowMap";
|
|
||||||
samplerStates[3] = SamplerClampLinear; // SSAO Mask
|
|
||||||
mSamplerNames[3] = "ssaoMask";
|
|
||||||
samplerStates[4] = SamplerWrapPoint; // Random Direction Map
|
|
||||||
|
|
||||||
cullDefined = true;
|
|
||||||
cullMode = GFXCullNone;
|
|
||||||
|
|
||||||
stencilDefined = true;
|
|
||||||
stencilEnable = true;
|
|
||||||
stencilFailOp = GFXStencilOpKeep;
|
|
||||||
stencilZFailOp = GFXStencilOpKeep;
|
|
||||||
stencilPassOp = GFXStencilOpKeep;
|
|
||||||
stencilFunc = GFXCmpLess;
|
|
||||||
stencilRef = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Vector Light Material
|
|
||||||
new ShaderData( AL_VectorLightShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/farFrustumQuadV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/vectorLightP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/farFrustumQuadV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/vectorLightP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredBuffer";
|
|
||||||
samplerNames[1] = "$shadowMap";
|
|
||||||
samplerNames[2] = "$dynamicShadowMap";
|
|
||||||
samplerNames[3] = "$ssaoMask";
|
|
||||||
samplerNames[4] = "$gTapRotationTex";
|
|
||||||
samplerNames[5] = "$lightBuffer";
|
|
||||||
samplerNames[6] = "$colorBuffer";
|
|
||||||
samplerNames[7] = "$matInfoBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new CustomMaterial( AL_VectorLightMaterial )
|
|
||||||
{
|
|
||||||
shader = AL_VectorLightShader;
|
|
||||||
stateBlock = AL_VectorLightState;
|
|
||||||
|
|
||||||
sampler["deferredBuffer"] = "#deferred";
|
|
||||||
sampler["shadowMap"] = "$dynamiclight";
|
|
||||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
|
||||||
sampler["ssaoMask"] = "#ssaoMask";
|
|
||||||
sampler["lightBuffer"] = "#lightinfo";
|
|
||||||
sampler["colorBuffer"] = "#color";
|
|
||||||
sampler["matInfoBuffer"] = "#matinfo";
|
|
||||||
|
|
||||||
target = "lightinfo";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Convex-geometry light states
|
|
||||||
new GFXStateBlockData( AL_ConvexLightState )
|
|
||||||
{
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendOne;
|
|
||||||
blendDest = GFXBlendOne;
|
|
||||||
blendOp = GFXBlendOpAdd;
|
|
||||||
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = true;
|
|
||||||
zWriteEnable = false;
|
|
||||||
zFunc = GFXCmpGreaterEqual;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint; // G-buffer
|
|
||||||
mSamplerNames[0] = "deferredBuffer";
|
|
||||||
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
|
|
||||||
mSamplerNames[1] = "shadowMap";
|
|
||||||
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
|
|
||||||
mSamplerNames[2] = "dynamicShadowMap";
|
|
||||||
samplerStates[3] = SamplerClampLinear; // Cookie Map
|
|
||||||
samplerStates[4] = SamplerWrapPoint; // Random Direction Map
|
|
||||||
|
|
||||||
cullDefined = true;
|
|
||||||
cullMode = GFXCullCW;
|
|
||||||
|
|
||||||
stencilDefined = true;
|
|
||||||
stencilEnable = true;
|
|
||||||
stencilFailOp = GFXStencilOpKeep;
|
|
||||||
stencilZFailOp = GFXStencilOpKeep;
|
|
||||||
stencilPassOp = GFXStencilOpKeep;
|
|
||||||
stencilFunc = GFXCmpLess;
|
|
||||||
stencilRef = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Point Light Material
|
|
||||||
new ShaderData( AL_PointLightShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/pointLightP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredBuffer";
|
|
||||||
samplerNames[1] = "$shadowMap";
|
|
||||||
samplerNames[2] = "$dynamicShadowMap";
|
|
||||||
samplerNames[3] = "$cookieMap";
|
|
||||||
samplerNames[4] = "$gTapRotationTex";
|
|
||||||
samplerNames[5] = "$lightBuffer";
|
|
||||||
samplerNames[6] = "$colorBuffer";
|
|
||||||
samplerNames[7] = "$matInfoBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new CustomMaterial( AL_PointLightMaterial )
|
|
||||||
{
|
|
||||||
shader = AL_PointLightShader;
|
|
||||||
stateBlock = AL_ConvexLightState;
|
|
||||||
|
|
||||||
sampler["deferredBuffer"] = "#deferred";
|
|
||||||
sampler["shadowMap"] = "$dynamiclight";
|
|
||||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
|
||||||
sampler["cookieMap"] = "$dynamiclightmask";
|
|
||||||
sampler["lightBuffer"] = "#lightinfo";
|
|
||||||
sampler["colorBuffer"] = "#color";
|
|
||||||
sampler["matInfoBuffer"] = "#matinfo";
|
|
||||||
|
|
||||||
target = "lightinfo";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Spot Light Material
|
|
||||||
new ShaderData( AL_SpotLightShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/spotLightP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/spotLightP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredBuffer";
|
|
||||||
samplerNames[1] = "$shadowMap";
|
|
||||||
samplerNames[2] = "$dynamicShadowMap";
|
|
||||||
samplerNames[3] = "$cookieMap";
|
|
||||||
samplerNames[4] = "$gTapRotationTex";
|
|
||||||
samplerNames[5] = "$lightBuffer";
|
|
||||||
samplerNames[6] = "$colorBuffer";
|
|
||||||
samplerNames[7] = "$matInfoBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new CustomMaterial( AL_SpotLightMaterial )
|
|
||||||
{
|
|
||||||
shader = AL_SpotLightShader;
|
|
||||||
stateBlock = AL_ConvexLightState;
|
|
||||||
|
|
||||||
sampler["deferredBuffer"] = "#deferred";
|
|
||||||
sampler["shadowMap"] = "$dynamiclight";
|
|
||||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
|
||||||
sampler["cookieMap"] = "$dynamiclightmask";
|
|
||||||
sampler["lightBuffer"] = "#lightinfo";
|
|
||||||
sampler["colorBuffer"] = "#color";
|
|
||||||
sampler["matInfoBuffer"] = "#matinfo";
|
|
||||||
|
|
||||||
target = "lightinfo";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This material is used for generating deferred
|
|
||||||
/// materials for objects that do not have materials.
|
|
||||||
new Material( AL_DefaultDeferredMaterial )
|
|
||||||
{
|
|
||||||
// We need something in the first pass else it
|
|
||||||
// won't create a proper material instance.
|
|
||||||
//
|
|
||||||
// We use color here because some objects may not
|
|
||||||
// have texture coords in their vertex format...
|
|
||||||
// for example like terrain.
|
|
||||||
//
|
|
||||||
diffuseColor[0] = "1 1 1 1";
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This material is used for generating shadow
|
|
||||||
/// materials for objects that do not have materials.
|
|
||||||
new Material( AL_DefaultShadowMaterial )
|
|
||||||
{
|
|
||||||
// We need something in the first pass else it
|
|
||||||
// won't create a proper material instance.
|
|
||||||
//
|
|
||||||
// We use color here because some objects may not
|
|
||||||
// have texture coords in their vertex format...
|
|
||||||
// for example like terrain.
|
|
||||||
//
|
|
||||||
diffuseColor[0] = "1 1 1 1";
|
|
||||||
|
|
||||||
// This is here mostly for terrain which uses
|
|
||||||
// this material to create its shadow material.
|
|
||||||
//
|
|
||||||
// At sunset/sunrise the sun is looking thru
|
|
||||||
// backsides of the terrain which often are not
|
|
||||||
// closed. By changing the material to be double
|
|
||||||
// sided we avoid holes in the shadowed geometry.
|
|
||||||
//
|
|
||||||
doubleSided = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Particle System Point Light Material
|
|
||||||
new ShaderData( AL_ParticlePointLightShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
new CustomMaterial( AL_ParticlePointLightMaterial )
|
|
||||||
{
|
|
||||||
shader = AL_ParticlePointLightShader;
|
|
||||||
stateBlock = AL_ConvexLightState;
|
|
||||||
|
|
||||||
sampler["deferredBuffer"] = "#deferred";
|
|
||||||
target = "lightinfo";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,92 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
exec( "./shadowFilter.cs" );
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( BL_ProjectedShadowSBData )
|
|
||||||
{
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendDestColor;
|
|
||||||
blendDest = GFXBlendZero;
|
|
||||||
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = true;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
vertexColorEnable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( BL_ProjectedShadowShaderData )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/projectedShadowV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/projectedShadowP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "inputTex";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton CustomMaterial( BL_ProjectedShadowMaterial )
|
|
||||||
{
|
|
||||||
sampler["inputTex"] = "$miscbuff";
|
|
||||||
|
|
||||||
shader = BL_ProjectedShadowShaderData;
|
|
||||||
stateBlock = BL_ProjectedShadowSBData;
|
|
||||||
version = 2.0;
|
|
||||||
forwardLit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
function onActivateBasicLM()
|
|
||||||
{
|
|
||||||
// If HDR is enabled... enable the special format token.
|
|
||||||
if ( $platform !$= "macos" && HDRPostFx.isEnabled )
|
|
||||||
AL_FormatToken.enable();
|
|
||||||
|
|
||||||
// Create render pass for projected shadow.
|
|
||||||
new RenderPassManager( BL_ProjectedShadowRPM );
|
|
||||||
|
|
||||||
// Create the mesh bin and add it to the manager.
|
|
||||||
%meshBin = new RenderMeshMgr();
|
|
||||||
BL_ProjectedShadowRPM.addManager( %meshBin );
|
|
||||||
|
|
||||||
// Add both to the root group so that it doesn't
|
|
||||||
// end up in the MissionCleanup instant group.
|
|
||||||
RootGroup.add( BL_ProjectedShadowRPM );
|
|
||||||
RootGroup.add( %meshBin );
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeactivateBasicLM()
|
|
||||||
{
|
|
||||||
// Delete the pass manager which also deletes the bin.
|
|
||||||
BL_ProjectedShadowRPM.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setBasicLighting()
|
|
||||||
{
|
|
||||||
setLightManager( "Basic Lighting" );
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +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( BL_ShadowFilterShaderV )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
|
|
||||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( BL_ShadowFilterShaderH : BL_ShadowFilterShaderV )
|
|
||||||
{
|
|
||||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( BL_ShadowFilterSB : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
colorWriteDefined=true;
|
|
||||||
colorWriteRed=false;
|
|
||||||
colorWriteGreen=false;
|
|
||||||
colorWriteBlue=false;
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This is ONLY used in Basic Lighting, and
|
|
||||||
// only directly by the ProjectedShadow. It is not
|
|
||||||
// meant to be manually enabled like other PostEffects.
|
|
||||||
singleton PostEffect( BL_ShadowFilterPostFx )
|
|
||||||
{
|
|
||||||
// Blur vertically
|
|
||||||
shader = BL_ShadowFilterShaderV;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
targetClear = "PFXTargetClear_OnDraw";
|
|
||||||
targetClearColor = "0 0 0 0";
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
|
|
||||||
// Blur horizontal
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = BL_ShadowFilterShaderH;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
@ -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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
new ShaderData(BlurDepthShader)
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterP.glsl";
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
@ -1,99 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Initialize core sub system functionality such as audio, the Canvas, PostFX,
|
|
||||||
// rendermanager, light managers, etc.
|
|
||||||
//
|
|
||||||
// Note that not all of these need to be initialized before the client, although
|
|
||||||
// the audio should and the canvas definitely needs to be. I've put things here
|
|
||||||
// to distinguish between the purpose and functionality of the various client
|
|
||||||
// scripts. Game specific script isn't needed until we reach the shell menus
|
|
||||||
// and start a game or connect to a server. We get the various subsystems ready
|
|
||||||
// to go, and then use initClient() to handle the rest of the startup sequence.
|
|
||||||
//
|
|
||||||
// If this is too convoluted we can reduce this complexity after futher testing
|
|
||||||
// to find exactly which subsystems should be readied before kicking things off.
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//We need to hook the missing/warn material stuff early, so do it here
|
|
||||||
$Core::MissingTexturePath = "core/images/missingTexture";
|
|
||||||
$Core::UnAvailableTexturePath = "core/images/unavailable";
|
|
||||||
$Core::WarningTexturePath = "core/images/warnMat";
|
|
||||||
$Core::CommonShaderPath = "core/shaders";
|
|
||||||
|
|
||||||
ModuleDatabase.setModuleExtension("module");
|
|
||||||
|
|
||||||
//Core components
|
|
||||||
ModuleDatabase.scanModules( "core", false );
|
|
||||||
ModuleDatabase.LoadExplicit( "CoreComponentsModule" );
|
|
||||||
|
|
||||||
exec("./helperFunctions.cs");
|
|
||||||
|
|
||||||
// We need some of the default GUI profiles in order to get the canvas and
|
|
||||||
// other aspects of the GUI system ready.
|
|
||||||
exec("./profiles.cs");
|
|
||||||
|
|
||||||
//This is a bit of a shortcut, but we'll load the client's default settings to ensure all the prefs get initialized correctly
|
|
||||||
%prefPath = getPrefpath();
|
|
||||||
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
|
|
||||||
exec( %prefPath @ "/clientPrefs.cs" );
|
|
||||||
else
|
|
||||||
exec("data/defaults.cs");
|
|
||||||
|
|
||||||
%der = $pref::Video::displayDevice;
|
|
||||||
|
|
||||||
// Initialization of the various subsystems requires some of the preferences
|
|
||||||
// to be loaded... so do that first.
|
|
||||||
exec("./globals.cs");
|
|
||||||
|
|
||||||
exec("./canvas.cs");
|
|
||||||
exec("./cursor.cs");
|
|
||||||
|
|
||||||
exec("./renderManager.cs");
|
|
||||||
exec("./lighting.cs");
|
|
||||||
|
|
||||||
exec("./audio.cs");
|
|
||||||
exec("./sfx/audioAmbience.cs");
|
|
||||||
exec("./sfx/audioData.cs");
|
|
||||||
exec("./sfx/audioDescriptions.cs");
|
|
||||||
exec("./sfx/audioEnvironments.cs");
|
|
||||||
exec("./sfx/audioStates.cs");
|
|
||||||
|
|
||||||
exec("./parseArgs.cs");
|
|
||||||
|
|
||||||
// Materials and Shaders for rendering various object types
|
|
||||||
exec("./gfxData/commonMaterialData.cs");
|
|
||||||
exec("./gfxData/shaders.cs");
|
|
||||||
exec("./gfxData/terrainBlock.cs");
|
|
||||||
exec("./gfxData/water.cs");
|
|
||||||
exec("./gfxData/scatterSky.cs");
|
|
||||||
exec("./gfxData/clouds.cs");
|
|
||||||
|
|
||||||
// Initialize all core post effects.
|
|
||||||
exec("./postFx.cs");
|
|
||||||
|
|
||||||
//VR stuff
|
|
||||||
exec("./oculusVR.cs");
|
|
||||||
|
|
||||||
// Seed the random number generator.
|
|
||||||
setRandomSeed();
|
|
||||||
|
|
@ -1,248 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Only load these functions if an Oculus VR device is present
|
|
||||||
if(!isFunction(isOculusVRDeviceActive))
|
|
||||||
return;
|
|
||||||
|
|
||||||
function setupOculusActionMaps()
|
|
||||||
{
|
|
||||||
if (isObject(OculusWarningMap))
|
|
||||||
return;
|
|
||||||
|
|
||||||
new ActionMap(OculusWarningMap);
|
|
||||||
new ActionMap(OculusCanvasMap);
|
|
||||||
|
|
||||||
OculusWarningMap.bind(keyboard, space, dismissOculusVRWarnings);
|
|
||||||
|
|
||||||
OculusCanvasMap.bind( mouse, xaxis, oculusYaw );
|
|
||||||
OculusCanvasMap.bind( mouse, yaxis, oculusPitch );
|
|
||||||
OculusCanvasMap.bind( mouse, button0, oculusClick );
|
|
||||||
}
|
|
||||||
|
|
||||||
function oculusYaw(%val)
|
|
||||||
{
|
|
||||||
OculusCanvas.cursorNudge(%val * 0.10, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function oculusPitch(%val)
|
|
||||||
{
|
|
||||||
OculusCanvas.cursorNudge(0, %val * 0.10);
|
|
||||||
}
|
|
||||||
|
|
||||||
function oculusClick(%active)
|
|
||||||
{
|
|
||||||
OculusCanvas.cursorClick(0, %active);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiOffscreenCanvas::checkCursor(%this)
|
|
||||||
{
|
|
||||||
%count = %this.getCount();
|
|
||||||
for(%i = 0; %i < %count; %i++)
|
|
||||||
{
|
|
||||||
%control = %this.getObject(%i);
|
|
||||||
if ((%control.noCursor $= "") || !%control.noCursor)
|
|
||||||
{
|
|
||||||
%this.cursorOn();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we get here, every control requested a hidden cursor, so we oblige.
|
|
||||||
|
|
||||||
%this.cursorOff();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiOffscreenCanvas::pushDialog(%this, %ctrl, %layer, %center)
|
|
||||||
{
|
|
||||||
Parent::pushDialog(%this, %ctrl, %layer, %center);
|
|
||||||
%cursorVisible = %this.checkCursor();
|
|
||||||
|
|
||||||
if (%cursorVisible)
|
|
||||||
{
|
|
||||||
echo("OffscreenCanvas visible");
|
|
||||||
OculusCanvasMap.pop();
|
|
||||||
OculusCanvasMap.push();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo("OffscreenCanvas not visible");
|
|
||||||
OculusCanvasMap.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiOffscreenCanvas::popDialog(%this, %ctrl)
|
|
||||||
{
|
|
||||||
Parent::popDialog(%this, %ctrl);
|
|
||||||
%cursorVisible = %this.checkCursor();
|
|
||||||
|
|
||||||
if (%cursorVisible)
|
|
||||||
{
|
|
||||||
echo("OffscreenCanvas visible");
|
|
||||||
OculusCanvasMap.pop();
|
|
||||||
OculusCanvasMap.push();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo("OffscreenCanvas not visible");
|
|
||||||
OculusCanvasMap.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function oculusSensorMetricsCallback()
|
|
||||||
{
|
|
||||||
return ovrDumpMetrics(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
function onOculusStatusUpdate(%status)
|
|
||||||
{
|
|
||||||
$LastOculusTrackingState = %status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Call this function from createCanvas() to have the Canvas attach itself
|
|
||||||
// to the Rift's display. The Canvas' window will still open on the primary
|
|
||||||
// display if that is different from the Rift, but it will move to the Rift
|
|
||||||
// when it goes full screen. If the Rift is not connected then nothing
|
|
||||||
// will happen.
|
|
||||||
function pointCanvasToOculusVRDisplay()
|
|
||||||
{
|
|
||||||
$pref::Video::displayOutputDevice = getOVRHMDDisplayDeviceName(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Call this function from GameConnection::initialControlSet() just before
|
|
||||||
// your "Canvas.setContent(PlayGui);" call, or at any time you wish to switch
|
|
||||||
// to a side-by-side rendering and the appropriate barrel distortion. This
|
|
||||||
// will turn on side-by-side rendering and tell the GameConnection to use the
|
|
||||||
// Rift as its display device.
|
|
||||||
// Parameters:
|
|
||||||
// %gameConnection - The client GameConnection instance
|
|
||||||
// %trueStereoRendering - If true will enable stereo rendering with an eye
|
|
||||||
// offset for each viewport. This will render each frame twice. If false
|
|
||||||
// then a pseudo stereo rendering is done with only a single render per frame.
|
|
||||||
function enableOculusVRDisplay(%gameConnection, %trueStereoRendering)
|
|
||||||
{
|
|
||||||
setOVRHMDAsGameConnectionDisplayDevice(%gameConnection);
|
|
||||||
PlayGui.renderStyle = "stereo side by side";
|
|
||||||
setOptimalOVRCanvasSize(Canvas);
|
|
||||||
|
|
||||||
if (!isObject(OculusCanvas))
|
|
||||||
{
|
|
||||||
new GuiOffscreenCanvas(OculusCanvas) {
|
|
||||||
targetSize = "512 512";
|
|
||||||
targetName = "oculusCanvas";
|
|
||||||
dynamicTarget = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isObject(OculusVROverlay))
|
|
||||||
{
|
|
||||||
exec("./oculusVROverlay.gui");
|
|
||||||
}
|
|
||||||
|
|
||||||
OculusCanvas.setContent(OculusVROverlay);
|
|
||||||
OculusCanvas.setCursor(DefaultCursor);
|
|
||||||
PlayGui.setStereoGui(OculusCanvas);
|
|
||||||
OculusCanvas.setCursorPos("128 128");
|
|
||||||
OculusCanvas.cursorOff();
|
|
||||||
$GameCanvas = OculusCanvas;
|
|
||||||
|
|
||||||
%ext = Canvas.getExtent();
|
|
||||||
$OculusMouseScaleX = 512.0 / 1920.0;
|
|
||||||
$OculusMouseScaleY = 512.0 / 1060.0;
|
|
||||||
|
|
||||||
//$gfx::wireframe = true;
|
|
||||||
// Reset all sensors
|
|
||||||
ovrResetAllSensors();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call this function when ever you wish to turn off the stereo rendering
|
|
||||||
// and barrel distortion for the Rift.
|
|
||||||
function disableOculusVRDisplay(%gameConnection)
|
|
||||||
{
|
|
||||||
OculusCanvas.popDialog();
|
|
||||||
OculusWarningMap.pop();
|
|
||||||
$GameCanvas = Canvas;
|
|
||||||
|
|
||||||
if (isObject(gameConnection))
|
|
||||||
{
|
|
||||||
%gameConnection.clearDisplayDevice();
|
|
||||||
}
|
|
||||||
PlayGui.renderStyle = "standard";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to set the standard Rift control scheme. You could place
|
|
||||||
// this function in GameConnection::initialControlSet() at the same time
|
|
||||||
// you call enableOculusVRDisplay().
|
|
||||||
function setStandardOculusVRControlScheme(%gameConnection)
|
|
||||||
{
|
|
||||||
if($OculusVR::SimulateInput)
|
|
||||||
{
|
|
||||||
// We are simulating a HMD so allow the mouse and gamepad to control
|
|
||||||
// both yaw and pitch.
|
|
||||||
%gameConnection.setControlSchemeParameters(true, true, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// A HMD is connected so have the mouse and gamepad only add to yaw
|
|
||||||
%gameConnection.setControlSchemeParameters(true, true, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Helper function to set the resolution for the Rift.
|
|
||||||
// Parameters:
|
|
||||||
// %fullscreen - If true then the display will be forced to full screen. If
|
|
||||||
// pointCanvasToOculusVRDisplay() was called before the Canvas was created, then
|
|
||||||
// the full screen display will appear on the Rift.
|
|
||||||
function setVideoModeForOculusVRDisplay(%fullscreen)
|
|
||||||
{
|
|
||||||
%res = getOVRHMDResolution(0);
|
|
||||||
Canvas.setVideoMode(%res.x, %res.y, %fullscreen, 32, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Reset all Oculus Rift sensors. This will make the Rift's current heading
|
|
||||||
// be considered the origin.
|
|
||||||
function resetOculusVRSensors()
|
|
||||||
{
|
|
||||||
ovrResetAllSensors();
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissOculusVRWarnings(%value)
|
|
||||||
{
|
|
||||||
//if (%value)
|
|
||||||
//{
|
|
||||||
ovrDismissWarnings();
|
|
||||||
OculusWarningMap.pop();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
%guiContent = singleton GuiControl(OculusVROverlay) {
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
Enabled = "1";
|
|
||||||
isContainer = "1";
|
|
||||||
Profile = "GuiContentProfile";
|
|
||||||
HorizSizing = "width";
|
|
||||||
VertSizing = "height";
|
|
||||||
Position = "0 0";
|
|
||||||
Extent = "512 512";
|
|
||||||
MinExtent = "8 8";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
useVariable = "0";
|
|
||||||
tile = "0";
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,392 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Support functions used to manage the directory list
|
|
||||||
function pushFront(%list, %token, %delim)
|
|
||||||
{
|
|
||||||
if (%list !$= "")
|
|
||||||
return %token @ %delim @ %list;
|
|
||||||
return %token;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushBack(%list, %token, %delim)
|
|
||||||
{
|
|
||||||
if (%list !$= "")
|
|
||||||
return %list @ %delim @ %token;
|
|
||||||
return %token;
|
|
||||||
}
|
|
||||||
|
|
||||||
function popFront(%list, %delim)
|
|
||||||
{
|
|
||||||
return nextToken(%list, unused, %delim);
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseArgs()
|
|
||||||
{
|
|
||||||
for ($i = 1; $i < $Game::argc ; $i++)
|
|
||||||
{
|
|
||||||
$arg = $Game::argv[$i];
|
|
||||||
$nextArg = $Game::argv[$i+1];
|
|
||||||
$hasNextArg = $Game::argc - $i > 1;
|
|
||||||
$logModeSpecified = false;
|
|
||||||
|
|
||||||
// Check for dedicated run
|
|
||||||
/*if( stricmp($arg,"-dedicated") == 0 )
|
|
||||||
{
|
|
||||||
$userDirs = $defaultGame;
|
|
||||||
$dirCount = 1;
|
|
||||||
$isDedicated = true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
switch$ ($arg)
|
|
||||||
{
|
|
||||||
//--------------------
|
|
||||||
case "-dedicated":
|
|
||||||
$userDirs = $defaultGame;
|
|
||||||
$dirCount = 1;
|
|
||||||
$isDedicated = true;
|
|
||||||
$Server::Dedicated = true;
|
|
||||||
enableWinConsole(true);
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-mission":
|
|
||||||
$argUsed[%i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$missionArg = $nextArg;
|
|
||||||
$argUsed[%i+1]++;
|
|
||||||
%i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -mission <filename>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-connect":
|
|
||||||
$argUsed[%i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$JoinGameAddress = $nextArg;
|
|
||||||
$argUsed[%i+1]++;
|
|
||||||
%i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -connect <ip_address>");
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-log":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
// Turn on console logging
|
|
||||||
if ($nextArg != 0)
|
|
||||||
{
|
|
||||||
// Dump existing console to logfile first.
|
|
||||||
$nextArg += 4;
|
|
||||||
}
|
|
||||||
setLogMode($nextArg);
|
|
||||||
$logModeSpecified = true;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -log <Mode: 0,1,2>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-dir":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
// Append the mod to the end of the current list
|
|
||||||
$userDirs = strreplace($userDirs, $nextArg, "");
|
|
||||||
$userDirs = pushFront($userDirs, $nextArg, ";");
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
$dirCount++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -dir <dir_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
// changed the default behavior of this command line arg. It now
|
|
||||||
// defaults to ONLY loading the game, not tools
|
|
||||||
// default auto-run already loads in tools --SRZ 11/29/07
|
|
||||||
case "-game":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
// Set the selected dir --NOTE: we no longer allow tools with this argument
|
|
||||||
/*
|
|
||||||
if( $isDedicated )
|
|
||||||
{
|
|
||||||
$userDirs = $nextArg;
|
|
||||||
$dirCount = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$userDirs = "tools;" @ $nextArg;
|
|
||||||
$dirCount = 2;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$userDirs = $nextArg;
|
|
||||||
$dirCount = 1;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
error($userDirs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -game <game_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-console":
|
|
||||||
enableWinConsole(true);
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-jSave":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
echo("Saving event log to journal: " @ $nextArg);
|
|
||||||
saveJournal($nextArg);
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -jSave <journal_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-jPlay":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
playJournal($nextArg);
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -jPlay <journal_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-jPlayToVideo":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$VideoCapture::journalName = $nextArg;
|
|
||||||
$VideoCapture::captureFromJournal = true;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -jPlayToVideo <journal_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-vidCapFile":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$VideoCapture::fileName = $nextArg;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -vidCapFile <ouput_video_name>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-vidCapFPS":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$VideoCapture::fps = $nextArg;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -vidCapFPS <ouput_video_framerate>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-vidCapEncoder":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$VideoCapture::encoder = $nextArg;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -vidCapEncoder <ouput_video_encoder>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-vidCapWidth":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$videoCapture::width = $nextArg;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -vidCapWidth <ouput_video_width>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-vidCapHeight":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
$videoCapture::height = $nextArg;
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -vidCapHeight <ouput_video_height>");
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
case "-level":
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if ($hasNextArg)
|
|
||||||
{
|
|
||||||
%hasExt = strpos($nextArg, ".mis");
|
|
||||||
if(%hasExt == -1)
|
|
||||||
{
|
|
||||||
$levelToLoad = $nextArg @ " ";
|
|
||||||
|
|
||||||
for(%i = $i + 2; %i < $Game::argc; %i++)
|
|
||||||
{
|
|
||||||
$arg = $Game::argv[%i];
|
|
||||||
%hasExt = strpos($arg, ".mis");
|
|
||||||
|
|
||||||
if(%hasExt == -1)
|
|
||||||
{
|
|
||||||
$levelToLoad = $levelToLoad @ $arg @ " ";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$levelToLoad = $levelToLoad @ $arg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$levelToLoad = $nextArg;
|
|
||||||
}
|
|
||||||
|
|
||||||
$argUsed[$i+1]++;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -level <level file name (no path), with or without extension>");
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-worldeditor":
|
|
||||||
$startWorldEditor = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-guieditor":
|
|
||||||
$startGUIEditor = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-help":
|
|
||||||
$displayHelp = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-compileAll":
|
|
||||||
$compileAll = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-compileTools":
|
|
||||||
$compileTools = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
case "-genScript":
|
|
||||||
$genScript = true;
|
|
||||||
$argUsed[$i]++;
|
|
||||||
|
|
||||||
case "-fullscreen":
|
|
||||||
$cliFullscreen = true;
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
case "-windowed":
|
|
||||||
$cliFullscreen = false;
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
case "-openGL":
|
|
||||||
$pref::Video::displayDevice = "OpenGL";
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
case "-directX":
|
|
||||||
$pref::Video::displayDevice = "D3D";
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
case "-autoVideo":
|
|
||||||
$pref::Video::displayDevice = "";
|
|
||||||
$argUsed[%i]++;
|
|
||||||
|
|
||||||
case "-prefs":
|
|
||||||
$argUsed[%i]++;
|
|
||||||
if ($hasNextArg) {
|
|
||||||
exec($nextArg, true, true);
|
|
||||||
$argUsed[%i+1]++;
|
|
||||||
%i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error("Error: Missing Command Line argument. Usage: -prefs <path/script.cs>");
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------
|
|
||||||
default:
|
|
||||||
$argUsed[$i]++;
|
|
||||||
if($userDirs $= "")
|
|
||||||
$userDirs = $arg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
|
||||||
// Play journal to video file?
|
|
||||||
if ($VideoCapture::captureFromJournal && $VideoCapture::journalName !$= "")
|
|
||||||
{
|
|
||||||
if ($VideoCapture::fileName $= "")
|
|
||||||
$VideoCapture::fileName = $VideoCapture::journalName;
|
|
||||||
|
|
||||||
if ($VideoCapture::encoder $= "")
|
|
||||||
$VideoCapture::encoder = "THEORA";
|
|
||||||
|
|
||||||
if ($VideoCapture::fps $= "")
|
|
||||||
$VideoCapture::fps = 30;
|
|
||||||
|
|
||||||
if ($videoCapture::width $= "")
|
|
||||||
$videoCapture::width = 0;
|
|
||||||
|
|
||||||
if ($videoCapture::height $= "")
|
|
||||||
$videoCapture::height = 0;
|
|
||||||
|
|
||||||
playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName,
|
|
||||||
$VideoCapture::encoder, $VideoCapture::fps,
|
|
||||||
$videoCapture::width SPC $videoCapture::height );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +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( GammaShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gammaP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/gammaP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
samplerNames[1] = "$colorCorrectionTex";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( GammaStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( GammaPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = true;
|
|
||||||
allowReflectPass = true;
|
|
||||||
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "EditorBin";
|
|
||||||
renderPriority = 9998;
|
|
||||||
|
|
||||||
shader = GammaShader;
|
|
||||||
stateBlock = GammaStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = $HDRPostFX::colorCorrectionRamp;
|
|
||||||
textureSRGB[1] = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
function GammaPostFX::preProcess( %this )
|
|
||||||
{
|
|
||||||
if ( %this.texture[1] !$= $HDRPostFX::colorCorrectionRamp )
|
|
||||||
%this.setTexture( 1, $HDRPostFX::colorCorrectionRamp );
|
|
||||||
}
|
|
||||||
|
|
||||||
function GammaPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5);
|
|
||||||
%this.setShaderConst( "$OneOverGamma", 1 / %clampedGamma );
|
|
||||||
%this.setShaderConst( "$Brightness", $pref::Video::Brightness );
|
|
||||||
%this.setShaderConst( "$Contrast", $pref::Video::Contrast );
|
|
||||||
}
|
|
||||||
|
|
@ -1,186 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// An implementation of "Practical Morphological Anti-Aliasing" from
|
|
||||||
// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria,
|
|
||||||
// Fernando Navarro, and Diego Gutierrez.
|
|
||||||
//
|
|
||||||
// http://www.iryoku.com/mlaa/
|
|
||||||
|
|
||||||
// NOTE: This is currently disabled in favor of FXAA. See
|
|
||||||
// core\scripts\client\canvas.cs if you want to re-enable it.
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( MLAA_EdgeDetectStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
// Mark the edge pixels in stencil.
|
|
||||||
stencilDefined = true;
|
|
||||||
stencilEnable = true;
|
|
||||||
stencilPassOp = GFXStencilOpReplace;
|
|
||||||
stencilFunc = GFXCmpAlways;
|
|
||||||
stencilRef = 1;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( MLAA_EdgeDetectionShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/edgeDetectionP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/edgeDetectionP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorMapG";
|
|
||||||
samplerNames[1] = "$deferredMap";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( MLAA_BlendWeightCalculationStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
// Here we want to process only marked pixels.
|
|
||||||
stencilDefined = true;
|
|
||||||
stencilEnable = true;
|
|
||||||
stencilPassOp = GFXStencilOpKeep;
|
|
||||||
stencilFunc = GFXCmpEqual;
|
|
||||||
stencilRef = 1;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
samplerStates[2] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( MLAA_BlendWeightCalculationShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/passthruV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/blendWeightCalculationP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/passthruV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/blendWeightCalculationP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$edgesMap";
|
|
||||||
samplerNames[1] = "$edgesMapL";
|
|
||||||
samplerNames[2] = "$areaMap";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( MLAA_NeighborhoodBlendingStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
// Here we want to process only marked pixels too.
|
|
||||||
stencilDefined = true;
|
|
||||||
stencilEnable = true;
|
|
||||||
stencilPassOp = GFXStencilOpKeep;
|
|
||||||
stencilFunc = GFXCmpEqual;
|
|
||||||
stencilRef = 1;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
samplerStates[2] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( MLAA_NeighborhoodBlendingShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/neighborhoodBlendingP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/neighborhoodBlendingP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$blendMap";
|
|
||||||
samplerNames[1] = "$colorMapL";
|
|
||||||
samplerNames[2] = "$colorMap";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton PostEffect( MLAAFx )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
|
|
||||||
allowReflectPass = false;
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer"; //colorMapG
|
|
||||||
texture[1] = "#deferred"; // Used for depth detection
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
targetClear = PFXTargetClear_OnDraw;
|
|
||||||
targetClearColor = "0 0 0 0";
|
|
||||||
|
|
||||||
stateBlock = MLAA_EdgeDetectStateBlock;
|
|
||||||
shader = MLAA_EdgeDetectionShader;
|
|
||||||
|
|
||||||
// The luma calculation weights which can be user adjustable
|
|
||||||
// per-scene if nessasary. The default value of...
|
|
||||||
//
|
|
||||||
// 0.2126 0.7152 0.0722
|
|
||||||
//
|
|
||||||
// ... is the HDTV ITU-R Recommendation BT. 709.
|
|
||||||
lumaCoefficients = "0.2126 0.7152 0.0722";
|
|
||||||
|
|
||||||
// The tweakable color threshold used to select
|
|
||||||
// the range of edge pixels to blend.
|
|
||||||
threshold = 0.1;
|
|
||||||
|
|
||||||
// The depth delta threshold used to select
|
|
||||||
// the range of edge pixels to blend.
|
|
||||||
depthThreshold = 0.01;
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "blendingWeightsCalculation";
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
targetClear = PFXTargetClear_OnDraw;
|
|
||||||
|
|
||||||
shader = MLAA_BlendWeightCalculationShader;
|
|
||||||
stateBlock = MLAA_BlendWeightCalculationStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex"; // Edges mask
|
|
||||||
texture[1] = "$inTex"; // Edges mask
|
|
||||||
texture[2] = "core/images/AreaMap33.dds";
|
|
||||||
};
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "neighborhoodBlending";
|
|
||||||
|
|
||||||
shader = MLAA_NeighborhoodBlendingShader;
|
|
||||||
stateBlock = MLAA_NeighborhoodBlendingStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex"; // Blend weights
|
|
||||||
texture[1] = "$backBuffer";
|
|
||||||
texture[2] = "$backBuffer";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function MLAAFx::setShaderConsts(%this)
|
|
||||||
{
|
|
||||||
%this.setShaderConst("$lumaCoefficients", %this.lumaCoefficients);
|
|
||||||
%this.setShaderConst("$threshold", %this.threshold);
|
|
||||||
%this.setShaderConst("$depthThreshold", %this.depthThreshold);
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +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( PFX_MotionBlurShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; //we use the bare-bones postFxV.hlsl
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/motionBlurP.hlsl"; //new pixel shader
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
samplerNames[1] = "$deferredTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect(MotionBlurFX)
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
|
|
||||||
shader = PFX_MotionBlurShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "$backbuffer";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
function MotionBlurFX::setShaderConsts(%this)
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$velocityMultiplier", 3000 );
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +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 GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendOne;
|
|
||||||
blendDest = GFXBlendOne;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerWrapLinear;
|
|
||||||
samplerStates[2] = SamplerWrapLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_CausticsShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/causticsP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredTex";
|
|
||||||
samplerNames[1] = "$causticsTex0";
|
|
||||||
samplerNames[2] = "$causticsTex1";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( CausticsPFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
renderBin = "ObjTranslucentBin";
|
|
||||||
//renderPriority = 0.1;
|
|
||||||
|
|
||||||
shader = PFX_CausticsShader;
|
|
||||||
stateBlock = PFX_CausticsStateBlock;
|
|
||||||
texture[0] = "#deferred";
|
|
||||||
texture[1] = "core/images/caustics_1";
|
|
||||||
texture[2] = "core/images/caustics_2";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
@ -1,77 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
///
|
|
||||||
$CAPostFx::enabled = false;
|
|
||||||
|
|
||||||
/// The lens distortion coefficient.
|
|
||||||
$CAPostFx::distCoeffecient = -0.05;
|
|
||||||
|
|
||||||
/// The cubic distortion value.
|
|
||||||
$CAPostFx::cubeDistortionFactor = -0.1;
|
|
||||||
|
|
||||||
/// The amount and direction of the maxium shift for
|
|
||||||
/// the red, green, and blue channels.
|
|
||||||
$CAPostFx::colorDistortionFactor = "0.005 -0.005 0.01";
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DefaultChromaticLensStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_ChromaticLensShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/chromaticLens.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/chromaticLens.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( ChromaticLensPostFX )
|
|
||||||
{
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
renderPriority = 0.2;
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
shader = PFX_ChromaticLensShader;
|
|
||||||
stateBlock = PFX_DefaultChromaticLensStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
function ChromaticLensPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$distCoeff", $CAPostFx::distCoeffecient );
|
|
||||||
%this.setShaderConst( "$cubeDistort", $CAPostFx::cubeDistortionFactor );
|
|
||||||
%this.setShaderConst( "$colorDistort", $CAPostFx::colorDistortionFactor );
|
|
||||||
}
|
|
||||||
|
|
@ -1,72 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
$PostFXManager::Settings::EnableVignette = "1";
|
|
||||||
$PostFXManager::Settings::EnableDOF = "1";
|
|
||||||
$PostFXManager::Settings::EnabledSSAO = "1";
|
|
||||||
$PostFXManager::Settings::EnableHDR = "1";
|
|
||||||
$PostFXManager::Settings::EnableLightRays = "1";
|
|
||||||
$PostFXManager::Settings::EnablePostFX = "1";
|
|
||||||
$PostFXManager::Settings::Vignette::VMax = "0.6";
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveFar = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveNear = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurMax = "";
|
|
||||||
$PostFXManager::Settings::DOF::BlurMin = "";
|
|
||||||
$PostFXManager::Settings::DOF::EnableAutoFocus = "";
|
|
||||||
$PostFXManager::Settings::DOF::EnableDOF = "";
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMax = "";
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMin = "";
|
|
||||||
$PostFXManager::Settings::HDR::adaptRate = "2";
|
|
||||||
$PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27";
|
|
||||||
$PostFXManager::Settings::HDR::brightPassThreshold = "1";
|
|
||||||
$PostFXManager::Settings::HDR::enableBloom = "1";
|
|
||||||
$PostFXManager::Settings::HDR::enableBlueShift = "0";
|
|
||||||
$PostFXManager::Settings::HDR::enableToneMapping = "0.5";
|
|
||||||
$PostFXManager::Settings::HDR::gaussMean = "0";
|
|
||||||
$PostFXManager::Settings::HDR::gaussMultiplier = "0.3";
|
|
||||||
$PostFXManager::Settings::HDR::gaussStdDev = "0.8";
|
|
||||||
$PostFXManager::Settings::HDR::keyValue = "0.18";
|
|
||||||
$PostFXManager::Settings::HDR::minLuminace = "0.001";
|
|
||||||
$PostFXManager::Settings::HDR::whiteCutoff = "1";
|
|
||||||
$PostFXManager::Settings::LightRays::brightScalar = "0.75";
|
|
||||||
$PostFXManager::Settings::LightRays::decay = "1.0";
|
|
||||||
$PostFXManager::Settings::LightRays::density = "0.94";
|
|
||||||
$PostFXManager::Settings::LightRays::numSamples = "40";
|
|
||||||
$PostFXManager::Settings::LightRays::weight = "5.65";
|
|
||||||
$PostFXManager::Settings::SSAO::blurDepthTol = "0.001";
|
|
||||||
$PostFXManager::Settings::SSAO::blurNormalTol = "0.95";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMax = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMin = "0.2";
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthPow = "0.2";
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalPow = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalTol = "-0.5";
|
|
||||||
$PostFXManager::Settings::SSAO::lRadius = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::lStrength = "10";
|
|
||||||
$PostFXManager::Settings::SSAO::overallStrength = "2";
|
|
||||||
$PostFXManager::Settings::SSAO::quality = "0";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMax = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMin = "0.1";
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthPow = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalPow = "1";
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalTol = "0";
|
|
||||||
$PostFXManager::Settings::SSAO::sRadius = "0.1";
|
|
||||||
$PostFXManager::Settings::SSAO::sStrength = "6";
|
|
||||||
$PostFXManager::Settings::ColorCorrectionRamp = "core/images/null_color_ramp.png";
|
|
||||||
|
|
@ -1,599 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
The DOFPostEffect API
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
DOFPostEffect::setFocalDist( %dist )
|
|
||||||
|
|
||||||
@summary
|
|
||||||
This method is for manually controlling the focus distance. It will have no
|
|
||||||
effect if auto focus is currently enabled. Makes use of the parameters set by
|
|
||||||
setFocusParams.
|
|
||||||
|
|
||||||
@param dist
|
|
||||||
float distance in meters
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
DOFPostEffect::setAutoFocus( %enabled )
|
|
||||||
|
|
||||||
@summary
|
|
||||||
This method sets auto focus enabled or disabled. Makes use of the parameters set
|
|
||||||
by setFocusParams. When auto focus is enabled it determines the focal depth
|
|
||||||
by performing a raycast at the screen-center.
|
|
||||||
|
|
||||||
@param enabled
|
|
||||||
bool
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
DOFPostEffect::setFocusParams( %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope )
|
|
||||||
|
|
||||||
Set the parameters that control how the near and far equations are calculated
|
|
||||||
from the focal distance. If you are not using auto focus you will need to call
|
|
||||||
setFocusParams PRIOR to calling setFocalDist.
|
|
||||||
|
|
||||||
@param nearBlurMax
|
|
||||||
float between 0.0 and 1.0
|
|
||||||
The max allowed value of near blur.
|
|
||||||
|
|
||||||
@param farBlurMax
|
|
||||||
float between 0.0 and 1.0
|
|
||||||
The max allowed value of far blur.
|
|
||||||
|
|
||||||
@param minRange/maxRange
|
|
||||||
float in meters
|
|
||||||
The distance range around the focal distance that remains in focus is a lerp
|
|
||||||
between the min/maxRange using the normalized focal distance as the parameter.
|
|
||||||
The point is to allow the focal range to expand as you focus farther away since this is
|
|
||||||
visually appealing.
|
|
||||||
|
|
||||||
Note: since min/maxRange are lerped by the "normalized" focal distance it is
|
|
||||||
dependant on the visible distance set in your level.
|
|
||||||
|
|
||||||
@param nearSlope
|
|
||||||
float less than zero
|
|
||||||
The slope of the near equation. A small number causes bluriness to increase gradually
|
|
||||||
at distances closer than the focal distance. A large number causes bluriness to
|
|
||||||
increase quickly.
|
|
||||||
|
|
||||||
@param farSlope
|
|
||||||
float greater than zero
|
|
||||||
The slope of the far equation. A small number causes bluriness to increase gradually
|
|
||||||
at distances farther than the focal distance. A large number causes bluriness to
|
|
||||||
increase quickly.
|
|
||||||
|
|
||||||
Note: To rephrase, the min/maxRange parameters control how much area around the
|
|
||||||
focal distance is completely in focus where the near/farSlope parameters control
|
|
||||||
how quickly or slowly bluriness increases at distances outside of that range.
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Examples
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
Example1: Turn on DOF while zoomed in with a weapon.
|
|
||||||
|
|
||||||
NOTE: These are not real callbacks! Hook these up to your code where appropriate!
|
|
||||||
|
|
||||||
function onSniperZoom()
|
|
||||||
{
|
|
||||||
// Parameterize how you want DOF to look.
|
|
||||||
DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 );
|
|
||||||
|
|
||||||
// Turn on auto focus
|
|
||||||
DOFPostEffect.setAutoFocus( true );
|
|
||||||
|
|
||||||
// Turn on the PostEffect
|
|
||||||
DOFPostEffect.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSniperUnzoom()
|
|
||||||
{
|
|
||||||
// Turn off the PostEffect
|
|
||||||
DOFPostEffect.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
Example2: Manually control DOF with the mouse wheel.
|
|
||||||
|
|
||||||
// Somewhere on startup...
|
|
||||||
|
|
||||||
// Parameterize how you want DOF to look.
|
|
||||||
DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 );
|
|
||||||
|
|
||||||
// Turn off auto focus
|
|
||||||
DOFPostEffect.setAutoFocus( false );
|
|
||||||
|
|
||||||
// Turn on the PostEffect
|
|
||||||
DOFPostEffect.enable();
|
|
||||||
|
|
||||||
|
|
||||||
NOTE: These are not real callbacks! Hook these up to your code where appropriate!
|
|
||||||
|
|
||||||
function onMouseWheelUp()
|
|
||||||
{
|
|
||||||
// Since setFocalDist is really just a wrapper to assign to the focalDist
|
|
||||||
// dynamic field we can shortcut and increment it directly.
|
|
||||||
DOFPostEffect.focalDist += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseWheelDown()
|
|
||||||
{
|
|
||||||
DOFPostEffect.focalDist -= 8;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// This method is for manually controlling the focal distance. It will have no
|
|
||||||
/// effect if auto focus is currently enabled. Makes use of the parameters set by
|
|
||||||
/// setFocusParams.
|
|
||||||
function DOFPostEffect::setFocalDist( %this, %dist )
|
|
||||||
{
|
|
||||||
%this.focalDist = %dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This method sets auto focus enabled or disabled. Makes use of the parameters set
|
|
||||||
/// by setFocusParams. When auto focus is enabled it determine the focal depth
|
|
||||||
/// by performing a raycast at the screen-center.
|
|
||||||
function DOFPostEffect::setAutoFocus( %this, %enabled )
|
|
||||||
{
|
|
||||||
%this.autoFocusEnabled = %enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the parameters that control how the near and far equations are calculated
|
|
||||||
/// from the focal distance. If you are not using auto focus you will need to call
|
|
||||||
/// setFocusParams PRIOR to calling setFocalDist.
|
|
||||||
function DOFPostEffect::setFocusParams( %this, %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope )
|
|
||||||
{
|
|
||||||
%this.nearBlurMax = %nearBlurMax;
|
|
||||||
%this.farBlurMax = %farBlurMax;
|
|
||||||
%this.minRange = %minRange;
|
|
||||||
%this.maxRange = %maxRange;
|
|
||||||
%this.nearSlope = %nearSlope;
|
|
||||||
%this.farSlope = %farSlope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
More information...
|
|
||||||
|
|
||||||
This DOF technique is based on this paper:
|
|
||||||
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
1. Overview of how we represent "Depth of Field"
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
DOF is expressed as an amount of bluriness per pixel according to its depth.
|
|
||||||
We represented this by a piecewise linear curve depicted below.
|
|
||||||
|
|
||||||
Note: we also refer to "bluriness" as CoC ( circle of confusion ) which is the term
|
|
||||||
used in the basis paper and in photography.
|
|
||||||
|
|
||||||
|
|
||||||
X-axis (depth)
|
|
||||||
x = 0.0----------------------------------------------x = 1.0
|
|
||||||
|
|
||||||
Y-axis (bluriness)
|
|
||||||
y = 1.0
|
|
||||||
|
|
|
||||||
| ____(x1,y1) (x4,y4)____
|
|
||||||
| (ns,nb)\ <--Line1 line2---> /(fe,fb)
|
|
||||||
| \ /
|
|
||||||
| \(x2,y2) (x3,y3)/
|
|
||||||
| (ne,0)------(fs,0)
|
|
||||||
y = 0.0
|
|
||||||
|
|
||||||
|
|
||||||
I have labeled the "corners" of this graph with (Xn,Yn) to illustrate that
|
|
||||||
this is in fact a collection of line segments where the x/y of each point
|
|
||||||
corresponds to the key below.
|
|
||||||
|
|
||||||
key:
|
|
||||||
ns - (n)ear blur (s)tart distance
|
|
||||||
nb - (n)ear (b)lur amount (max value)
|
|
||||||
ne - (n)ear blur (e)nd distance
|
|
||||||
fs - (f)ar blur (s)tart distance
|
|
||||||
fe - (f)ar blur (e)nd distance
|
|
||||||
fb - (f)ar (b)lur amount (max value)
|
|
||||||
|
|
||||||
Of greatest importance in this graph is Line1 and Line2. Where...
|
|
||||||
L1 { (x1,y1), (x2,y2) }
|
|
||||||
L2 { (x3,y3), (x4,y4) }
|
|
||||||
|
|
||||||
Line one represents the amount of "near" blur given a pixels depth and line two
|
|
||||||
represents the amount of "far" blur at that depth.
|
|
||||||
|
|
||||||
Both these equations are evaluated for each pixel and then the larger of the two
|
|
||||||
is kept. Also the output blur (for each equation) is clamped between 0 and its
|
|
||||||
maximum allowable value.
|
|
||||||
|
|
||||||
Therefore, to specify a DOF "qualify" you need to specify the near-blur-line,
|
|
||||||
far-blur-line, and maximum near and far blur value.
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
2. Abstracting a "focal depth"
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
Although the shader(s) work in terms of a near and far equation it is more
|
|
||||||
useful to express DOF as an adjustable focal depth and derive the other parameters
|
|
||||||
"under the hood".
|
|
||||||
|
|
||||||
Given a maximum near/far blur amount and a near/far slope we can calculate the
|
|
||||||
near/far equations for any focal depth. We extend this to also support a range
|
|
||||||
of depth around the focal depth that is also in focus and for that range to
|
|
||||||
shrink or grow as the focal depth moves closer or farther.
|
|
||||||
|
|
||||||
Keep in mind this is only one implementation and depending on the effect you
|
|
||||||
desire you may which to express the relationship between focal depth and
|
|
||||||
the shader paramaters different.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// GFXStateBlockData / ShaderData
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DefaultDOFStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DOFCalcCoCStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DOFDownSampleStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DOFBlurStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_DOFFinalStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
samplerStates[2] = SamplerClampLinear;
|
|
||||||
samplerStates[3] = SamplerClampPoint;
|
|
||||||
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendDest = GFXBlendInvSrcAlpha;
|
|
||||||
blendSrc = GFXBlendOne;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFDownSampleShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorSampler";
|
|
||||||
samplerNames[1] = "$depthSampler";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFBlurYShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFBlurXShader : PFX_DOFBlurYShader )
|
|
||||||
{
|
|
||||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFCalcCoCShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$shrunkSampler";
|
|
||||||
samplerNames[1] = "$blurredSampler";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFSmallBlurShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorSampler";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_DOFFinalShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorSampler";
|
|
||||||
samplerNames[1] = "$smallBlurSampler";
|
|
||||||
samplerNames[2] = "$largeBlurSampler";
|
|
||||||
samplerNames[3] = "$depthSampler";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// PostEffects
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function DOFPostEffect::onAdd( %this )
|
|
||||||
{
|
|
||||||
// The weighted distribution of CoC value to the three blur textures
|
|
||||||
// in the order small, medium, large. Most likely you will not need to
|
|
||||||
// change this value.
|
|
||||||
%this.setLerpDist( 0.2, 0.3, 0.5 );
|
|
||||||
|
|
||||||
// Fill out some default values but DOF really should not be turned on
|
|
||||||
// without actually specifying your own parameters!
|
|
||||||
%this.autoFocusEnabled = false;
|
|
||||||
%this.focalDist = 0.0;
|
|
||||||
%this.nearBlurMax = 0.5;
|
|
||||||
%this.farBlurMax = 0.5;
|
|
||||||
%this.minRange = 50;
|
|
||||||
%this.maxRange = 500;
|
|
||||||
%this.nearSlope = -5.0;
|
|
||||||
%this.farSlope = 5.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function DOFPostEffect::setLerpDist( %this, %d0, %d1, %d2 )
|
|
||||||
{
|
|
||||||
%this.lerpScale = -1.0 / %d0 SPC -1.0 / %d1 SPC -1.0 / %d2 SPC 1.0 / %d2;
|
|
||||||
%this.lerpBias = 1.0 SPC ( 1.0 - %d2 ) / %d1 SPC 1.0 / %d2 SPC ( %d2 - 1.0 ) / %d2;
|
|
||||||
}
|
|
||||||
|
|
||||||
singleton PostEffect( DOFPostEffect )
|
|
||||||
{
|
|
||||||
renderTime = "PFXAfterBin";
|
|
||||||
renderBin = "GlowBin";
|
|
||||||
renderPriority = 0.1;
|
|
||||||
|
|
||||||
shader = PFX_DOFDownSampleShader;
|
|
||||||
stateBlock = PFX_DOFDownSampleStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
target = "#shrunk";
|
|
||||||
targetScale = "0.25 0.25";
|
|
||||||
|
|
||||||
isEnabled = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( DOFBlurY )
|
|
||||||
{
|
|
||||||
shader = PFX_DOFBlurYShader;
|
|
||||||
stateBlock = PFX_DOFBlurStateBlock;
|
|
||||||
texture[0] = "#shrunk";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
DOFPostEffect.add( DOFBlurY );
|
|
||||||
|
|
||||||
singleton PostEffect( DOFBlurX )
|
|
||||||
{
|
|
||||||
shader = PFX_DOFBlurXShader;
|
|
||||||
stateBlock = PFX_DOFBlurStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "#largeBlur";
|
|
||||||
};
|
|
||||||
|
|
||||||
DOFPostEffect.add( DOFBlurX );
|
|
||||||
|
|
||||||
singleton PostEffect( DOFCalcCoC )
|
|
||||||
{
|
|
||||||
shader = PFX_DOFCalcCoCShader;
|
|
||||||
stateBlock = PFX_DOFCalcCoCStateBlock;
|
|
||||||
texture[0] = "#shrunk";
|
|
||||||
texture[1] = "#largeBlur";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
DOFPostEffect.add( DOFCalcCoc );
|
|
||||||
|
|
||||||
singleton PostEffect( DOFSmallBlur )
|
|
||||||
{
|
|
||||||
shader = PFX_DOFSmallBlurShader;
|
|
||||||
stateBlock = PFX_DefaultDOFStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
DOFPostEffect.add( DOFSmallBlur );
|
|
||||||
|
|
||||||
singleton PostEffect( DOFFinalPFX )
|
|
||||||
{
|
|
||||||
shader = PFX_DOFFinalShader;
|
|
||||||
stateBlock = PFX_DOFFinalStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = "$inTex";
|
|
||||||
texture[2] = "#largeBlur";
|
|
||||||
texture[3] = "#deferred";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
DOFPostEffect.add( DOFFinalPFX );
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Scripts
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function DOFPostEffect::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
if ( %this.autoFocusEnabled )
|
|
||||||
%this.autoFocus();
|
|
||||||
|
|
||||||
%fd = %this.focalDist / $Param::FarDist;
|
|
||||||
|
|
||||||
%range = mLerp( %this.minRange, %this.maxRange, %fd ) / $Param::FarDist * 0.5;
|
|
||||||
|
|
||||||
// We work in "depth" space rather than real-world units for the
|
|
||||||
// rest of this method...
|
|
||||||
|
|
||||||
// Given the focal distance and the range around it we want in focus
|
|
||||||
// we can determine the near-end-distance and far-start-distance
|
|
||||||
|
|
||||||
%ned = getMax( %fd - %range, 0.0 );
|
|
||||||
%fsd = getMin( %fd + %range, 1.0 );
|
|
||||||
|
|
||||||
// near slope
|
|
||||||
%nsl = %this.nearSlope;
|
|
||||||
|
|
||||||
// Given slope of near blur equation and the near end dist and amount (x2,y2)
|
|
||||||
// solve for the y-intercept
|
|
||||||
// y = mx + b
|
|
||||||
// so...
|
|
||||||
// y - mx = b
|
|
||||||
|
|
||||||
%b = 0.0 - %nsl * %ned;
|
|
||||||
|
|
||||||
%eqNear = %nsl SPC %b SPC 0.0;
|
|
||||||
|
|
||||||
// Do the same for the far blur equation...
|
|
||||||
|
|
||||||
%fsl = %this.farSlope;
|
|
||||||
|
|
||||||
%b = 0.0 - %fsl * %fsd;
|
|
||||||
|
|
||||||
%eqFar = %fsl SPC %b SPC 1.0;
|
|
||||||
|
|
||||||
%this.setShaderConst( "$dofEqWorld", %eqNear );
|
|
||||||
DOFFinalPFX.setShaderConst( "$dofEqFar", %eqFar );
|
|
||||||
|
|
||||||
%this.setShaderConst( "$maxWorldCoC", %this.nearBlurMax );
|
|
||||||
DOFFinalPFX.setShaderConst( "$maxFarCoC", %this.farBlurMax );
|
|
||||||
|
|
||||||
DOFFinalPFX.setShaderConst( "$dofLerpScale", %this.lerpScale );
|
|
||||||
DOFFinalPFX.setShaderConst( "$dofLerpBias", %this.lerpBias );
|
|
||||||
}
|
|
||||||
|
|
||||||
function DOFPostEffect::autoFocus( %this )
|
|
||||||
{
|
|
||||||
if ( !isObject( ServerConnection ) ||
|
|
||||||
!isObject( ServerConnection.getCameraObject() ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
%mask = $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType;
|
|
||||||
%control = ServerConnection.getCameraObject();
|
|
||||||
|
|
||||||
%fvec = %control.getEyeVector();
|
|
||||||
%start = %control.getEyePoint();
|
|
||||||
|
|
||||||
%end = VectorAdd( %start, VectorScale( %fvec, $Param::FarDist ) );
|
|
||||||
|
|
||||||
// Use the client container for this ray cast.
|
|
||||||
%result = containerRayCast( %start, %end, %mask, %control, true );
|
|
||||||
|
|
||||||
%hitPos = getWords( %result, 1, 3 );
|
|
||||||
|
|
||||||
if ( %hitPos $= "" )
|
|
||||||
%focDist = $Param::FarDist;
|
|
||||||
else
|
|
||||||
%focDist = VectorDist( %hitPos, %start );
|
|
||||||
|
|
||||||
// For debuging
|
|
||||||
//$DOF::debug_dist = %focDist;
|
|
||||||
//$DOF::debug_depth = %focDist / $Param::FarDist;
|
|
||||||
//echo( "F: " @ %focDist SPC "D: " @ %delta );
|
|
||||||
|
|
||||||
%this.focalDist = %focDist;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// For debugging
|
|
||||||
/*
|
|
||||||
function reloadDOF()
|
|
||||||
{
|
|
||||||
exec( "./dof.cs" );
|
|
||||||
DOFPostEffect.reload();
|
|
||||||
DOFPostEffect.disable();
|
|
||||||
DOFPostEffect.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function dofMetricsCallback()
|
|
||||||
{
|
|
||||||
return " | DOF |" @
|
|
||||||
" Dist: " @ $DOF::debug_dist @
|
|
||||||
" Depth: " @ $DOF::debug_depth;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
@ -1,113 +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 GFXStateBlockData( PFX_DefaultEdgeAAStateBlock )
|
|
||||||
{
|
|
||||||
zDefined = true;
|
|
||||||
zEnable = false;
|
|
||||||
zWriteEnable = false;
|
|
||||||
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
//samplerStates[1] = SamplerWrapPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_EdgeAADetectShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeDetectP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_EdgeAAShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$edgeBuffer";
|
|
||||||
samplerNames[1] = "$backBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_EdgeAADebugShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/dbgEdgeDisplayP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$edgeBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( EdgeDetectPostEffect )
|
|
||||||
{
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "ObjTranslucentBin";
|
|
||||||
//renderPriority = 0.1;
|
|
||||||
targetScale = "0.5 0.5";
|
|
||||||
|
|
||||||
shader = PFX_EdgeAADetectShader;
|
|
||||||
stateBlock = PFX_DefaultEdgeAAStateBlock;
|
|
||||||
texture[0] = "#deferred";
|
|
||||||
target = "#edge";
|
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( EdgeAAPostEffect )
|
|
||||||
{
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
//renderBin = "ObjTranslucentBin";
|
|
||||||
//renderPriority = 0.1;
|
|
||||||
|
|
||||||
shader = PFX_EdgeAAShader;
|
|
||||||
stateBlock = PFX_DefaultEdgeAAStateBlock;
|
|
||||||
texture[0] = "#edge";
|
|
||||||
texture[1] = "$backBuffer";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( Debug_EdgeAAPostEffect )
|
|
||||||
{
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
//renderBin = "ObjTranslucentBin";
|
|
||||||
//renderPriority = 0.1;
|
|
||||||
|
|
||||||
shader = PFX_EdgeAADebugShader;
|
|
||||||
stateBlock = PFX_DefaultEdgeAAStateBlock;
|
|
||||||
texture[0] = "#edge";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
|
|
@ -1,63 +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( PFX_FlashShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/flashP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/flashP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
|
|
||||||
defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( FlashFx )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
|
|
||||||
shader = PFX_FlashShader;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
renderPriority = 10;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
};
|
|
||||||
|
|
||||||
function FlashFx::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
if ( isObject( ServerConnection ) )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$damageFlash", ServerConnection.getDamageFlash() );
|
|
||||||
%this.setShaderConst( "$whiteOut", ServerConnection.getWhiteOut() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$damageFlash", 0 );
|
|
||||||
%this.setShaderConst( "$whiteOut", 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,135 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// Fog
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( FogPassShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fogP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredTex";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( FogPassStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendSrcAlpha;
|
|
||||||
blendDest = GFXBlendInvSrcAlpha;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton PostEffect( FogPostFx )
|
|
||||||
{
|
|
||||||
// We forward render the reflection pass
|
|
||||||
// so it does its own fogging.
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "ObjTranslucentBin";
|
|
||||||
|
|
||||||
shader = FogPassShader;
|
|
||||||
stateBlock = FogPassStateBlock;
|
|
||||||
texture[0] = "#deferred";
|
|
||||||
|
|
||||||
renderPriority = 5;
|
|
||||||
|
|
||||||
targetFormat = getBestHDRFormat();
|
|
||||||
isEnabled = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// UnderwaterFog
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( UnderwaterFogPassShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/underwaterFogP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredTex";
|
|
||||||
samplerNames[1] = "$backbuffer";
|
|
||||||
samplerNames[2] = "$waterDepthGradMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( UnderwaterFogPassStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampPoint;
|
|
||||||
samplerStates[2] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton PostEffect( UnderwaterFogPostFx )
|
|
||||||
{
|
|
||||||
oneFrameOnly = true;
|
|
||||||
onThisFrame = false;
|
|
||||||
|
|
||||||
// Let the fog effect render during the
|
|
||||||
// reflection pass.
|
|
||||||
allowReflectPass = true;
|
|
||||||
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "ObjTranslucentBin";
|
|
||||||
|
|
||||||
shader = UnderwaterFogPassShader;
|
|
||||||
stateBlock = UnderwaterFogPassStateBlock;
|
|
||||||
texture[0] = "#deferred";
|
|
||||||
texture[1] = "$backBuffer";
|
|
||||||
texture[2] = "#waterDepthGradMap";
|
|
||||||
|
|
||||||
// Needs to happen after the FogPostFx
|
|
||||||
renderPriority = 4;
|
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
function UnderwaterFogPostFx::onEnabled( %this )
|
|
||||||
{
|
|
||||||
TurbulenceFx.enable();
|
|
||||||
CausticsPFX.enable();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function UnderwaterFogPostFx::onDisabled( %this )
|
|
||||||
{
|
|
||||||
TurbulenceFx.disable();
|
|
||||||
CausticsPFX.disable();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// An implementation of "NVIDIA FXAA 3.11" by TIMOTHY LOTTES
|
|
||||||
//
|
|
||||||
// http://timothylottes.blogspot.com/
|
|
||||||
//
|
|
||||||
// The shader is tuned for the defaul quality and good performance.
|
|
||||||
// See shaders\common\postFx\fxaa\fxaaP.hlsl to tweak the internal
|
|
||||||
// quality and performance settings.
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( FXAA_StateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( FXAA_ShaderData )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$colorTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( FXAA_PostEffect )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
|
|
||||||
allowReflectPass = false;
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
|
|
||||||
target = "$backBuffer";
|
|
||||||
|
|
||||||
stateBlock = FXAA_StateBlock;
|
|
||||||
shader = FXAA_ShaderData;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,184 +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( PFX_GlowBlurVertShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurP.glsl";
|
|
||||||
|
|
||||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
|
||||||
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_GlowBlurHorzShader : PFX_GlowBlurVertShader )
|
|
||||||
{
|
|
||||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( PFX_GlowCombineStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
// Use alpha test to save some fillrate
|
|
||||||
// on the non-glowing areas of the scene.
|
|
||||||
alphaDefined = true;
|
|
||||||
alphaTestEnable = true;
|
|
||||||
alphaTestRef = 1;
|
|
||||||
alphaTestFunc = GFXCmpGreaterEqual;
|
|
||||||
|
|
||||||
// Do a one to one blend.
|
|
||||||
blendDefined = true;
|
|
||||||
blendEnable = true;
|
|
||||||
blendSrc = GFXBlendOne;
|
|
||||||
blendDest = GFXBlendOne;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton PostEffect( GlowPostFx )
|
|
||||||
{
|
|
||||||
// Do not allow the glow effect to work in reflection
|
|
||||||
// passes by default so we don't do the extra drawing.
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterBin";
|
|
||||||
renderBin = "GlowBin";
|
|
||||||
renderPriority = 1;
|
|
||||||
|
|
||||||
// First we down sample the glow buffer.
|
|
||||||
shader = PFX_PassthruShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "#glowbuffer";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.5 0.5";
|
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
|
|
||||||
// Blur vertically
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_GlowBlurVertShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Blur horizontally
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_GlowBlurHorzShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Upsample and combine with the back buffer.
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_PassthruShader;
|
|
||||||
stateBlock = PFX_GlowCombineStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl";
|
|
||||||
|
|
||||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
|
||||||
samplerNames[0] = "$diffuseMap";
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl";
|
|
||||||
|
|
||||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
$VolFogGlowPostFx::glowStrength = 0.3;
|
|
||||||
|
|
||||||
singleton PostEffect( VolFogGlowPostFx )
|
|
||||||
{
|
|
||||||
// Do not allow the glow effect to work in reflection
|
|
||||||
// passes by default so we don't do the extra drawing.
|
|
||||||
allowReflectPass = false;
|
|
||||||
renderTime = "PFXAfterBin";
|
|
||||||
renderBin = "FogBin";
|
|
||||||
renderPriority = 1;
|
|
||||||
// First we down sample the glow buffer.
|
|
||||||
shader = PFX_PassthruShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
texture[0] = "$backbuffer";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.5 0.5";
|
|
||||||
isEnabled = true;
|
|
||||||
// Blur vertically
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_VolFogGlowBlurVertShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
internalName = "vert";
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
// Blur horizontally
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_VolFogGlowBlurHorzShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
internalName = "hor";
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
// Upsample and combine with the back buffer.
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = PFX_PassthruShader;
|
|
||||||
stateBlock = PFX_GlowCombineStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function VolFogGlowPostFx::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%vp=%this-->vert;
|
|
||||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
|
||||||
%vp=%this-->hor;
|
|
||||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
|
||||||
}
|
|
||||||
|
|
@ -1,529 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/// Blends between the scene and the tone mapped scene.
|
|
||||||
$HDRPostFX::enableToneMapping = 0.5;
|
|
||||||
|
|
||||||
/// The tone mapping middle grey or exposure value used
|
|
||||||
/// to adjust the overall "balance" of the image.
|
|
||||||
///
|
|
||||||
/// 0.18 is fairly common value.
|
|
||||||
///
|
|
||||||
$HDRPostFX::keyValue = 0.18;
|
|
||||||
|
|
||||||
/// The minimum luninace value to allow when tone mapping
|
|
||||||
/// the scene. Is particularly useful if your scene very
|
|
||||||
/// dark or has a black ambient color in places.
|
|
||||||
$HDRPostFX::minLuminace = 0.001;
|
|
||||||
|
|
||||||
/// The lowest luminance value which is mapped to white. This
|
|
||||||
/// is usually set to the highest visible luminance in your
|
|
||||||
/// scene. By setting this to smaller values you get a contrast
|
|
||||||
/// enhancement.
|
|
||||||
$HDRPostFX::whiteCutoff = 1.0;
|
|
||||||
|
|
||||||
/// The rate of adaptation from the previous and new
|
|
||||||
/// average scene luminance.
|
|
||||||
$HDRPostFX::adaptRate = 2.0;
|
|
||||||
|
|
||||||
/// Blends between the scene and the blue shifted version
|
|
||||||
/// of the scene for a cinematic desaturated night effect.
|
|
||||||
$HDRPostFX::enableBlueShift = 0.0;
|
|
||||||
|
|
||||||
/// The blue shift color value.
|
|
||||||
$HDRPostFX::blueShiftColor = "1.05 0.97 1.27";
|
|
||||||
|
|
||||||
|
|
||||||
/// Blends between the scene and the bloomed scene.
|
|
||||||
$HDRPostFX::enableBloom = 1.0;
|
|
||||||
|
|
||||||
/// The threshold luminace value for pixels which are
|
|
||||||
/// considered "bright" and need to be bloomed.
|
|
||||||
$HDRPostFX::brightPassThreshold = 1.0;
|
|
||||||
|
|
||||||
/// These are used in the gaussian blur of the
|
|
||||||
/// bright pass for the bloom effect.
|
|
||||||
$HDRPostFX::gaussMultiplier = 0.3;
|
|
||||||
$HDRPostFX::gaussMean = 0.0;
|
|
||||||
$HDRPostFX::gaussStdDev = 0.8;
|
|
||||||
|
|
||||||
/// The 1x255 color correction ramp texture used
|
|
||||||
/// by both the HDR shader and the GammaPostFx shader
|
|
||||||
/// for doing full screen color correction.
|
|
||||||
$HDRPostFX::colorCorrectionRamp = "core/images/null_color_ramp.png";
|
|
||||||
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_BrightPassShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/brightPassFilterP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/brightPassFilterP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
samplerNames[1] = "$luminanceTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_DownScale4x4Shader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4P.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_BloomGaussBlurHShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurHP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurHP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_BloomGaussBlurVShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurVP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurVP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_SampleLumShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumInitialP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumInitialP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_DownSampleLumShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumIterativeP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumIterativeP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_CalcAdaptedLumShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/calculateAdaptedLumP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/calculateAdaptedLumP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$currLum";
|
|
||||||
samplerNames[1] = "$lastAdaptedLum";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( HDR_CombineShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/finalPassCombineP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/finalPassCombineP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$sceneTex";
|
|
||||||
samplerNames[1] = "$luminanceTex";
|
|
||||||
samplerNames[2] = "$bloomTex";
|
|
||||||
samplerNames[3] = "$colorCorrectionTex";
|
|
||||||
samplerNames[4] = "deferredTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( HDR_SampleStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( HDR_DownSampleStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( HDR_CombineStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
samplerStates[2] = SamplerClampLinear;
|
|
||||||
samplerStates[3] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( HDRStateBlock )
|
|
||||||
{
|
|
||||||
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 HDRPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold );
|
|
||||||
%this.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue );
|
|
||||||
|
|
||||||
%bloomH = %this-->bloomH;
|
|
||||||
%bloomH.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier );
|
|
||||||
%bloomH.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean );
|
|
||||||
%bloomH.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev );
|
|
||||||
|
|
||||||
%bloomV = %this-->bloomV;
|
|
||||||
%bloomV.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier );
|
|
||||||
%bloomV.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean );
|
|
||||||
%bloomV.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev );
|
|
||||||
|
|
||||||
%minLuminace = $HDRPostFX::minLuminace;
|
|
||||||
if ( %minLuminace <= 0.0 )
|
|
||||||
{
|
|
||||||
// The min should never be pure zero else the
|
|
||||||
// log() in the shader will generate INFs.
|
|
||||||
%minLuminace = 0.00001;
|
|
||||||
}
|
|
||||||
%this-->adaptLum.setShaderConst( "$g_fMinLuminace", %minLuminace );
|
|
||||||
|
|
||||||
%this-->finalLum.setShaderConst( "$adaptRate", $HDRPostFX::adaptRate );
|
|
||||||
|
|
||||||
%combinePass = %this-->combinePass;
|
|
||||||
%combinePass.setShaderConst( "$g_fEnableToneMapping", $HDRPostFX::enableToneMapping );
|
|
||||||
%combinePass.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue );
|
|
||||||
%combinePass.setShaderConst( "$g_fBloomScale", $HDRPostFX::enableBloom );
|
|
||||||
%combinePass.setShaderConst( "$g_fEnableBlueShift", $HDRPostFX::enableBlueShift );
|
|
||||||
%combinePass.setShaderConst( "$g_fBlueShiftColor", $HDRPostFX::blueShiftColor );
|
|
||||||
|
|
||||||
%clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5);
|
|
||||||
%combinePass.setShaderConst( "$g_fOneOverGamma", 1 / %clampedGamma );
|
|
||||||
%combinePass.setShaderConst( "$Brightness", $pref::Video::Brightness );
|
|
||||||
%combinePass.setShaderConst( "$Contrast", $pref::Video::Contrast );
|
|
||||||
|
|
||||||
%whiteCutoff = ( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff ) *
|
|
||||||
( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff );
|
|
||||||
%combinePass.setShaderConst( "$g_fWhiteCutoff", %whiteCutoff );
|
|
||||||
}
|
|
||||||
|
|
||||||
function HDRPostFX::preProcess( %this )
|
|
||||||
{
|
|
||||||
%combinePass = %this-->combinePass;
|
|
||||||
|
|
||||||
if ( %combinePass.texture[3] !$= $HDRPostFX::colorCorrectionRamp )
|
|
||||||
%combinePass.setTexture( 3, $HDRPostFX::colorCorrectionRamp );
|
|
||||||
}
|
|
||||||
|
|
||||||
function HDRPostFX::onEnabled( %this )
|
|
||||||
{
|
|
||||||
// See what HDR format would be best.
|
|
||||||
%format = getBestHDRFormat();
|
|
||||||
if ( %format $= "" || %format $= "GFXFormatR8G8B8A8" )
|
|
||||||
{
|
|
||||||
// We didn't get a valid HDR format... so fail.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HDR does it's own gamma calculation so
|
|
||||||
// disable this postFx.
|
|
||||||
GammaPostFX.disable();
|
|
||||||
|
|
||||||
// Set the right global shader define for HDR.
|
|
||||||
if ( %format $= "GFXFormatR10G10B10A2" )
|
|
||||||
addGlobalShaderMacro( "TORQUE_HDR_RGB10" );
|
|
||||||
else if ( %format $= "GFXFormatR16G16B16A16" )
|
|
||||||
addGlobalShaderMacro( "TORQUE_HDR_RGB16" );
|
|
||||||
|
|
||||||
echo( "HDR FORMAT: " @ %format );
|
|
||||||
|
|
||||||
// Change the format of the offscreen surface
|
|
||||||
// to an HDR compatible format.
|
|
||||||
AL_FormatToken.format = %format;
|
|
||||||
setReflectFormat( %format );
|
|
||||||
|
|
||||||
// Reset the light manager which will ensure the new
|
|
||||||
// hdr encoding takes effect in all the shaders and
|
|
||||||
// that the offscreen surface is enabled.
|
|
||||||
resetLightManager();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function HDRPostFX::onDisabled( %this )
|
|
||||||
{
|
|
||||||
// Enable a special GammaCorrection PostFX when this is disabled.
|
|
||||||
GammaPostFX.enable();
|
|
||||||
|
|
||||||
// Restore the non-HDR offscreen surface format.
|
|
||||||
%format = getBestHDRFormat();
|
|
||||||
AL_FormatToken.format = %format;
|
|
||||||
setReflectFormat( %format );
|
|
||||||
|
|
||||||
removeGlobalShaderMacro( "TORQUE_HDR_RGB10" );
|
|
||||||
removeGlobalShaderMacro( "TORQUE_HDR_RGB16" );
|
|
||||||
|
|
||||||
// Reset the light manager which will ensure the new
|
|
||||||
// hdr encoding takes effect in all the shaders.
|
|
||||||
resetLightManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
singleton PostEffect( HDRPostFX )
|
|
||||||
{
|
|
||||||
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 = HDR_BrightPassShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = "#adaptedLum";
|
|
||||||
target = "$outTex";
|
|
||||||
targetFormat = "GFXFormatR16G16B16A16F";
|
|
||||||
targetScale = "0.5 0.5";
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
shader = HDR_DownScale4x4Shader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
targetFormat = "GFXFormatR16G16B16A16F";
|
|
||||||
targetScale = "0.25 0.25";
|
|
||||||
};
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
internalName = "bloomH";
|
|
||||||
|
|
||||||
shader = HDR_BloomGaussBlurHShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
targetFormat = "GFXFormatR16G16B16A16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
internalName = "bloomV";
|
|
||||||
|
|
||||||
shader = HDR_BloomGaussBlurVShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "#bloomFinal";
|
|
||||||
targetFormat = "GFXFormatR16G16B16A16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
// BrightPass End
|
|
||||||
|
|
||||||
// Now calculate the adapted luminance.
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
internalName = "adaptLum";
|
|
||||||
|
|
||||||
shader = HDR_SampleLumShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.0625 0.0625"; // 1/16th
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
shader = HDR_DownSampleLumShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.25 0.25"; // 1/4
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
shader = HDR_DownSampleLumShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.25 0.25"; // 1/4
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
shader = HDR_DownSampleLumShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.25 0.25"; // At this point the target should be 1x1.
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Note that we're reading the adapted luminance
|
|
||||||
// from the previous frame when generating this new
|
|
||||||
// one... PostEffect takes care to manage that.
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
internalName = "finalLum";
|
|
||||||
shader = HDR_CalcAdaptedLumShader;
|
|
||||||
stateBlock = HDR_DownSampleStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "#adaptedLum";
|
|
||||||
target = "#adaptedLum";
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
targetClear = "PFXTargetClear_OnCreate";
|
|
||||||
targetClearColor = "1 1 1 1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Output the combined bloom and toned mapped
|
|
||||||
// version of the scene.
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
internalName = "combinePass";
|
|
||||||
|
|
||||||
shader = HDR_CombineShader;
|
|
||||||
stateBlock = HDR_CombineStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = "#adaptedLum";
|
|
||||||
texture[2] = "#bloomFinal";
|
|
||||||
texture[3] = $HDRPostFX::colorCorrectionRamp;
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( LuminanceVisShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/luminanceVisP.hlsl";
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/luminanceVisP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$inputTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( LuminanceVisStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
function LuminanceVisPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold );
|
|
||||||
}
|
|
||||||
|
|
||||||
singleton PostEffect( LuminanceVisPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
// Render before we do any editor rendering.
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "EditorBin";
|
|
||||||
renderPriority = 9999;
|
|
||||||
|
|
||||||
shader = LuminanceVisShader;
|
|
||||||
stateBlock = LuminanceVisStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
target = "$backBuffer";
|
|
||||||
//targetScale = "0.0625 0.0625"; // 1/16th
|
|
||||||
//targetFormat = "GFXFormatR16F";
|
|
||||||
};
|
|
||||||
|
|
||||||
function LuminanceVisPostFX::onEnabled( %this )
|
|
||||||
{
|
|
||||||
if ( !HDRPostFX.isEnabled() )
|
|
||||||
{
|
|
||||||
HDRPostFX.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
HDRPostFX.skip = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function LuminanceVisPostFX::onDisabled( %this )
|
|
||||||
{
|
|
||||||
HDRPostFX.skip = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,110 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
$LightRayPostFX::brightScalar = 0.75;
|
|
||||||
$LightRayPostFX::numSamples = 40;
|
|
||||||
$LightRayPostFX::density = 0.94;
|
|
||||||
$LightRayPostFX::weight = 5.65;
|
|
||||||
$LightRayPostFX::decay = 1.0;
|
|
||||||
$LightRayPostFX::exposure = 0.0005;
|
|
||||||
$LightRayPostFX::resolutionScale = 1.0;
|
|
||||||
|
|
||||||
|
|
||||||
singleton ShaderData( LightRayOccludeShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayOccludeP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
samplerNames[1] = "$deferredTex";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( LightRayShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayP.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$frameSampler";
|
|
||||||
samplerNames[1] = "$backBuffer";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( LightRayPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "EditorBin";
|
|
||||||
renderPriority = 10;
|
|
||||||
|
|
||||||
shader = LightRayOccludeShader;
|
|
||||||
stateBlock = LightRayStateBlock;
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
target = "$outTex";
|
|
||||||
targetFormat = "GFXFormatR16G16B16A16F";
|
|
||||||
|
|
||||||
new PostEffect()
|
|
||||||
{
|
|
||||||
shader = LightRayShader;
|
|
||||||
stateBlock = LightRayStateBlock;
|
|
||||||
internalName = "final";
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "$backBuffer";
|
|
||||||
target = "$backBuffer";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function LightRayPostFX::preProcess( %this )
|
|
||||||
{
|
|
||||||
%this.targetScale = $LightRayPostFX::resolutionScale SPC $LightRayPostFX::resolutionScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
function LightRayPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$brightScalar", $LightRayPostFX::brightScalar );
|
|
||||||
|
|
||||||
%pfx = %this-->final;
|
|
||||||
%pfx.setShaderConst( "$numSamples", $LightRayPostFX::numSamples );
|
|
||||||
%pfx.setShaderConst( "$density", $LightRayPostFX::density );
|
|
||||||
%pfx.setShaderConst( "$weight", $LightRayPostFX::weight );
|
|
||||||
%pfx.setShaderConst( "$decay", $LightRayPostFX::decay );
|
|
||||||
%pfx.setShaderConst( "$exposure", $LightRayPostFX::exposure );
|
|
||||||
}
|
|
||||||
|
|
@ -1,167 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Only load these shaders if an Oculus VR device is present
|
|
||||||
if(!isFunction(isOculusVRDeviceActive))
|
|
||||||
return;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Shader data
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton ShaderData( OVRMonoToStereoShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/monoToStereoP.hlsl";
|
|
||||||
|
|
||||||
//OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.hlsl";
|
|
||||||
//OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/monoToStereoP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( OVRBarrelDistortionShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionP.hlsl";
|
|
||||||
|
|
||||||
//OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
//OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/barrelDistortionP.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$backBuffer";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( OVRBarrelDistortionChromaShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionChromaP.hlsl";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// GFX state blocks
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( OVRBarrelDistortionStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Barrel Distortion PostFx
|
|
||||||
//
|
|
||||||
// To be used with the Oculus Rift.
|
|
||||||
// Expects a stereo pair to exist on the back buffer and then applies the
|
|
||||||
// appropriate barrel distortion.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
singleton BarrelDistortionPostEffect( OVRBarrelDistortionPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
renderPriority = 100;
|
|
||||||
|
|
||||||
// The barrel distortion
|
|
||||||
shader = OVRBarrelDistortionShader;
|
|
||||||
stateBlock = OVRBarrelDistortionStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
|
|
||||||
scaleOutput = 1.25;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Barrel Distortion with Chromatic Aberration Correction PostFx
|
|
||||||
//
|
|
||||||
// To be used with the Oculus Rift.
|
|
||||||
// Expects a stereo pair to exist on the back buffer and then applies the
|
|
||||||
// appropriate barrel distortion.
|
|
||||||
// This version applies a chromatic aberration correction during the
|
|
||||||
// barrel distortion.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
singleton BarrelDistortionPostEffect( OVRBarrelDistortionChromaPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
renderPriority = 100;
|
|
||||||
|
|
||||||
// The barrel distortion
|
|
||||||
shader = OVRBarrelDistortionChromaShader;
|
|
||||||
stateBlock = OVRBarrelDistortionStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
|
|
||||||
scaleOutput = 1.25;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Barrel Distortion Mono PostFx
|
|
||||||
//
|
|
||||||
// To be used with the Oculus Rift.
|
|
||||||
// Takes a non-stereo image and turns it into a stereo pair with barrel
|
|
||||||
// distortion applied. Only a vertical slice around the center of the back
|
|
||||||
// buffer is used to generate the pseudo stereo pair.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
singleton PostEffect( OVRBarrelDistortionMonoPostFX )
|
|
||||||
{
|
|
||||||
isEnabled = false;
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXAfterDiffuse";
|
|
||||||
renderPriority = 100;
|
|
||||||
|
|
||||||
// Converts the mono display to a stereo one
|
|
||||||
shader = OVRMonoToStereoShader;
|
|
||||||
stateBlock = OVRBarrelDistortionStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$backBuffer";
|
|
||||||
target = "$outTex";
|
|
||||||
|
|
||||||
// The actual barrel distortion
|
|
||||||
new BarrelDistortionPostEffect(OVRBarrelDistortionMonoStage2PostFX)
|
|
||||||
{
|
|
||||||
shader = OVRBarrelDistortionShader;
|
|
||||||
stateBlock = OVRBarrelDistortionStateBlock;
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
target = "$backBuffer";
|
|
||||||
|
|
||||||
scaleOutput = 1.25;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
function OVRBarrelDistortionMonoPostFX::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%HMDIndex = 0;
|
|
||||||
|
|
||||||
%xOffsets = getOVRHMDEyeXOffsets(%HMDIndex);
|
|
||||||
%this.setShaderConst( "$LensXOffsets", %xOffsets );
|
|
||||||
}
|
|
||||||
|
|
@ -1,446 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$PostFXManager::vebose = true;
|
|
||||||
function postVerbose(%string)
|
|
||||||
{
|
|
||||||
if($PostFXManager::vebose == true)
|
|
||||||
{
|
|
||||||
echo(%string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::onDialogPush( %this )
|
|
||||||
{
|
|
||||||
//Apply the settings to the controls
|
|
||||||
postVerbose("% - PostFX Manager - Loading GUI.");
|
|
||||||
|
|
||||||
%this.settingsRefreshAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// :: Controls for the overall postFX manager dialog
|
|
||||||
function ppOptionsEnable::onAction(%this)
|
|
||||||
{
|
|
||||||
//Disable / Enable all PostFX
|
|
||||||
|
|
||||||
if(ppOptionsEnable.getValue())
|
|
||||||
{
|
|
||||||
%toEnable = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%toEnable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PostFXManager.settingsSetEnabled(%toEnable);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::getEnableResultFromControl(%this, %control)
|
|
||||||
{
|
|
||||||
%toEnable = -1;
|
|
||||||
%bTest = %control.getValue();
|
|
||||||
if(%bTest == 1)
|
|
||||||
{
|
|
||||||
%toEnable = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%toEnable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return %toEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableSSAO::onAction(%this)
|
|
||||||
{
|
|
||||||
%toEnable = PostFXManager.getEnableResultFromControl(%this);
|
|
||||||
PostFXManager.settingsEffectSetEnabled("SSAO", %toEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableHDR::onAction(%this)
|
|
||||||
{
|
|
||||||
%toEnable = PostFXManager.getEnableResultFromControl(%this);
|
|
||||||
PostFXManager.settingsEffectSetEnabled("HDR", %toEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableLightRays::onAction(%this)
|
|
||||||
{
|
|
||||||
%toEnable = PostFXManager.getEnableResultFromControl(%this);
|
|
||||||
PostFXManager.settingsEffectSetEnabled("LightRays", %toEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableDOF::onAction(%this)
|
|
||||||
{
|
|
||||||
%toEnable = PostFXManager.getEnableResultFromControl(%this);
|
|
||||||
PostFXManager.settingsEffectSetEnabled("DOF", %toEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableVignette::onAction(%this)
|
|
||||||
{
|
|
||||||
%toEnable = PostFXManager.getEnableResultFromControl(%this);
|
|
||||||
PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSavePreset::onClick(%this)
|
|
||||||
{
|
|
||||||
//Stores the current settings into a preset file for loading and use later on
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsLoadPreset::onClick(%this)
|
|
||||||
{
|
|
||||||
//Loads and applies the settings from a postfxpreset file
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Other controls, Quality dropdown
|
|
||||||
function ppOptionsSSAOQuality::onSelect( %this, %id, %text )
|
|
||||||
{
|
|
||||||
if(%id > -1 && %id < 3)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::quality = %id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//SSAO Slider controls
|
|
||||||
//General Tab
|
|
||||||
function ppOptionsSSAOOverallStrength::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::overallStrength = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAOBlurDepth::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::blurDepthTol = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAOBlurNormal::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::blurNormalTol = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Near Tab
|
|
||||||
function ppOptionsSSAONearRadius::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sRadius = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAONearStrength::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sStrength = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAONearDepthMin::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sDepthMin = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAONearDepthMax::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sDepthMax = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAONearToleranceNormal::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sNormalTol = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsSSAONearTolerancePower::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::sNormalPow = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Far Tab
|
|
||||||
function ppOptionsSSAOFarRadius::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lRadius = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
function ppOptionsSSAOFarStrength::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lStrength = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
function ppOptionsSSAOFarDepthMin::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lDepthMin = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
function ppOptionsSSAOFarDepthMax::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lDepthMax = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
function ppOptionsSSAOFarToleranceNormal::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lNormalTol = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
function ppOptionsSSAOFarTolerancePower::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$SSAOPostFx::lNormalPow = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//HDR Slider Controls
|
|
||||||
//Brighness tab
|
|
||||||
|
|
||||||
function ppOptionsHDRToneMappingAmount::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
|
|
||||||
$HDRPostFX::enableToneMapping = %this.value;
|
|
||||||
%this.ToolTip = "value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRKeyValue::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::keyValue = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRMinLuminance::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::minLuminace = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRWhiteCutoff::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::whiteCutoff = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRBrightnessAdaptRate::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::adaptRate = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Blur tab
|
|
||||||
function ppOptionsHDRBloomBlurBrightPassThreshold::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::brightPassThreshold = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRBloomBlurMultiplier::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::gaussMultiplier = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRBloomBlurMean::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::gaussMean = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRBloomBlurStdDev::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::gaussStdDev = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRBloom::onAction(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::enableBloom = %this.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDRToneMapping::onAction(%this)
|
|
||||||
{
|
|
||||||
//$HDRPostFX::enableToneMapping = %this.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDREffectsBlueShift::onAction(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::enableBlueShift = %this.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Controls for color range in blue Shift dialog
|
|
||||||
|
|
||||||
function ppOptionsHDREffectsBlueShiftColorBlend::onAction(%this)
|
|
||||||
{
|
|
||||||
$HDRPostFX::blueShiftColor = %this.PickColor;
|
|
||||||
%this.ToolTip = "Color Values : " @ %this.PickColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsHDREffectsBlueShiftColorBaseColor::onAction(%this)
|
|
||||||
{
|
|
||||||
//This one feeds the one above
|
|
||||||
ppOptionsHDREffectsBlueShiftColorBlend.baseColor = %this.PickColor;
|
|
||||||
%this.ToolTip = "Color Values : " @ %this.PickColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Light rays Brightness Slider Controls
|
|
||||||
function ppOptionsLightRaysBrightScalar::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$LightRayPostFX::brightScalar = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
//Light rays Number of Samples Slider Control
|
|
||||||
function ppOptionsLightRaysSampleScalar::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$LightRayPostFX::numSamples = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
//Light rays Density Slider Control
|
|
||||||
function ppOptionsLightRaysDensityScalar::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$LightRayPostFX::density = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
//Light rays Weight Slider Control
|
|
||||||
function ppOptionsLightRaysWeightScalar::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$LightRayPostFX::weight = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
//Light rays Decay Slider Control
|
|
||||||
function ppOptionsLightRaysDecayScalar::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$LightRayPostFX::decay = %this.value;
|
|
||||||
%this.ToolTip = "Value : " @ %this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function ppOptionsUpdateDOFSettings()
|
|
||||||
{
|
|
||||||
DOFPostEffect.setFocusParams( $DOFPostFx::BlurMin, $DOFPostFx::BlurMax, $DOFPostFx::FocusRangeMin, $DOFPostFx::FocusRangeMax, -($DOFPostFx::BlurCurveNear), $DOFPostFx::BlurCurveFar );
|
|
||||||
|
|
||||||
DOFPostEffect.setAutoFocus( $DOFPostFx::EnableAutoFocus );
|
|
||||||
DOFPostEffect.setFocalDist(0);
|
|
||||||
|
|
||||||
if($PostFXManager::PostFX::EnableDOF)
|
|
||||||
{
|
|
||||||
DOFPostEffect.enable();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DOFPostEffect.disable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//DOF General Tab
|
|
||||||
//DOF Toggles
|
|
||||||
function ppOptionsDOFEnableDOF::onAction(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::PostFX::EnableDOF = %this.getValue();
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function ppOptionsDOFEnableAutoFocus::onAction(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::EnableAutoFocus = %this.getValue();
|
|
||||||
DOFPostEffect.setAutoFocus( %this.getValue() );
|
|
||||||
}
|
|
||||||
|
|
||||||
//DOF AutoFocus Slider controls
|
|
||||||
function ppOptionsDOFFarBlurMinSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::BlurMin = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsDOFFarBlurMaxSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::BlurMax = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsDOFFocusRangeMinSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::FocusRangeMin = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsDOFFocusRangeMaxSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::FocusRangeMax = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsDOFBlurCurveNearSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::BlurCurveNear = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsDOFBlurCurveFarSlider::onMouseDragged(%this)
|
|
||||||
{
|
|
||||||
$DOFPostFx::BlurCurveFar = %this.value;
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsEnableHDRDebug::onAction(%this)
|
|
||||||
{
|
|
||||||
if ( %this.getValue() )
|
|
||||||
LuminanceVisPostFX.enable();
|
|
||||||
else
|
|
||||||
LuminanceVisPostFX.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsUpdateVignetteSettings()
|
|
||||||
{
|
|
||||||
if($PostFXManager::PostFX::EnableVignette)
|
|
||||||
{
|
|
||||||
VignettePostEffect.enable();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VignettePostEffect.disable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppOptionsVignetteEnableVignette::onAction(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::PostFX::EnableVignette = %this.getValue();
|
|
||||||
ppOptionsUpdateVignetteSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppColorCorrection_selectFile()
|
|
||||||
{
|
|
||||||
%filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|";
|
|
||||||
getLoadFilename( %filter, "ppColorCorrection_selectFileHandler");
|
|
||||||
}
|
|
||||||
|
|
||||||
function ppColorCorrection_selectFileHandler( %filename )
|
|
||||||
{
|
|
||||||
if ( %filename $= "" || !isFile( %filename ) )
|
|
||||||
%filename = "core/images/null_color_ramp.png";
|
|
||||||
else
|
|
||||||
%filename = makeRelativePath( %filename, getMainDotCsDir() );
|
|
||||||
|
|
||||||
$HDRPostFX::colorCorrectionRamp = %filename;
|
|
||||||
PostFXManager-->ColorCorrectionFileName.Text = %filename;
|
|
||||||
}
|
|
||||||
|
|
@ -1,439 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$PostFXManager::defaultPreset = "core/postFX/default.postfxpreset.cs";
|
|
||||||
|
|
||||||
function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
|
||||||
{
|
|
||||||
$PostFXManager::PostFX::Enabled = %bEnablePostFX;
|
|
||||||
|
|
||||||
//if to enable the postFX, apply the ones that are enabled
|
|
||||||
if ( %bEnablePostFX )
|
|
||||||
{
|
|
||||||
//SSAO, HDR, LightRays, DOF
|
|
||||||
|
|
||||||
if ( $PostFXManager::PostFX::EnableSSAO )
|
|
||||||
SSAOPostFx.enable();
|
|
||||||
else
|
|
||||||
SSAOPostFx.disable();
|
|
||||||
|
|
||||||
if ( $PostFXManager::PostFX::EnableHDR )
|
|
||||||
HDRPostFX.enable();
|
|
||||||
else
|
|
||||||
HDRPostFX.disable();
|
|
||||||
|
|
||||||
if ( $PostFXManager::PostFX::EnableLightRays )
|
|
||||||
LightRayPostFX.enable();
|
|
||||||
else
|
|
||||||
LightRayPostFX.disable();
|
|
||||||
|
|
||||||
if ( $PostFXManager::PostFX::EnableDOF )
|
|
||||||
DOFPostEffect.enable();
|
|
||||||
else
|
|
||||||
DOFPostEffect.disable();
|
|
||||||
|
|
||||||
if ( $PostFXManager::PostFX::EnableVignette )
|
|
||||||
VignettePostEffect.enable();
|
|
||||||
else
|
|
||||||
VignettePostEffect.disable();
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - PostFX enabled");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Disable all postFX
|
|
||||||
|
|
||||||
SSAOPostFx.disable();
|
|
||||||
HDRPostFX.disable();
|
|
||||||
LightRayPostFX.disable();
|
|
||||||
DOFPostEffect.disable();
|
|
||||||
VignettePostEffect.disable();
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
VolFogGlowPostFx.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
|
||||||
{
|
|
||||||
%postEffect = 0;
|
|
||||||
|
|
||||||
//Determine the postFX to enable, and apply the boolean
|
|
||||||
if(%sName $= "SSAO")
|
|
||||||
{
|
|
||||||
%postEffect = SSAOPostFx;
|
|
||||||
$PostFXManager::PostFX::EnableSSAO = %bEnable;
|
|
||||||
//$pref::PostFX::SSAO::Enabled = %bEnable;
|
|
||||||
}
|
|
||||||
else if(%sName $= "HDR")
|
|
||||||
{
|
|
||||||
%postEffect = HDRPostFX;
|
|
||||||
$PostFXManager::PostFX::EnableHDR = %bEnable;
|
|
||||||
//$pref::PostFX::HDR::Enabled = %bEnable;
|
|
||||||
}
|
|
||||||
else if(%sName $= "LightRays")
|
|
||||||
{
|
|
||||||
%postEffect = LightRayPostFX;
|
|
||||||
$PostFXManager::PostFX::EnableLightRays = %bEnable;
|
|
||||||
//$pref::PostFX::LightRays::Enabled = %bEnable;
|
|
||||||
}
|
|
||||||
else if(%sName $= "DOF")
|
|
||||||
{
|
|
||||||
%postEffect = DOFPostEffect;
|
|
||||||
$PostFXManager::PostFX::EnableDOF = %bEnable;
|
|
||||||
//$pref::PostFX::DOF::Enabled = %bEnable;
|
|
||||||
}
|
|
||||||
else if(%sName $= "Vignette")
|
|
||||||
{
|
|
||||||
%postEffect = VignettePostEffect;
|
|
||||||
$PostFXManager::PostFX::EnableVignette = %bEnable;
|
|
||||||
//$pref::PostFX::Vignette::Enabled = %bEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply the change
|
|
||||||
if ( %bEnable == true )
|
|
||||||
{
|
|
||||||
%postEffect.enable();
|
|
||||||
postVerbose("% - PostFX Manager - " @ %sName @ " enabled");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%postEffect.disable();
|
|
||||||
postVerbose("% - PostFX Manager - " @ %sName @ " disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshSSAO(%this)
|
|
||||||
{
|
|
||||||
//Apply the enabled flag
|
|
||||||
ppOptionsEnableSSAO.setValue($PostFXManager::PostFX::EnableSSAO);
|
|
||||||
|
|
||||||
//Add the items we need to display
|
|
||||||
ppOptionsSSAOQuality.clear();
|
|
||||||
ppOptionsSSAOQuality.add("Low", 0);
|
|
||||||
ppOptionsSSAOQuality.add("Medium", 1);
|
|
||||||
ppOptionsSSAOQuality.add("High", 2);
|
|
||||||
|
|
||||||
//Set the selected, after adding the items!
|
|
||||||
ppOptionsSSAOQuality.setSelected($SSAOPostFx::quality);
|
|
||||||
|
|
||||||
//SSAO - Set the values of the sliders, General Tab
|
|
||||||
ppOptionsSSAOOverallStrength.setValue($SSAOPostFx::overallStrength);
|
|
||||||
ppOptionsSSAOBlurDepth.setValue($SSAOPostFx::blurDepthTol);
|
|
||||||
ppOptionsSSAOBlurNormal.setValue($SSAOPostFx::blurNormalTol);
|
|
||||||
|
|
||||||
//SSAO - Set the values for the near tab
|
|
||||||
ppOptionsSSAONearDepthMax.setValue($SSAOPostFx::sDepthMax);
|
|
||||||
ppOptionsSSAONearDepthMin.setValue($SSAOPostFx::sDepthMin);
|
|
||||||
ppOptionsSSAONearRadius.setValue($SSAOPostFx::sRadius);
|
|
||||||
ppOptionsSSAONearStrength.setValue($SSAOPostFx::sStrength);
|
|
||||||
ppOptionsSSAONearToleranceNormal.setValue($SSAOPostFx::sNormalTol);
|
|
||||||
ppOptionsSSAONearTolerancePower.setValue($SSAOPostFx::sNormalPow);
|
|
||||||
|
|
||||||
//SSAO - Set the values for the far tab
|
|
||||||
ppOptionsSSAOFarDepthMax.setValue($SSAOPostFx::lDepthMax);
|
|
||||||
ppOptionsSSAOFarDepthMin.setValue($SSAOPostFx::lDepthMin);
|
|
||||||
ppOptionsSSAOFarRadius.setValue($SSAOPostFx::lRadius);
|
|
||||||
ppOptionsSSAOFarStrength.setValue($SSAOPostFx::lStrength);
|
|
||||||
ppOptionsSSAOFarToleranceNormal.setValue($SSAOPostFx::lNormalTol);
|
|
||||||
ppOptionsSSAOFarTolerancePower.setValue($SSAOPostFx::lNormalPow);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshHDR(%this)
|
|
||||||
{
|
|
||||||
//Apply the enabled flag
|
|
||||||
ppOptionsEnableHDR.setValue($PostFXManager::PostFX::EnableHDR);
|
|
||||||
|
|
||||||
ppOptionsHDRBloom.setValue($HDRPostFX::enableBloom);
|
|
||||||
ppOptionsHDRBloomBlurBrightPassThreshold.setValue($HDRPostFX::brightPassThreshold);
|
|
||||||
ppOptionsHDRBloomBlurMean.setValue($HDRPostFX::gaussMean);
|
|
||||||
ppOptionsHDRBloomBlurMultiplier.setValue($HDRPostFX::gaussMultiplier);
|
|
||||||
ppOptionsHDRBloomBlurStdDev.setValue($HDRPostFX::gaussStdDev);
|
|
||||||
ppOptionsHDRBrightnessAdaptRate.setValue($HDRPostFX::adaptRate);
|
|
||||||
ppOptionsHDREffectsBlueShift.setValue($HDRPostFX::enableBlueShift);
|
|
||||||
ppOptionsHDREffectsBlueShiftColor.BaseColor = $HDRPostFX::blueShiftColor;
|
|
||||||
ppOptionsHDREffectsBlueShiftColor.PickColor = $HDRPostFX::blueShiftColor;
|
|
||||||
ppOptionsHDRKeyValue.setValue($HDRPostFX::keyValue);
|
|
||||||
ppOptionsHDRMinLuminance.setValue($HDRPostFX::minLuminace);
|
|
||||||
ppOptionsHDRToneMapping.setValue($HDRPostFX::enableToneMapping);
|
|
||||||
ppOptionsHDRToneMappingAmount.setValue($HDRPostFX::enableToneMapping);
|
|
||||||
ppOptionsHDRWhiteCutoff.setValue($HDRPostFX::whiteCutoff);
|
|
||||||
|
|
||||||
%this-->ColorCorrectionFileName.Text = $HDRPostFX::colorCorrectionRamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshLightrays(%this)
|
|
||||||
{
|
|
||||||
//Apply the enabled flag
|
|
||||||
ppOptionsEnableLightRays.setValue($PostFXManager::PostFX::EnableLightRays);
|
|
||||||
|
|
||||||
ppOptionsLightRaysBrightScalar.setValue($LightRayPostFX::brightScalar);
|
|
||||||
|
|
||||||
ppOptionsLightRaysSampleScalar.setValue($LightRayPostFX::numSamples);
|
|
||||||
ppOptionsLightRaysDensityScalar.setValue($LightRayPostFX::density);
|
|
||||||
ppOptionsLightRaysWeightScalar.setValue($LightRayPostFX::weight);
|
|
||||||
ppOptionsLightRaysDecayScalar.setValue($LightRayPostFX::decay);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshDOF(%this)
|
|
||||||
{
|
|
||||||
//Apply the enabled flag
|
|
||||||
ppOptionsEnableDOF.setValue($PostFXManager::PostFX::EnableDOF);
|
|
||||||
|
|
||||||
|
|
||||||
//ppOptionsDOFEnableDOF.setValue($PostFXManager::PostFX::EnableDOF);
|
|
||||||
ppOptionsDOFEnableAutoFocus.setValue($DOFPostFx::EnableAutoFocus);
|
|
||||||
|
|
||||||
ppOptionsDOFFarBlurMinSlider.setValue($DOFPostFx::BlurMin);
|
|
||||||
ppOptionsDOFFarBlurMaxSlider.setValue($DOFPostFx::BlurMax);
|
|
||||||
|
|
||||||
ppOptionsDOFFocusRangeMinSlider.setValue($DOFPostFx::FocusRangeMin);
|
|
||||||
ppOptionsDOFFocusRangeMaxSlider.setValue($DOFPostFx::FocusRangeMax);
|
|
||||||
|
|
||||||
ppOptionsDOFBlurCurveNearSlider.setValue($DOFPostFx::BlurCurveNear);
|
|
||||||
ppOptionsDOFBlurCurveFarSlider.setValue($DOFPostFx::BlurCurveFar);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshVignette(%this)
|
|
||||||
{
|
|
||||||
//Apply the enabled flag
|
|
||||||
ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsRefreshAll(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::PostFX::Enabled = $pref::enablePostEffects;
|
|
||||||
$PostFXManager::PostFX::EnableSSAO = SSAOPostFx.isEnabled();
|
|
||||||
$PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled();
|
|
||||||
$PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled();
|
|
||||||
$PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled();
|
|
||||||
$PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled();
|
|
||||||
|
|
||||||
//For all the postFX here, apply the active settings in the system
|
|
||||||
//to the gui controls.
|
|
||||||
|
|
||||||
%this.settingsRefreshSSAO();
|
|
||||||
%this.settingsRefreshHDR();
|
|
||||||
%this.settingsRefreshLightrays();
|
|
||||||
%this.settingsRefreshDOF();
|
|
||||||
%this.settingsRefreshVignette();
|
|
||||||
|
|
||||||
ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled);
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - GUI values updated.");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyFromPreset(%this)
|
|
||||||
{
|
|
||||||
postVerbose("% - PostFX Manager - Applying from preset");
|
|
||||||
|
|
||||||
//SSAO Settings
|
|
||||||
$SSAOPostFx::blurDepthTol = $PostFXManager::Settings::SSAO::blurDepthTol;
|
|
||||||
$SSAOPostFx::blurNormalTol = $PostFXManager::Settings::SSAO::blurNormalTol;
|
|
||||||
$SSAOPostFx::lDepthMax = $PostFXManager::Settings::SSAO::lDepthMax;
|
|
||||||
$SSAOPostFx::lDepthMin = $PostFXManager::Settings::SSAO::lDepthMin;
|
|
||||||
$SSAOPostFx::lDepthPow = $PostFXManager::Settings::SSAO::lDepthPow;
|
|
||||||
$SSAOPostFx::lNormalPow = $PostFXManager::Settings::SSAO::lNormalPow;
|
|
||||||
$SSAOPostFx::lNormalTol = $PostFXManager::Settings::SSAO::lNormalTol;
|
|
||||||
$SSAOPostFx::lRadius = $PostFXManager::Settings::SSAO::lRadius;
|
|
||||||
$SSAOPostFx::lStrength = $PostFXManager::Settings::SSAO::lStrength;
|
|
||||||
$SSAOPostFx::overallStrength = $PostFXManager::Settings::SSAO::overallStrength;
|
|
||||||
$SSAOPostFx::quality = $PostFXManager::Settings::SSAO::quality;
|
|
||||||
$SSAOPostFx::sDepthMax = $PostFXManager::Settings::SSAO::sDepthMax;
|
|
||||||
$SSAOPostFx::sDepthMin = $PostFXManager::Settings::SSAO::sDepthMin;
|
|
||||||
$SSAOPostFx::sDepthPow = $PostFXManager::Settings::SSAO::sDepthPow;
|
|
||||||
$SSAOPostFx::sNormalPow = $PostFXManager::Settings::SSAO::sNormalPow;
|
|
||||||
$SSAOPostFx::sNormalTol = $PostFXManager::Settings::SSAO::sNormalTol;
|
|
||||||
$SSAOPostFx::sRadius = $PostFXManager::Settings::SSAO::sRadius;
|
|
||||||
$SSAOPostFx::sStrength = $PostFXManager::Settings::SSAO::sStrength;
|
|
||||||
|
|
||||||
//HDR settings
|
|
||||||
$HDRPostFX::adaptRate = $PostFXManager::Settings::HDR::adaptRate;
|
|
||||||
$HDRPostFX::blueShiftColor = $PostFXManager::Settings::HDR::blueShiftColor;
|
|
||||||
$HDRPostFX::brightPassThreshold = $PostFXManager::Settings::HDR::brightPassThreshold;
|
|
||||||
$HDRPostFX::enableBloom = $PostFXManager::Settings::HDR::enableBloom;
|
|
||||||
$HDRPostFX::enableBlueShift = $PostFXManager::Settings::HDR::enableBlueShift;
|
|
||||||
$HDRPostFX::enableToneMapping = $PostFXManager::Settings::HDR::enableToneMapping;
|
|
||||||
$HDRPostFX::gaussMean = $PostFXManager::Settings::HDR::gaussMean;
|
|
||||||
$HDRPostFX::gaussMultiplier = $PostFXManager::Settings::HDR::gaussMultiplier;
|
|
||||||
$HDRPostFX::gaussStdDev = $PostFXManager::Settings::HDR::gaussStdDev;
|
|
||||||
$HDRPostFX::keyValue = $PostFXManager::Settings::HDR::keyValue;
|
|
||||||
$HDRPostFX::minLuminace = $PostFXManager::Settings::HDR::minLuminace;
|
|
||||||
$HDRPostFX::whiteCutoff = $PostFXManager::Settings::HDR::whiteCutoff;
|
|
||||||
$HDRPostFX::colorCorrectionRamp = $PostFXManager::Settings::ColorCorrectionRamp;
|
|
||||||
|
|
||||||
//Light rays settings
|
|
||||||
$LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar;
|
|
||||||
|
|
||||||
$LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples;
|
|
||||||
$LightRayPostFX::density = $PostFXManager::Settings::LightRays::density;
|
|
||||||
$LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight;
|
|
||||||
$LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay;
|
|
||||||
|
|
||||||
//DOF settings
|
|
||||||
$DOFPostFx::EnableAutoFocus = $PostFXManager::Settings::DOF::EnableAutoFocus;
|
|
||||||
$DOFPostFx::BlurMin = $PostFXManager::Settings::DOF::BlurMin;
|
|
||||||
$DOFPostFx::BlurMax = $PostFXManager::Settings::DOF::BlurMax;
|
|
||||||
$DOFPostFx::FocusRangeMin = $PostFXManager::Settings::DOF::FocusRangeMin;
|
|
||||||
$DOFPostFx::FocusRangeMax = $PostFXManager::Settings::DOF::FocusRangeMax;
|
|
||||||
$DOFPostFx::BlurCurveNear = $PostFXManager::Settings::DOF::BlurCurveNear;
|
|
||||||
$DOFPostFx::BlurCurveFar = $PostFXManager::Settings::DOF::BlurCurveFar;
|
|
||||||
|
|
||||||
//Vignette settings
|
|
||||||
$VignettePostEffect::VMax = $PostFXManager::Settings::Vignette::VMax;
|
|
||||||
$VignettePostEffect::VMin = $PostFXManager::Settings::Vignette::VMin;
|
|
||||||
|
|
||||||
if ( $PostFXManager::forceEnableFromPresets )
|
|
||||||
{
|
|
||||||
$PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX;
|
|
||||||
$PostFXManager::PostFX::EnableDOF = $pref::PostFX::EnableDOF ? $PostFXManager::Settings::EnableDOF : false;
|
|
||||||
$PostFXManager::PostFX::EnableVignette = $pref::PostFX::EnableVignette ? $PostFXManager::Settings::EnableVignette : false;
|
|
||||||
$PostFXManager::PostFX::EnableLightRays = $pref::PostFX::EnableLightRays ? $PostFXManager::Settings::EnableLightRays : false;
|
|
||||||
$PostFXManager::PostFX::EnableHDR = $pref::PostFX::EnableHDR ? $PostFXManager::Settings::EnableHDR : false;
|
|
||||||
$PostFXManager::PostFX::EnableSSAO = $pref::PostFX::EnabledSSAO ? $PostFXManager::Settings::EnableSSAO : false;
|
|
||||||
|
|
||||||
%this.settingsSetEnabled( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
//make sure we apply the correct settings to the DOF
|
|
||||||
ppOptionsUpdateDOFSettings();
|
|
||||||
|
|
||||||
// Update the actual GUI controls if its awake ( otherwise it will when opened ).
|
|
||||||
if ( PostFXManager.isAwake() )
|
|
||||||
%this.settingsRefreshAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplySSAO(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::Settings::SSAO::blurDepthTol = $SSAOPostFx::blurDepthTol;
|
|
||||||
$PostFXManager::Settings::SSAO::blurNormalTol = $SSAOPostFx::blurNormalTol;
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMax = $SSAOPostFx::lDepthMax;
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthMin = $SSAOPostFx::lDepthMin;
|
|
||||||
$PostFXManager::Settings::SSAO::lDepthPow = $SSAOPostFx::lDepthPow;
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalPow = $SSAOPostFx::lNormalPow;
|
|
||||||
$PostFXManager::Settings::SSAO::lNormalTol = $SSAOPostFx::lNormalTol;
|
|
||||||
$PostFXManager::Settings::SSAO::lRadius = $SSAOPostFx::lRadius;
|
|
||||||
$PostFXManager::Settings::SSAO::lStrength = $SSAOPostFx::lStrength;
|
|
||||||
$PostFXManager::Settings::SSAO::overallStrength = $SSAOPostFx::overallStrength;
|
|
||||||
$PostFXManager::Settings::SSAO::quality = $SSAOPostFx::quality;
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMax = $SSAOPostFx::sDepthMax;
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthMin = $SSAOPostFx::sDepthMin;
|
|
||||||
$PostFXManager::Settings::SSAO::sDepthPow = $SSAOPostFx::sDepthPow;
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalPow = $SSAOPostFx::sNormalPow;
|
|
||||||
$PostFXManager::Settings::SSAO::sNormalTol = $SSAOPostFx::sNormalTol;
|
|
||||||
$PostFXManager::Settings::SSAO::sRadius = $SSAOPostFx::sRadius;
|
|
||||||
$PostFXManager::Settings::SSAO::sStrength = $SSAOPostFx::sStrength;
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Settings Saved - SSAO");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyHDR(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::Settings::HDR::adaptRate = $HDRPostFX::adaptRate;
|
|
||||||
$PostFXManager::Settings::HDR::blueShiftColor = $HDRPostFX::blueShiftColor;
|
|
||||||
$PostFXManager::Settings::HDR::brightPassThreshold = $HDRPostFX::brightPassThreshold;
|
|
||||||
$PostFXManager::Settings::HDR::enableBloom = $HDRPostFX::enableBloom;
|
|
||||||
$PostFXManager::Settings::HDR::enableBlueShift = $HDRPostFX::enableBlueShift;
|
|
||||||
$PostFXManager::Settings::HDR::enableToneMapping = $HDRPostFX::enableToneMapping;
|
|
||||||
$PostFXManager::Settings::HDR::gaussMean = $HDRPostFX::gaussMean;
|
|
||||||
$PostFXManager::Settings::HDR::gaussMultiplier = $HDRPostFX::gaussMultiplier;
|
|
||||||
$PostFXManager::Settings::HDR::gaussStdDev = $HDRPostFX::gaussStdDev;
|
|
||||||
$PostFXManager::Settings::HDR::keyValue = $HDRPostFX::keyValue;
|
|
||||||
$PostFXManager::Settings::HDR::minLuminace = $HDRPostFX::minLuminace;
|
|
||||||
$PostFXManager::Settings::HDR::whiteCutoff = $HDRPostFX::whiteCutoff;
|
|
||||||
$PostFXManager::Settings::ColorCorrectionRamp = $HDRPostFX::colorCorrectionRamp;
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Settings Saved - HDR");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyLightRays(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar;
|
|
||||||
|
|
||||||
$PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples;
|
|
||||||
$PostFXManager::Settings::LightRays::density = $LightRayPostFX::density;
|
|
||||||
$PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight;
|
|
||||||
$PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay;
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Settings Saved - Light Rays");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyDOF(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::Settings::DOF::EnableAutoFocus = $DOFPostFx::EnableAutoFocus;
|
|
||||||
$PostFXManager::Settings::DOF::BlurMin = $DOFPostFx::BlurMin;
|
|
||||||
$PostFXManager::Settings::DOF::BlurMax = $DOFPostFx::BlurMax;
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMin = $DOFPostFx::FocusRangeMin;
|
|
||||||
$PostFXManager::Settings::DOF::FocusRangeMax = $DOFPostFx::FocusRangeMax;
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveNear = $DOFPostFx::BlurCurveNear;
|
|
||||||
$PostFXManager::Settings::DOF::BlurCurveFar = $DOFPostFx::BlurCurveFar;
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Settings Saved - DOF");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyVignette(%this)
|
|
||||||
{
|
|
||||||
$PostFXManager::Settings::Vignette::VMax = $VignettePostEffect::VMax;
|
|
||||||
$PostFXManager::Settings::Vignette::VMin = $VignettePostEffect::VMin;
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Settings Saved - Vignette");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyAll(%this, %sFrom)
|
|
||||||
{
|
|
||||||
// Apply settings which control if effects are on/off altogether.
|
|
||||||
$PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled;
|
|
||||||
$PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF;
|
|
||||||
$PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette;
|
|
||||||
$PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays;
|
|
||||||
$PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR;
|
|
||||||
$PostFXManager::Settings::EnableSSAO = $PostFXManager::PostFX::EnableSSAO;
|
|
||||||
|
|
||||||
// Apply settings should save the values in the system to the
|
|
||||||
// the preset structure ($PostFXManager::Settings::*)
|
|
||||||
|
|
||||||
// SSAO Settings
|
|
||||||
%this.settingsApplySSAO();
|
|
||||||
// HDR settings
|
|
||||||
%this.settingsApplyHDR();
|
|
||||||
// Light rays settings
|
|
||||||
%this.settingsApplyLightRays();
|
|
||||||
// DOF
|
|
||||||
%this.settingsApplyDOF();
|
|
||||||
// Vignette
|
|
||||||
%this.settingsApplyVignette();
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::settingsApplyDefaultPreset(%this)
|
|
||||||
{
|
|
||||||
PostFXManager::loadPresetHandler($PostFXManager::defaultPreset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,79 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// Used to name the saved files.
|
|
||||||
$PostFXManager::fileExtension = ".postfxpreset.cs";
|
|
||||||
|
|
||||||
// The filter string for file open/save dialogs.
|
|
||||||
$PostFXManager::fileFilter = "Post Effect Presets|*.postfxpreset.cs";
|
|
||||||
|
|
||||||
// Enable / disable PostFX when loading presets or just apply the settings?
|
|
||||||
$PostFXManager::forceEnableFromPresets = true;
|
|
||||||
|
|
||||||
//Load a preset file from the disk, and apply the settings to the
|
|
||||||
//controls. If bApplySettings is true - the actual values in the engine
|
|
||||||
//will be changed to reflect the settings from the file.
|
|
||||||
function PostFXManager::loadPresetFile()
|
|
||||||
{
|
|
||||||
//Show the dialog and set the flag
|
|
||||||
getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PostFXManager::loadPresetHandler( %filename )
|
|
||||||
{
|
|
||||||
//Check the validity of the file
|
|
||||||
if ( isScriptFile( %filename ) )
|
|
||||||
{
|
|
||||||
%filename = expandFilename(%filename);
|
|
||||||
postVerbose("% - PostFX Manager - Executing " @ %filename);
|
|
||||||
exec(%filename);
|
|
||||||
|
|
||||||
PostFXManager.settingsApplyFromPreset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Save a preset file to the specified file. The extension used
|
|
||||||
//is specified by $PostFXManager::fileExtension for on the fly
|
|
||||||
//name changes to the extension used.
|
|
||||||
|
|
||||||
function PostFXManager::savePresetFile(%this)
|
|
||||||
{
|
|
||||||
%defaultFile = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile);
|
|
||||||
getSaveFilename($PostFXManager::fileFilter, "PostFXManager::savePresetHandler", %defaultFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Called from the PostFXManager::savePresetFile() function
|
|
||||||
function PostFXManager::savePresetHandler( %filename )
|
|
||||||
{
|
|
||||||
%filename = makeRelativePath( %filename, getMainDotCsDir() );
|
|
||||||
if(strStr(%filename, ".") == -1)
|
|
||||||
%filename = %filename @ $PostFXManager::fileExtension;
|
|
||||||
|
|
||||||
//Apply the current settings to the preset
|
|
||||||
PostFXManager.settingsApplyAll();
|
|
||||||
|
|
||||||
export("$PostFXManager::Settings::*", %filename, false);
|
|
||||||
|
|
||||||
postVerbose("% - PostFX Manager - Save complete. Preset saved at : " @ %filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,302 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
$SSAOPostFx::overallStrength = 2.0;
|
|
||||||
|
|
||||||
// TODO: Add small/large param docs.
|
|
||||||
|
|
||||||
// The small radius SSAO settings.
|
|
||||||
$SSAOPostFx::sRadius = 0.1;
|
|
||||||
$SSAOPostFx::sStrength = 6.0;
|
|
||||||
$SSAOPostFx::sDepthMin = 0.1;
|
|
||||||
$SSAOPostFx::sDepthMax = 1.0;
|
|
||||||
$SSAOPostFx::sDepthPow = 1.0;
|
|
||||||
$SSAOPostFx::sNormalTol = 0.0;
|
|
||||||
$SSAOPostFx::sNormalPow = 1.0;
|
|
||||||
|
|
||||||
// The large radius SSAO settings.
|
|
||||||
$SSAOPostFx::lRadius = 1.0;
|
|
||||||
$SSAOPostFx::lStrength = 10.0;
|
|
||||||
$SSAOPostFx::lDepthMin = 0.2;
|
|
||||||
$SSAOPostFx::lDepthMax = 2.0;
|
|
||||||
$SSAOPostFx::lDepthPow = 0.2;
|
|
||||||
$SSAOPostFx::lNormalTol = -0.5;
|
|
||||||
$SSAOPostFx::lNormalPow = 2.0;
|
|
||||||
|
|
||||||
/// Valid values: 0, 1, 2
|
|
||||||
$SSAOPostFx::quality = 0;
|
|
||||||
|
|
||||||
///
|
|
||||||
$SSAOPostFx::blurDepthTol = 0.001;
|
|
||||||
|
|
||||||
///
|
|
||||||
$SSAOPostFx::blurNormalTol = 0.95;
|
|
||||||
|
|
||||||
///
|
|
||||||
$SSAOPostFx::targetScale = "0.5 0.5";
|
|
||||||
|
|
||||||
|
|
||||||
function SSAOPostFx::onAdd( %this )
|
|
||||||
{
|
|
||||||
%this.wasVis = "Uninitialized";
|
|
||||||
%this.quality = "Uninitialized";
|
|
||||||
}
|
|
||||||
|
|
||||||
function SSAOPostFx::preProcess( %this )
|
|
||||||
{
|
|
||||||
if ( $SSAOPostFx::quality !$= %this.quality )
|
|
||||||
{
|
|
||||||
%this.quality = mClamp( mRound( $SSAOPostFx::quality ), 0, 2 );
|
|
||||||
|
|
||||||
%this.setShaderMacro( "QUALITY", %this.quality );
|
|
||||||
}
|
|
||||||
|
|
||||||
%this.targetScale = $SSAOPostFx::targetScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SSAOPostFx::setShaderConsts( %this )
|
|
||||||
{
|
|
||||||
%this.setShaderConst( "$overallStrength", $SSAOPostFx::overallStrength );
|
|
||||||
|
|
||||||
// Abbreviate is s-small l-large.
|
|
||||||
|
|
||||||
%this.setShaderConst( "$sRadius", $SSAOPostFx::sRadius );
|
|
||||||
%this.setShaderConst( "$sStrength", $SSAOPostFx::sStrength );
|
|
||||||
%this.setShaderConst( "$sDepthMin", $SSAOPostFx::sDepthMin );
|
|
||||||
%this.setShaderConst( "$sDepthMax", $SSAOPostFx::sDepthMax );
|
|
||||||
%this.setShaderConst( "$sDepthPow", $SSAOPostFx::sDepthPow );
|
|
||||||
%this.setShaderConst( "$sNormalTol", $SSAOPostFx::sNormalTol );
|
|
||||||
%this.setShaderConst( "$sNormalPow", $SSAOPostFx::sNormalPow );
|
|
||||||
|
|
||||||
%this.setShaderConst( "$lRadius", $SSAOPostFx::lRadius );
|
|
||||||
%this.setShaderConst( "$lStrength", $SSAOPostFx::lStrength );
|
|
||||||
%this.setShaderConst( "$lDepthMin", $SSAOPostFx::lDepthMin );
|
|
||||||
%this.setShaderConst( "$lDepthMax", $SSAOPostFx::lDepthMax );
|
|
||||||
%this.setShaderConst( "$lDepthPow", $SSAOPostFx::lDepthPow );
|
|
||||||
%this.setShaderConst( "$lNormalTol", $SSAOPostFx::lNormalTol );
|
|
||||||
%this.setShaderConst( "$lNormalPow", $SSAOPostFx::lNormalPow );
|
|
||||||
|
|
||||||
%blur = %this->blurY;
|
|
||||||
%blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol );
|
|
||||||
%blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol );
|
|
||||||
|
|
||||||
%blur = %this->blurX;
|
|
||||||
%blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol );
|
|
||||||
%blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol );
|
|
||||||
|
|
||||||
%blur = %this->blurY2;
|
|
||||||
%blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol );
|
|
||||||
%blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol );
|
|
||||||
|
|
||||||
%blur = %this->blurX2;
|
|
||||||
%blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol );
|
|
||||||
%blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol );
|
|
||||||
}
|
|
||||||
|
|
||||||
function SSAOPostFx::onEnabled( %this )
|
|
||||||
{
|
|
||||||
// This tells the AL shaders to reload and sample
|
|
||||||
// from our #ssaoMask texture target.
|
|
||||||
$AL::UseSSAOMask = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SSAOPostFx::onDisabled( %this )
|
|
||||||
{
|
|
||||||
$AL::UseSSAOMask = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// GFXStateBlockData / ShaderData
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( SSAOStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampPoint;
|
|
||||||
samplerStates[1] = SamplerWrapLinear;
|
|
||||||
samplerStates[2] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton GFXStateBlockData( SSAOBlurStateBlock : PFX_DefaultStateBlock )
|
|
||||||
{
|
|
||||||
samplersDefined = true;
|
|
||||||
samplerStates[0] = SamplerClampLinear;
|
|
||||||
samplerStates[1] = SamplerClampPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( SSAOShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$deferredMap";
|
|
||||||
samplerNames[1] = "$randNormalTex";
|
|
||||||
samplerNames[2] = "$powTable";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( SSAOBlurYShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_P.glsl";
|
|
||||||
|
|
||||||
samplerNames[0] = "$occludeMap";
|
|
||||||
samplerNames[1] = "$deferredMap";
|
|
||||||
|
|
||||||
pixVersion = 3.0;
|
|
||||||
|
|
||||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( SSAOBlurXShader : SSAOBlurYShader )
|
|
||||||
{
|
|
||||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// PostEffects
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
singleton PostEffect( SSAOPostFx )
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
renderTime = "PFXBeforeBin";
|
|
||||||
renderBin = "AL_LightBinMgr";
|
|
||||||
renderPriority = 10;
|
|
||||||
|
|
||||||
shader = SSAOShader;
|
|
||||||
stateBlock = SSAOStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "#deferred";
|
|
||||||
texture[1] = "core/images/noise.png";
|
|
||||||
texture[2] = "#ssao_pow_table";
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
targetScale = "0.5 0.5";
|
|
||||||
targetViewport = "PFXTargetViewport_NamedInTexture0";
|
|
||||||
|
|
||||||
singleton PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "blurY";
|
|
||||||
|
|
||||||
shader = SSAOBlurYShader;
|
|
||||||
stateBlock = SSAOBlurStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "blurX";
|
|
||||||
|
|
||||||
shader = SSAOBlurXShader;
|
|
||||||
stateBlock = SSAOBlurStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "blurY2";
|
|
||||||
|
|
||||||
shader = SSAOBlurYShader;
|
|
||||||
stateBlock = SSAOBlurStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
|
|
||||||
target = "$outTex";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect()
|
|
||||||
{
|
|
||||||
internalName = "blurX2";
|
|
||||||
|
|
||||||
shader = SSAOBlurXShader;
|
|
||||||
stateBlock = SSAOBlurStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "$inTex";
|
|
||||||
texture[1] = "#deferred";
|
|
||||||
|
|
||||||
// We write to a mask texture which is then
|
|
||||||
// read by the lighting shaders to mask ambient.
|
|
||||||
target = "#ssaoMask";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// Just here for debug visualization of the
|
|
||||||
/// SSAO mask texture used during lighting.
|
|
||||||
singleton PostEffect( SSAOVizPostFx )
|
|
||||||
{
|
|
||||||
allowReflectPass = false;
|
|
||||||
|
|
||||||
shader = PFX_PassthruShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
|
|
||||||
texture[0] = "#ssaoMask";
|
|
||||||
|
|
||||||
target = "$backbuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton ShaderData( SSAOPowTableShader )
|
|
||||||
{
|
|
||||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_V.hlsl";
|
|
||||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_P.hlsl";
|
|
||||||
|
|
||||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_V.glsl";
|
|
||||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_P.glsl";
|
|
||||||
|
|
||||||
pixVersion = 2.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
singleton PostEffect( SSAOPowTablePostFx )
|
|
||||||
{
|
|
||||||
shader = SSAOPowTableShader;
|
|
||||||
stateBlock = PFX_DefaultStateBlock;
|
|
||||||
|
|
||||||
renderTime = "PFXTexGenOnDemand";
|
|
||||||
|
|
||||||
target = "#ssao_pow_table";
|
|
||||||
|
|
||||||
targetFormat = "GFXFormatR16F";
|
|
||||||
targetSize = "256 1";
|
|
||||||
};
|
|
||||||