Initial implementation of the new Base Game Template and some starting modules.

This makes some tweaks to the engine to support this, specifically, it tweaks the hardcoded shaderpaths to defer to a pref variable, so none of the shader paths are hardcoded.

Also tweaks how post effects read in texture files, removing a bizzare filepath interpretation choice, where if the file path didn't start with "/" it forcefully appended the script's file path. This made it impossible to have images not in the same dir as the script file defining the post effect.

This was changed and the existing template's post effects tweaked for now to just add "./" to those few paths impacted, as well as the perf vars to support the non-hardcoded shader paths in the engine.
This commit is contained in:
Areloch 2017-02-24 02:40:56 -06:00
parent 5c8a82180b
commit 1ed8b05169
1572 changed files with 146699 additions and 85 deletions

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationGLSL::WindDeformationGLSL()
: mDep( "shaders/common/gl/wind.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/wind.glsl" ))
{
addDependency( &mDep );
}

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationHLSL::WindDeformationHLSL()
: mDep( "shaders/common/wind.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/wind.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -670,8 +670,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
//shader model 4.0 is enough for the generic shaders
const char* shaderModel = "4.0";
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/colorV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/colorP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -680,8 +680,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/modColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/modColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSModColorTexture] = shaderData->getShader();
@ -690,8 +690,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/addColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/addColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSAddColorTexture] = shaderData->getShader();
@ -700,8 +700,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/textureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/textureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSTexture] = shaderData->getShader();

View file

@ -154,8 +154,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
ShaderData *shaderData;
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/colorV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/colorP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl"));
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -164,8 +164,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/modColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/modColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
@ -175,8 +175,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/addColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/addColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
@ -186,8 +186,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/textureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/textureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();

View file

@ -42,9 +42,9 @@ using namespace Torque;
S32 GFXTextureManager::smTextureReductionLevel = 0;
String GFXTextureManager::smMissingTexturePath("core/art/missingTexture");
String GFXTextureManager::smUnavailableTexturePath("core/art/unavailable");
String GFXTextureManager::smWarningTexturePath("core/art/warnmat");
String GFXTextureManager::smMissingTexturePath(Con::getVariable("$Core::MissingTexturePath"));
String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAvailableTexturePath"));
String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath"));
GFXTextureManager::EventSignal GFXTextureManager::smEventSignal;

View file

@ -780,8 +780,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
ShaderData *shaderData;
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/colorV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/colorP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorP.glsl"));
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -790,8 +790,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/modColorTextureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/modColorTextureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
@ -801,8 +801,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/addColorTextureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/addColorTextureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
@ -812,8 +812,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/textureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/textureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();

View file

@ -48,10 +48,10 @@ ConsoleDocClass( ShaderData,
"// Used for the procedural clould system\n"
"singleton ShaderData( CloudLayerShader )\n"
"{\n"
" DXVertexShaderFile = \"shaders/common/cloudLayerV.hlsl\";\n"
" DXPixelShaderFile = \"shaders/common/cloudLayerP.hlsl\";\n"
" OGLVertexShaderFile = \"shaders/common/gl/cloudLayerV.glsl\";\n"
" OGLPixelShaderFile = \"shaders/common/gl/cloudLayerP.glsl\";\n"
" DXVertexShaderFile = $Core::CommonShaderPath @ \"/cloudLayerV.hlsl\";\n"
" DXPixelShaderFile = $Core::CommonShaderPath @ \"/cloudLayerP.hlsl\";\n"
" OGLVertexShaderFile = $Core::CommonShaderPath @ \"/gl/cloudLayerV.glsl\";\n"
" OGLPixelShaderFile = $Core::CommonShaderPath @ \"/gl/cloudLayerP.glsl\";\n"
" pixVersion = 2.0;\n"
"};\n"
"@endtsexample\n\n"
@ -109,8 +109,8 @@ void ShaderData::initPersistFields()
"@tsexample\n"
"singleton ShaderData( FlashShader )\n"
"{\n"
"DXVertexShaderFile = \"shaders/common/postFx/flashV.hlsl\";\n"
"DXPixelShaderFile = \"shaders/common/postFx/flashP.hlsl\";\n\n"
"DXVertexShaderFile = $shaderGen::cachePath @ \"/postFx/flashV.hlsl\";\n"
"DXPixelShaderFile = $shaderGen::cachePath @ \"/postFx/flashP.hlsl\";\n\n"
" //Define setting the color of WHITE_COLOR.\n"
"defines = \"WHITE_COLOR=float4(1.0,1.0,1.0,0.0)\";\n\n"
"pixVersion = 2.0\n"

View file

@ -411,10 +411,6 @@ bool PostEffect::onAdd()
texFilename[0] == '#' )
continue;
// If '/', then path is specified, open normally
if ( texFilename[0] != '/' )
texFilename = scriptPath.getFullPath() + '/' + texFilename;
// Try to load the texture.
bool success = mTextures[i].set( texFilename, &PostFxTextureProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
if (!success)

View file

@ -236,7 +236,7 @@ void BumpFeatGLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatGLSL::ParallaxFeatGLSL()
: mIncludeDep( "shaders/common/gl/torque.glsl" )
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mIncludeDep );
}

View file

@ -30,7 +30,7 @@
PixelSpecularGLSL::PixelSpecularGLSL()
: mDep( "shaders/common/gl/lighting.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}

View file

@ -830,7 +830,7 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatGLSL::DiffuseMapFeatGLSL()
: mTorqueDep("shaders/common/gl/torque.glsl")
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl"))
{
addDependency(&mTorqueDep);
}
@ -1975,7 +1975,7 @@ void ReflectCubeFeatGLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatGLSL::RTLightingFeatGLSL()
: mDep( "shaders/common/gl/lighting.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}
@ -2190,7 +2190,7 @@ ShaderFeature::Resources RTLightingFeatGLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatGLSL::FogFeatGLSL()
: mFogDep( "shaders/common/gl/torque.glsl" )
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mFogDep );
}
@ -2321,7 +2321,7 @@ ShaderFeature::Resources FogFeatGLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatGLSL::VisibilityFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2487,7 +2487,7 @@ void RenderTargetZeroGLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutGLSL::HDROutGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2508,7 +2508,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureGLSL::FoliageFeatureGLSL()
: mDep( "shaders/common/gl/foliage.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/foliage.glsl" ))
{
addDependency( &mDep );
}
@ -2654,7 +2654,7 @@ void ParticleNormalFeatureGLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureGLSL::ImposterVertFeatureGLSL()
: mDep( "shaders/common/gl/imposter.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/imposter.glsl" ))
{
addDependency( &mDep );
}

View file

@ -37,8 +37,8 @@ void ShaderGenPrinterGLSL::printShaderHeader( Stream& stream )
stream.write( dStrlen(header1), header1 );
// Cheap HLSL compatibility.
const char* header3 = "#include \"shaders/common/gl/hlslCompat.glsl\"\r\n";
stream.write( dStrlen(header3), header3 );
String header3 = String("#include \"") + String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/hlslCompat.glsl\"\r\n");
stream.write(dStrlen(header3), header3.c_str());
const char* header4 = "\r\n";
stream.write( dStrlen(header4), header4 );

View file

@ -268,7 +268,7 @@ void BumpFeatHLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatHLSL::ParallaxFeatHLSL()
: mIncludeDep( "shaders/common/torque.hlsl" )
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mIncludeDep );
}

View file

@ -30,7 +30,7 @@
PixelSpecularHLSL::PixelSpecularHLSL()
: mDep( "shaders/common/lighting.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -853,7 +853,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatHLSL::DiffuseMapFeatHLSL()
: mTorqueDep("shaders/common/torque.hlsl")
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl"))
{
addDependency(&mTorqueDep);
}
@ -2168,7 +2168,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatHLSL::RTLightingFeatHLSL()
: mDep( "shaders/common/lighting.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}
@ -2383,7 +2383,7 @@ ShaderFeature::Resources RTLightingFeatHLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatHLSL::FogFeatHLSL()
: mFogDep( "shaders/common/torque.hlsl" )
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mFogDep );
}
@ -2514,7 +2514,7 @@ ShaderFeature::Resources FogFeatHLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatHLSL::VisibilityFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2681,7 +2681,7 @@ void RenderTargetZeroHLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutHLSL::HDROutHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2702,7 +2702,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureHLSL::FoliageFeatureHLSL()
: mDep( "shaders/common/foliage.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/foliage.hlsl" ))
{
addDependency( &mDep );
}
@ -2848,7 +2848,7 @@ void ParticleNormalFeatureHLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureHLSL::ImposterVertFeatureHLSL()
: mDep( "shaders/common/imposter.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/imposter.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -70,7 +70,7 @@ MODULE_END;
TerrainFeatGLSL::TerrainFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -297,8 +297,8 @@ U32 TerrainBaseMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) co
}
TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" ),
mTerrainDep( "shaders/common/terrain/terrain.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" ))
{
addDependency( &mTorqueDep );
@ -667,8 +667,8 @@ U32 TerrainDetailMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatGLSL::TerrainMacroMapFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" ),
mTerrainDep( "shaders/common/terrain/terrain.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" ))
{
addDependency( &mTorqueDep );

View file

@ -69,7 +69,7 @@ MODULE_END;
TerrainFeatHLSL::TerrainFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -315,8 +315,8 @@ U32 TerrainBaseMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) co
}
TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" ),
mTerrainDep( "shaders/common/terrain/terrain.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" ))
{
addDependency( &mTorqueDep );
@ -692,8 +692,8 @@ U32 TerrainDetailMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" ),
mTerrainDep( "shaders/common/terrain/terrain.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" ))
{
addDependency( &mTorqueDep );

View file

@ -0,0 +1 @@
# Project-specific Cmake configurations go here

View file

@ -0,0 +1 @@
for /R %%a IN (*.dae) do IF EXIST "%%~pna.cached.dts" del "%%~pna.cached.dts"

View file

@ -0,0 +1,15 @@
#!/bin/sh
cd "`dirname "$0"`"
for i in $(find . -type f \( -iname "*.dae" \))
do
len=$((${#i} - 4))
file=${i:0:$len}.cached.dts
if [ -e $file ]
then
echo "Removing ${file}"
rm $file
fi
done

View file

@ -0,0 +1,6 @@
for /R %%a IN (*.cs) do IF EXIST "%%a.dso" del "%%a.dso"
for /R %%a IN (*.cs) do IF EXIST "%%a.edso" del "%%a.edso"
for /R %%a IN (*.gui) do IF EXIST "%%a.dso" del "%%a.dso"
for /R %%a IN (*.gui) do IF EXIST "%%a.edso" del "%%a.edso"
for /R %%a IN (*.ts) do IF EXIST "%%a.dso" del "%%a.dso"
for /R %%a IN (*.ts) do IF EXIST "%%a.edso" del "%%a.edso"

View file

@ -0,0 +1,19 @@
#!/bin/sh
cd "`dirname "$0"`"
for i in $(find . -type f \( -iname "*.cs" \))
do
file=${i}.dso
if [ -e $file ]
then
echo "Removing ${file}"
rm $file
fi
file=${i}.edso
if [ -e $file ]
then
echo "Removing ${file}"
rm $file
fi
done

View file

@ -0,0 +1,6 @@
del /s prefs.cs
del /s config.cs
del /s banlist.cs
del /s config.cs.dso
del /s prefs.cs.dso
del /s banlist.cs.dso

View file

@ -0,0 +1,3 @@
#!/bin/sh
find "`dirname "$0"`" -type f \( -name "prefs.cs" -or -name "config.cs" -or -name "banlist.cs" -or -name "prefs.cs.dso" -or -name "config.cs.dso" -or -name "banlist.cs.dso" \) -exec rm {} \;

View file

@ -0,0 +1,7 @@
REM Delete procedural shaders
del /q /a:-R game\shaders\procedural\*.*
REM Delete dumped shader disassembly files
del /q /s /a:-R *_dis.txt

View file

@ -0,0 +1,4 @@
#!/bin/sh
cd "`dirname "$0"`"
rm -rf game/shaders/procedural/*.*

View file

@ -0,0 +1 @@
<exports/>

View file

@ -0,0 +1,436 @@
//-----------------------------------------------------------------------------
// 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();
}*/

View file

@ -0,0 +1,162 @@
//-----------------------------------------------------------------------------
// 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;
}

View file

@ -0,0 +1,51 @@
new GuiControl(ConsoleDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiConsoleEditCtrl(ConsoleEntry) {
profile = "ConsoleTextEditProfile";
horizSizing = "width";
vertSizing = "top";
position = "0 462";
extent = "640 18";
minExtent = "8 8";
visible = "1";
altCommand = "ConsoleEntry::eval();";
helpTag = "0";
maxLength = "255";
historySize = "40";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "1";
useSiblingScroller = "1";
};
new GuiScrollCtrl() {
internalName = "Scroll";
profile = "ConsoleScrollProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 462";
minExtent = "8 8";
visible = "1";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOn";
vScrollBar = "alwaysOn";
lockHorizScroll = "false";
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiConsole( ConsoleMessageLogView ) {
profile = "GuiConsoleProfile";
position = "0 0";
};
};
};

View file

@ -0,0 +1,108 @@
//-----------------------------------------------------------------------------
// 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::setAlpha( %this, %alpha)
{
if (%alpha $= "")
ConsoleScrollProfile.fillColor = $ConsoleDefaultFillColor;
else
ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0;
}

View file

@ -0,0 +1,70 @@
//-----------------------------------------------------------------------------
// 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";
};

View file

@ -0,0 +1,102 @@
//-----------------------------------------------------------------------------
// 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);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,55 @@
//-----------------------------------------------------------------------------
// 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;
};

View file

@ -0,0 +1,79 @@
//-----------------------------------------------------------------------------
// 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;
};

View file

@ -0,0 +1,48 @@
//-----------------------------------------------------------------------------
// 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;
};

View file

@ -0,0 +1,140 @@
//-----------------------------------------------------------------------------
// 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] = "$prepassTex";
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( VolumetricFogPrePassShader )
{
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] = "$prepassTex";
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;
};

View file

@ -0,0 +1,36 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
/// 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;
};

View file

@ -0,0 +1,208 @@
//-----------------------------------------------------------------------------
// 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] = "$prepassTex"; // #prepass
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; // #prepass
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["prepassTex"] = "#prepass";
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["prepassTex"] = "#prepass";
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["prepassTex"] = "#prepass";
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["prepassTex"] = "#prepass";
sampler["refractBuff"] = "$backbuff";
shader = UnderWaterBasicShader;
stateBlock = UnderWaterBasicStateBlock;
version = 2.0;
};

View file

@ -0,0 +1,36 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// 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;
}

View file

@ -0,0 +1,36 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// 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;
}

View file

@ -0,0 +1,39 @@
//-----------------------------------------------------------------------------
// 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);

View file

@ -0,0 +1,36 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// 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;
}

View file

@ -0,0 +1,26 @@
//-----------------------------------------------------------------------------
// 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.

View file

@ -0,0 +1,102 @@
//-----------------------------------------------------------------------------
// 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 = "";
// 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";

View file

@ -0,0 +1,528 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Check if a script file exists, compiled or not.
function isScriptFile(%path)
{
if( isFile(%path @ ".dso") || isFile(%path) )
return true;
return false;
}
function loadMaterials()
{
// Load any materials files for which we only have DSOs.
for( %file = findFirstFile( "*/materials.cs.dso" );
%file !$= "";
%file = findNextFile( "*/materials.cs.dso" ))
{
// Only execute, if we don't have the source file.
%csFileName = getSubStr( %file, 0, strlen( %file ) - 4 );
if( !isFile( %csFileName ) )
exec( %csFileName );
}
// Load all source material files.
for( %file = findFirstFile( "*/materials.cs" );
%file !$= "";
%file = findNextFile( "*/materials.cs" ))
{
exec( %file );
}
// Load all materials created by the material editor if
// the folder exists
if( IsDirectory( "materialEditor" ) )
{
for( %file = findFirstFile( "materialEditor/*.cs.dso" );
%file !$= "";
%file = findNextFile( "materialEditor/*.cs.dso" ))
{
// Only execute, if we don't have the source file.
%csFileName = getSubStr( %file, 0, strlen( %file ) - 4 );
if( !isFile( %csFileName ) )
exec( %csFileName );
}
for( %file = findFirstFile( "materialEditor/*.cs" );
%file !$= "";
%file = findNextFile( "materialEditor/*.cs" ))
{
exec( %file );
}
}
}
function reloadMaterials()
{
reloadTextures();
loadMaterials();
reInitMaterials();
}
function loadDatablockFiles( %datablockFiles, %recurse )
{
if ( %recurse )
{
recursiveLoadDatablockFiles( %datablockFiles, 9999 );
return;
}
%count = %datablockFiles.count();
for ( %i=0; %i < %count; %i++ )
{
%file = %datablockFiles.getKey( %i );
if ( !isFile(%file @ ".dso") && !isFile(%file) )
continue;
exec( %file );
}
// Destroy the incoming list.
//%datablockFiles.delete();
}
function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors )
{
%reloadDatablockFiles = new ArrayObject();
// Keep track of the number of datablocks that
// failed during this pass.
%failedDatablocks = 0;
// Try re-executing the list of datablock files.
%count = %datablockFiles.count();
for ( %i=0; %i < %count; %i++ )
{
%file = %datablockFiles.getKey( %i );
if ( !isFile(%file @ ".dso") && !isFile(%file) )
continue;
// Start counting copy constructor creation errors.
$Con::objectCopyFailures = 0;
exec( %file );
// If errors occured then store this file for re-exec later.
if ( $Con::objectCopyFailures > 0 )
{
%reloadDatablockFiles.add( %file );
%failedDatablocks = %failedDatablocks + $Con::objectCopyFailures;
}
}
// Clear the object copy failure counter so that
// we get console error messages again.
$Con::objectCopyFailures = -1;
// Delete the old incoming list... we're done with it.
//%datablockFiles.delete();
// If we still have datablocks to retry.
%newCount = %reloadDatablockFiles.count();
if ( %newCount > 0 )
{
// If the datablock failures have not been reduced
// from the last pass then we must have a real syntax
// error and not just a bad dependancy.
if ( %previousErrors > %failedDatablocks )
recursiveLoadDatablockFiles( %reloadDatablockFiles, %failedDatablocks );
else
{
// Since we must have real syntax errors do one
// last normal exec to output error messages.
loadDatablockFiles( %reloadDatablockFiles, false );
}
return;
}
// Cleanup the empty reload list.
%reloadDatablockFiles.delete();
}
function getPrefpath()
{
%temp = getUserHomeDirectory();
echo(%temp);
if(!isDirectory(%temp))
{
%temp = getUserDataDirectory();
echo(%temp);
if(!isDirectory(%temp))
{
$prefpath = "data";
}
else
{
//put it in appdata/roaming
$prefpath = %temp @ "/" @ $appName @ "/preferences";
}
}
else
{
//put it in user/documents
$prefPath = %temp @ "/" @ $appName @ "/preferences";
}
return $prefPath;
}
function updateTSShapeLoadProgress(%progress, %msg)
{
// Check if the loading GUI is visible and use that instead of the
// separate import progress GUI if possible
if ( isObject(LoadingGui) && LoadingGui.isAwake() )
{
// Save/Restore load progress at the start/end of the import process
if ( %progress == 0 )
{
ColladaImportProgress.savedProgress = LoadingProgress.getValue();
ColladaImportProgress.savedText = LoadingProgressTxt.getValue();
ColladaImportProgress.msgPrefix = "Importing " @ %msg;
%msg = "Reading file into memory...";
}
else if ( %progress == 1.0 )
{
LoadingProgress.setValue( ColladaImportProgress.savedProgress );
LoadingProgressTxt.setValue( ColladaImportProgress.savedText );
}
%msg = ColladaImportProgress.msgPrefix @ ": " @ %msg;
%progressCtrl = LoadingProgress;
%textCtrl = LoadingProgressTxt;
}
else
{
//it's probably the editors using it
if(isFunction("updateToolTSShapeLoadProgress"))
{
updateToolTSShapeLoadProgress(%progress, %msg);
}
}
// Update progress indicators
if (%progress == 0)
{
%progressCtrl.setValue(0.001);
%textCtrl.setText(%msg);
}
else if (%progress != 1.0)
{
%progressCtrl.setValue(%progress);
%textCtrl.setText(%msg);
}
Canvas.repaint(33);
}
/// A helper function which will return the ghosted client object
/// from a server object when connected to a local server.
function serverToClientObject( %serverObject )
{
assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" );
assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" );
%ghostId = LocalClientConnection.getGhostId( %serverObject );
if ( %ghostId == -1 )
return 0;
return ServerConnection.resolveGhostID( %ghostId );
}
//----------------------------------------------------------------------------
// Debug commands
//----------------------------------------------------------------------------
function netSimulateLag( %msDelay, %packetLossPercent )
{
if ( %packetLossPercent $= "" )
%packetLossPercent = 0;
commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent );
}
//Various client functions
function validateDatablockName(%name)
{
// remove whitespaces at beginning and end
%name = trim( %name );
// remove numbers at the beginning
%numbers = "0123456789";
while( strlen(%name) > 0 )
{
// the first character
%firstChar = getSubStr( %name, 0, 1 );
// if the character is a number remove it
if( strpos( %numbers, %firstChar ) != -1 )
{
%name = getSubStr( %name, 1, strlen(%name) -1 );
%name = ltrim( %name );
}
else
break;
}
// replace whitespaces with underscores
%name = strreplace( %name, " ", "_" );
// remove any other invalid characters
%invalidCharacters = "-+*/%$&§=()[].?\"#,;!~<>|°^{}";
%name = stripChars( %name, %invalidCharacters );
if( %name $= "" )
%name = "Unnamed";
return %name;
}
//--------------------------------------------------------------------------
// Finds location of %word in %text, starting at %start. Works just like strPos
//--------------------------------------------------------------------------
function wordPos(%text, %word, %start)
{
if (%start $= "") %start = 0;
if (strpos(%text, %word, 0) == -1) return -1;
%count = getWordCount(%text);
if (%start >= %count) return -1;
for (%i = %start; %i < %count; %i++)
{
if (getWord( %text, %i) $= %word) return %i;
}
return -1;
}
//--------------------------------------------------------------------------
// Finds location of %field in %text, starting at %start. Works just like strPos
//--------------------------------------------------------------------------
function fieldPos(%text, %field, %start)
{
if (%start $= "") %start = 0;
if (strpos(%text, %field, 0) == -1) return -1;
%count = getFieldCount(%text);
if (%start >= %count) return -1;
for (%i = %start; %i < %count; %i++)
{
if (getField( %text, %i) $= %field) return %i;
}
return -1;
}
//--------------------------------------------------------------------------
// returns the text in a file with "\n" at the end of each line
//--------------------------------------------------------------------------
function loadFileText( %file)
{
%fo = new FileObject();
%fo.openForRead(%file);
%text = "";
while(!%fo.isEOF())
{
%text = %text @ %fo.readLine();
if (!%fo.isEOF()) %text = %text @ "\n";
}
%fo.delete();
return %text;
}
function setValueSafe(%dest, %val)
{
%cmd = %dest.command;
%alt = %dest.altCommand;
%dest.command = "";
%dest.altCommand = "";
%dest.setValue(%val);
%dest.command = %cmd;
%dest.altCommand = %alt;
}
function shareValueSafe(%source, %dest)
{
setValueSafe(%dest, %source.getValue());
}
function shareValueSafeDelay(%source, %dest, %delayMs)
{
schedule(%delayMs, 0, shareValueSafe, %source, %dest);
}
//------------------------------------------------------------------------------
// An Aggregate Control is a plain GuiControl that contains other controls,
// which all share a single job or represent a single value.
//------------------------------------------------------------------------------
// AggregateControl.setValue( ) propagates the value to any control that has an
// internal name.
function AggregateControl::setValue(%this, %val, %child)
{
for(%i = 0; %i < %this.getCount(); %i++)
{
%obj = %this.getObject(%i);
if( %obj == %child )
continue;
if(%obj.internalName !$= "")
setValueSafe(%obj, %val);
}
}
// AggregateControl.getValue() uses the value of the first control that has an
// internal name, if it has not cached a value via .setValue
function AggregateControl::getValue(%this)
{
for(%i = 0; %i < %this.getCount(); %i++)
{
%obj = %this.getObject(%i);
if(%obj.internalName !$= "")
{
//error("obj = " @ %obj.getId() @ ", " @ %obj.getName() @ ", " @ %obj.internalName );
//error(" value = " @ %obj.getValue());
return %obj.getValue();
}
}
}
// AggregateControl.updateFromChild( ) is called by child controls to propagate
// a new value, and to trigger the onAction() callback.
function AggregateControl::updateFromChild(%this, %child)
{
%val = %child.getValue();
if(%val == mCeil(%val)){
%val = mCeil(%val);
}else{
if ( %val <= -100){
%val = mCeil(%val);
}else if ( %val <= -10){
%val = mFloatLength(%val, 1);
}else if ( %val < 0){
%val = mFloatLength(%val, 2);
}else if ( %val >= 1000){
%val = mCeil(%val);
}else if ( %val >= 100){
%val = mFloatLength(%val, 1);
}else if ( %val >= 10){
%val = mFloatLength(%val, 2);
}else if ( %val > 0){
%val = mFloatLength(%val, 3);
}
}
%this.setValue(%val, %child);
%this.onAction();
}
// default onAction stub, here only to prevent console spam warnings.
function AggregateControl::onAction(%this)
{
}
// call a method on all children that have an internalName and that implement the method.
function AggregateControl::callMethod(%this, %method, %args)
{
for(%i = 0; %i < %this.getCount(); %i++)
{
%obj = %this.getObject(%i);
if(%obj.internalName !$= "" && %obj.isMethod(%method))
eval(%obj @ "." @ %method @ "( " @ %args @ " );");
}
}
// A function used in order to easily parse the MissionGroup for classes . I'm pretty
// sure at this point the function can be easily modified to search the any group as well.
function parseMissionGroup( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = "MissionGroup";
else
%currentGroup = %childGroup;
for(%i = 0; %i < (%currentGroup).getCount(); %i++)
{
if( (%currentGroup).getObject(%i).getClassName() $= %className )
return true;
if( (%currentGroup).getObject(%i).getClassName() $= "SimGroup" )
{
if( parseMissionGroup( %className, (%currentGroup).getObject(%i).getId() ) )
return true;
}
}
}
// A variation of the above used to grab ids from the mission group based on classnames
function parseMissionGroupForIds( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = "MissionGroup";
else
%currentGroup = %childGroup;
for(%i = 0; %i < (%currentGroup).getCount(); %i++)
{
if( (%currentGroup).getObject(%i).getClassName() $= %className )
%classIds = %classIds @ (%currentGroup).getObject(%i).getId() @ " ";
if( (%currentGroup).getObject(%i).getClassName() $= "SimGroup" )
%classIds = %classIds @ parseMissionGroupForIds( %className, (%currentGroup).getObject(%i).getId());
}
return trim( %classIds );
}
//------------------------------------------------------------------------------
// Altered Version of TGB's QuickEditDropDownTextEditCtrl
//------------------------------------------------------------------------------
function QuickEditDropDownTextEditCtrl::onRenameItem( %this )
{
}
function QuickEditDropDownTextEditCtrl::updateFromChild( %this, %ctrl )
{
if( %ctrl.internalName $= "PopUpMenu" )
{
%this->TextEdit.setText( %ctrl.getText() );
}
else if ( %ctrl.internalName $= "TextEdit" )
{
%popup = %this->PopupMenu;
%popup.changeTextById( %popup.getSelected(), %ctrl.getText() );
%this.onRenameItem();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

View file

@ -0,0 +1,39 @@
//-----------------------------------------------------------------------------
// 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( BlankWhite )
{
diffuseMap[0] = "data/art/white";
mapTo = "white";
materialTag0 = "Miscellaneous";
};
singleton Material( Empty )
{
};
singleton Material(WarningMaterial) {
detailMap[0] = "missingTexture";
diffuseColor[0] = "25 16 0";
emissive[0] = false;
translucent = false;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -0,0 +1,74 @@
//-----------------------------------------------------------------------------
// 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 @ "();" );
}

View file

@ -0,0 +1,147 @@
singleton ShaderData( ClearGBufferShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/deferredClearGBufferP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/deferredClearGBufferP.glsl";
pixVersion = 2.0;
};
singleton ShaderData( DeferredColorShader )
{
DXVertexShaderFile = "data/shaders/common/lighting/advanced/deferredClearGBufferV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/deferredColorShaderP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/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;
};
new ShaderData( AL_DeferredShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/deferredShadingP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/deferredShadingP.glsl";
samplerNames[0] = "colorBufferTex";
samplerNames[1] = "lightPrePassTex";
samplerNames[2] = "matInfoTex";
samplerNames[3] = "prepassTex";
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] = "#prepass";
target = "$backBuffer";
renderPriority = 10000;
allowReflectPass = true;
};
// Debug Shaders.
new ShaderData( AL_ColorBufferShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgColorBufferP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgColorBufferP.glsl";
samplerNames[0] = "colorBufferTex";
pixVersion = 2.0;
};
singleton PostEffect( AL_ColorBufferVisualize )
{
shader = AL_ColorBufferShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#color";
target = "$backBuffer";
renderPriority = 9999;
};
/// Toggles the visualization of the AL lighting specular power buffer.
function toggleColorBufferViz( %enable )
{
if ( %enable $= "" )
{
$AL_ColorBufferShaderVar = AL_ColorBufferVisualize.isEnabled() ? false : true;
AL_ColorBufferVisualize.toggle();
}
else if ( %enable )
{
AL_DeferredShading.disable();
AL_ColorBufferVisualize.enable();
}
else if ( !%enable )
{
AL_ColorBufferVisualize.disable();
AL_DeferredShading.enable();
}
}
new ShaderData( AL_SpecMapShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgSpecMapVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgSpecMapVisualizeP.glsl";
samplerNames[0] = "matinfoTex";
pixVersion = 2.0;
};
singleton PostEffect( AL_SpecMapVisualize )
{
shader = AL_SpecMapShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#matinfo";
target = "$backBuffer";
renderPriority = 9999;
};
/// Toggles the visualization of the AL lighting specular power buffer.
function toggleSpecMapViz( %enable )
{
if ( %enable $= "" )
{
$AL_SpecMapShaderVar = AL_SpecMapVisualize.isEnabled() ? false : true;
AL_SpecMapVisualize.toggle();
}
else if ( %enable )
AL_SpecMapVisualize.enable();
else if ( !%enable )
AL_SpecMapVisualize.disable();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

View file

@ -0,0 +1,80 @@
//-----------------------------------------------------------------------------
// 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( "./lightViz.cs" );
exec( "./shadowViz.cs" );
exec( "./shadowViz.gui" );
exec( "./deferredShading.cs" );
function onActivateAdvancedLM()
{
// Don't allow the offscreen target on OSX.
if ( $platform $= "macos" )
return;
// On the Xbox360 we know what will be enabled so don't do any trickery to
// disable MSAA
if ( $platform $= "xenon" )
return;
// 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" );
}

View file

@ -0,0 +1,294 @@
//-----------------------------------------------------------------------------
// 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( AL_DepthVisualizeState )
{
zDefined = true;
zEnable = false;
zWriteEnable = false;
samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // depth
samplerStates[1] = SamplerClampLinear; // viz color lookup
};
new GFXStateBlockData( AL_DefaultVisualizeState )
{
blendDefined = true;
blendEnable = true;
blendSrc = GFXBlendSrcAlpha;
blendDest = GFXBlendInvSrcAlpha;
zDefined = true;
zEnable = false;
zWriteEnable = false;
samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // #prepass
samplerStates[1] = SamplerClampLinear; // depthviz
};
new ShaderData( AL_DepthVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgDepthVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgDepthVisualizeP.glsl";
samplerNames[0] = "prepassTex";
samplerNames[1] = "depthViz";
pixVersion = 2.0;
};
singleton PostEffect( AL_DepthVisualize )
{
shader = AL_DepthVisualizeShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#prepass";
texture[1] = "core/lighting/advanced/depthviz";
target = "$backBuffer";
renderPriority = 9999;
};
function AL_DepthVisualize::onEnabled( %this )
{
AL_NormalsVisualize.disable();
AL_LightColorVisualize.disable();
AL_LightSpecularVisualize.disable();
$AL_NormalsVisualizeVar = false;
$AL_LightColorVisualizeVar = false;
$AL_LightSpecularVisualizeVar = false;
return true;
}
new ShaderData( AL_GlowVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgGlowVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgGlowVisualizeP.glsl";
samplerNames[0] = "glowBuffer";
pixVersion = 2.0;
};
singleton PostEffect( AL_GlowVisualize )
{
shader = AL_GlowVisualizeShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#glowbuffer";
target = "$backBuffer";
renderPriority = 9999;
};
new ShaderData( AL_NormalsVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgNormalVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgNormalVisualizeP.glsl";
samplerNames[0] = "prepassTex";
pixVersion = 2.0;
};
singleton PostEffect( AL_NormalsVisualize )
{
shader = AL_NormalsVisualizeShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#prepass";
target = "$backBuffer";
renderPriority = 9999;
};
function AL_NormalsVisualize::onEnabled( %this )
{
AL_DepthVisualize.disable();
AL_LightColorVisualize.disable();
AL_LightSpecularVisualize.disable();
$AL_DepthVisualizeVar = false;
$AL_LightColorVisualizeVar = false;
$AL_LightSpecularVisualizeVar = false;
return true;
}
new ShaderData( AL_LightColorVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgLightColorVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl";
samplerNames[0] = "lightPrePassTex";
pixVersion = 2.0;
};
singleton PostEffect( AL_LightColorVisualize )
{
shader = AL_LightColorVisualizeShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#lightinfo";
target = "$backBuffer";
renderPriority = 9999;
};
function AL_LightColorVisualize::onEnabled( %this )
{
AL_NormalsVisualize.disable();
AL_DepthVisualize.disable();
AL_LightSpecularVisualize.disable();
$AL_NormalsVisualizeVar = false;
$AL_DepthVisualizeVar = false;
$AL_LightSpecularVisualizeVar = false;
return true;
}
new ShaderData( AL_LightSpecularVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgLightSpecularVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl";
samplerNames[0] = "lightPrePassTex";
pixVersion = 2.0;
};
singleton PostEffect( AL_LightSpecularVisualize )
{
shader = AL_LightSpecularVisualizeShader;
stateBlock = AL_DefaultVisualizeState;
texture[0] = "#lightinfo";
target = "$backBuffer";
renderPriority = 9999;
};
function AL_LightSpecularVisualize::onEnabled( %this )
{
AL_NormalsVisualize.disable();
AL_DepthVisualize.disable();
AL_LightColorVisualize.disable();
$AL_NormalsVisualizeVar = false;
$AL_DepthVisualizeVar = false;
$AL_LightColorVisualizeVar = false;
return true;
}
/// Toggles the visualization of the AL depth buffer.
function toggleDepthViz( %enable )
{
if ( %enable $= "" )
{
$AL_DepthVisualizeVar = AL_DepthVisualize.isEnabled() ? false : true;
AL_DepthVisualize.toggle();
}
else if ( %enable )
AL_DepthVisualize.enable();
else if ( !%enable )
AL_DepthVisualize.disable();
}
/// Toggles the visualization of the AL depth buffer.
function toggleGlowViz( %enable )
{
if ( %enable $= "" )
{
$AL_GlowVisualizeVar = AL_GlowVisualize.isEnabled() ? false : true;
AL_GlowVisualize.toggle();
}
else if ( %enable )
AL_GlowVisualize.enable();
else if ( !%enable )
AL_GlowVisualize.disable();
}
/// Toggles the visualization of the AL normals buffer.
function toggleNormalsViz( %enable )
{
if ( %enable $= "" )
{
$AL_NormalsVisualizeVar = AL_NormalsVisualize.isEnabled() ? false : true;
AL_NormalsVisualize.toggle();
}
else if ( %enable )
AL_NormalsVisualize.enable();
else if ( !%enable )
AL_NormalsVisualize.disable();
}
/// Toggles the visualization of the AL lighting color buffer.
function toggleLightColorViz( %enable )
{
if ( %enable $= "" )
{
$AL_LightColorVisualizeVar = AL_LightColorVisualize.isEnabled() ? false : true;
AL_LightColorVisualize.toggle();
}
else if ( %enable )
AL_LightColorVisualize.enable();
else if ( !%enable )
AL_LightColorVisualize.disable();
}
/// Toggles the visualization of the AL lighting specular power buffer.
function toggleLightSpecularViz( %enable )
{
if ( %enable $= "" )
{
$AL_LightSpecularVisualizeVar = AL_LightSpecularVisualize.isEnabled() ? false : true;
AL_LightSpecularVisualize.toggle();
}
else if ( %enable )
AL_LightSpecularVisualize.enable();
else if ( !%enable )
AL_LightSpecularVisualize.disable();
}
function toggleBackbufferViz( %enable )
{
if ( %enable $= "" )
{
$AL_BackbufferVisualizeVar = AL_DeferredShading.isEnabled() ? true : false;
AL_DeferredShading.toggle();
}
else if ( %enable )
AL_DeferredShading.disable();
else if ( !%enable )
AL_DeferredShading.enable();
}

View file

@ -0,0 +1,276 @@
//-----------------------------------------------------------------------------
// 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] = "prePassBuffer";
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] = "$prePassBuffer";
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["prePassBuffer"] = "#prepass";
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] = "prePassBuffer";
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] = "$prePassBuffer";
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["prePassBuffer"] = "#prepass";
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] = "$prePassBuffer";
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["prePassBuffer"] = "#prepass";
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 prepass
/// materials for objects that do not have materials.
new Material( AL_DefaultPrePassMaterial )
{
// 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] = "$prePassBuffer";
pixVersion = 3.0;
};
new CustomMaterial( AL_ParticlePointLightMaterial )
{
shader = AL_ParticlePointLightShader;
stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass";
target = "lightinfo";
pixVersion = 3.0;
};

View file

@ -0,0 +1,116 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
new ShaderData( AL_ShadowVisualizeShader )
{
DXVertexShaderFile = "data/shaders/common/guiMaterialV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/advanced/dbgShadowVisualizeP.hlsl";
OGLVertexShaderFile = "data/shaders/common/gl/guiMaterialV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/advanced/gl/dbgShadowVisualizeP.glsl";
samplerNames[0] = "$shadowMap";
samplerNames[1] = "$depthViz";
pixVersion = 2.0;
};
new CustomMaterial( AL_ShadowVisualizeMaterial )
{
shader = AL_ShadowVisualizeShader;
stateBlock = AL_DepthVisualizeState;
sampler["shadowMap"] = "#AL_ShadowVizTexture";
sampler["depthViz"] = "depthviz";
pixVersion = 2.0;
};
singleton GuiControlProfile( AL_ShadowLabelTextProfile )
{
fontColor = "0 0 0";
autoSizeWidth = true;
autoSizeHeight = true;
justify = "left";
fontSize = 14;
};
/// Toggles the visualization of the pre-pass lighting buffer.
function toggleShadowViz()
{
if ( AL_ShadowVizOverlayCtrl.isAwake() )
{
setShadowVizLight( 0 );
Canvas.popDialog( AL_ShadowVizOverlayCtrl );
}
else
{
Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 );
_setShadowVizLight( EWorldEditor.getSelectedObject( 0 ) );
}
}
/// Called from the WorldEditor when an object is selected.
function _setShadowVizLight( %light, %force )
{
if ( !AL_ShadowVizOverlayCtrl.isAwake() )
return;
if ( AL_ShadowVizOverlayCtrl.isLocked() && !%force )
return;
// Resolve the object to the client side.
if ( isObject( %light ) )
{
%clientLight = serverToClientObject( %light );
%sizeAndAspect = setShadowVizLight( %clientLight );
}
AL_ShadowVizOverlayCtrl-->MatCtrl.setMaterial( "AL_ShadowVisualizeMaterial" );
%text = "ShadowViz";
if ( isObject( %light ) )
%text = %text @ " : " @ getWord( %sizeAndAspect, 0 ) @ " x " @ getWord( %sizeAndAspect, 1 );
AL_ShadowVizOverlayCtrl-->WindowCtrl.text = %text;
}
/// For convenience, push the viz dialog and set the light manually from the console.
function showShadowVizForLight( %light )
{
if ( !AL_ShadowVizOverlayCtrl.isAwake() )
Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 );
_setShadowVizLight( %light, true );
}
// Prevent shadowViz from changing lights in response to editor selection
// events until unlock is called. The only way a vis light will change while locked
// is if showShadowVizForLight is explicitly called by the user.
function lockShadowViz()
{
AL_ShadowVizOverlayCtrl.islocked = true;
}
function unlockShadowViz()
{
AL_ShadowVizOverlayCtrl.islocked = false;
}

View file

@ -0,0 +1,78 @@
//---------------------------------------------------------------------------------------------
// Torque 3D
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiModelessDialogProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
noCursor = true;
new GuiWindowCtrl() {
internalName = "WindowCtrl";
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "50 50";
Extent = "347 209";
MinExtent = "150 100";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "1";
minSize = "50 50";
EdgeSnap = "1";
text = "ShadowViz";
closeCommand = "toggleShadowViz();";
new GuiMaterialCtrl() {
internalName = "MatCtrl";
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "3 23";
Extent = "341 181";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Docking = "Client";
Margin = "2 2 2 2";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
materialName = "AL_ShadowVisualizeMaterial";
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,92 @@
//-----------------------------------------------------------------------------
// 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 = "data/shaders/common/projectedShadowV.hlsl";
DXPixelShaderFile = "data/shaders/common/projectedShadowP.hlsl";
OGLVertexShaderFile = "data/shaders/common/gl/projectedShadowV.glsl";
OGLPixelShaderFile = "data/shaders/common/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" );
}

View file

@ -0,0 +1,76 @@
//-----------------------------------------------------------------------------
// 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 = "data/shaders/common/lighting/basic/shadowFilterV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/basic/shadowFilterP.hlsl";
OGLVertexShaderFile = "data/shaders/common/lighting/basic/gl/shadowFilterV.glsl";
OGLPixelShaderFile = "data/shaders/common/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";
};
};

View file

@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
new ShaderData(BlurDepthShader)
{
DXVertexShaderFile = "data/shaders/common/lighting/shadowMap/boxFilterV.hlsl";
DXPixelShaderFile = "data/shaders/common/lighting/shadowMap/boxFilterP.hlsl";
OGLVertexShaderFile = "data/shaders/common/lighting/shadowMap/gl/boxFilterV.glsl";
OGLPixelShaderFile = "data/shaders/common/lighting/shadowMap/gl/boxFilterP.glsl";
pixVersion = 2.0;
};

View file

@ -0,0 +1,95 @@
//-----------------------------------------------------------------------------
// 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 = "data/shaders/common";
/// 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/shaders";
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");
// Seed the random number generator.
setRandomSeed();

View file

@ -0,0 +1,392 @@
//-----------------------------------------------------------------------------
// 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 );
}
}

View file

@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
// 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_PassthruShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFx/passthruP.hlsl";
// OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.glsl";
// OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFx/gl/passthruP.glsl";
samplerNames[0] = "$inputTex";
pixVersion = 2.0;
};
function PostEffect::inspectVars( %this )
{
%name = %this.getName();
%globals = "$" @ %name @ "::*";
inspectVars( %globals );
}
function PostEffect::viewDisassembly( %this )
{
%file = %this.dumpShaderDisassembly();
if ( %file $= "" )
{
echo( "PostEffect::viewDisassembly - no shader disassembly found." );
}
else
{
echo( "PostEffect::viewDisassembly - shader disassembly file dumped ( " @ %file @ " )." );
openFile( %file );
}
}
// Return true if we really want the effect enabled.
// By default this is the case.
function PostEffect::onEnabled( %this )
{
return true;
}

View file

@ -0,0 +1,226 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Set font cache path if it doesn't already exist.
if($Gui::fontCacheDirectory $= "")
{
$Gui::fontCacheDirectory = expandFilename("./fonts");
}
// ----------------------------------------------------------------------------
// GuiDefaultProfile is a special profile that all other profiles inherit
// defaults from. It must exist.
// ----------------------------------------------------------------------------
if(!isObject(GuiDefaultProfile))
new GuiControlProfile (GuiDefaultProfile)
{
tab = false;
canKeyFocus = false;
hasBitmapArray = false;
mouseOverSelected = false;
// fill color
opaque = false;
fillColor = "242 241 240";
fillColorHL ="228 228 235";
fillColorSEL = "98 100 137";
fillColorNA = "255 255 255 ";
// border color
border = 0;
borderColor = "100 100 100";
borderColorHL = "50 50 50 50";
borderColorNA = "75 75 75";
// font
fontType = "Arial";
fontSize = 14;
fontCharset = ANSI;
fontColor = "0 0 0";
fontColorHL = "0 0 0";
fontColorNA = "0 0 0";
fontColorSEL= "255 255 255";
// bitmap information
bitmap = "";
bitmapBase = "";
textOffset = "0 0";
// used by guiTextControl
modal = true;
justify = "left";
autoSizeWidth = false;
autoSizeHeight = false;
returnTab = false;
numbersOnly = false;
cursorColor = "0 0 0 255";
};
if(!isObject(GuiToolTipProfile))
new GuiControlProfile (GuiToolTipProfile)
{
// fill color
fillColor = "239 237 222";
// border color
borderColor = "138 134 122";
// font
fontType = "Arial";
fontSize = 14;
fontColor = "0 0 0";
category = "Core";
};
if(!isObject(GuiWindowProfile))
new GuiControlProfile (GuiWindowProfile)
{
opaque = false;
border = 2;
fillColor = "242 241 240";
fillColorHL = "221 221 221";
fillColorNA = "200 200 200";
fontColor = "50 50 50";
fontColorHL = "0 0 0";
bevelColorHL = "255 255 255";
bevelColorLL = "0 0 0";
text = "untitled";
bitmap = "./images/window";
textOffset = "8 4";
hasBitmapArray = true;
justify = "left";
category = "Core";
};
if(!isObject(GuiTextEditProfile))
new GuiControlProfile(GuiTextEditProfile)
{
opaque = true;
bitmap = "./images/textEdit";
hasBitmapArray = true;
border = -2;
fillColor = "242 241 240 0";
fillColorHL = "255 255 255";
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fontColorSEL = "98 100 137";
fontColorNA = "200 200 200";
textOffset = "4 2";
autoSizeWidth = false;
autoSizeHeight = true;
justify = "left";
tab = true;
canKeyFocus = true;
category = "Core";
};
if(!isObject(GuiScrollProfile))
new GuiControlProfile(GuiScrollProfile)
{
opaque = true;
fillcolor = "255 255 255";
fontColor = "0 0 0";
fontColorHL = "150 150 150";
border = true;
bitmap = "./images/scrollBar";
hasBitmapArray = true;
category = "Core";
};
if(!isObject(GuiOverlayProfile))
new GuiControlProfile(GuiOverlayProfile)
{
opaque = true;
fontColor = "0 0 0";
fontColorHL = "255 255 255";
fillColor = "0 0 0 100";
category = "Core";
};
if(!isObject(GuiCheckBoxProfile))
new GuiControlProfile(GuiCheckBoxProfile)
{
opaque = false;
fillColor = "232 232 232";
border = false;
borderColor = "100 100 100";
fontSize = 14;
fontColor = "20 20 20";
fontColorHL = "80 80 80";
fontColorNA = "200 200 200";
fixedExtent = true;
justify = "left";
bitmap = "./images/checkbox";
hasBitmapArray = true;
category = "Tools";
};
if( !isObject( GuiProgressProfile ) )
new GuiControlProfile( GuiProgressProfile )
{
opaque = false;
fillColor = "0 162 255 200";
border = true;
borderColor = "50 50 50 200";
category = "Core";
};
if( !isObject( GuiProgressBitmapProfile ) )
new GuiControlProfile( GuiProgressBitmapProfile )
{
border = false;
hasBitmapArray = true;
bitmap = "./images/loadingbar";
category = "Core";
};
if( !isObject( GuiProgressTextProfile ) )
new GuiControlProfile( GuiProgressTextProfile )
{
fontSize = "14";
fontType = "Arial";
fontColor = "0 0 0";
justify = "center";
category = "Core";
};
if( !isObject( GuiButtonProfile ) )
new GuiControlProfile( GuiButtonProfile )
{
opaque = true;
border = true;
fontColor = "50 50 50";
fontColorHL = "0 0 0";
fontColorNA = "200 200 200";
//fontColorSEL ="0 0 0";
fixedExtent = false;
justify = "center";
canKeyFocus = false;
bitmap = "./images/button";
hasBitmapArray = false;
category = "Core";
};

View file

@ -0,0 +1,125 @@
//-----------------------------------------------------------------------------
// 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 initRenderManager()
{
assert( !isObject( DiffuseRenderPassManager ), "initRenderManager() - DiffuseRenderPassManager already initialized!" );
new RenderPassManager( DiffuseRenderPassManager );
// This token, and the associated render managers, ensure that driver MSAA
// does not get used for Advanced Lighting renders. The 'AL_FormatResolve'
// PostEffect copies the result to the backbuffer.
new RenderFormatToken(AL_FormatToken)
{
enabled = "false";
format = getBestHDRFormat();
depthFormat = "GFXFormatD24S8";
aaLevel = 0; // -1 = match backbuffer
// The contents of the back buffer before this format token is executed
// is provided in $inTex
copyEffect = "AL_FormatCopy";
// The contents of the render target created by this format token is
// provided in $inTex
resolveEffect = "AL_FormatCopy";
};
DiffuseRenderPassManager.addManager( new RenderPassStateBin() { renderOrder = 0.001; stateToken = AL_FormatToken; } );
// We really need to fix the sky to render after all the
// meshes... but that causes issues in reflections.
DiffuseRenderPassManager.addManager( new RenderObjectMgr(SkyBin) { bintype = "Sky"; renderOrder = 0.1; processAddOrder = 0.1; } );
//DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } );
// Normal mesh rendering.
DiffuseRenderPassManager.addManager( new RenderTerrainMgr(TerrainBin) { renderOrder = 0.4; processAddOrder = 0.4; basicOnly = true; } );
DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } );
DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } );
DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } );
DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; } );
DiffuseRenderPassManager.addManager( new RenderOcclusionMgr(OccluderBin){ bintype = "Occluder"; renderOrder = 0.9; processAddOrder = 0.9; } );
// We now render translucent objects that should handle
// their own fogging and lighting.
// Note that the fog effect is triggered before this bin.
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjTranslucentBin) { bintype = "ObjectTranslucent"; renderOrder = 1.0; processAddOrder = 1.0; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(WaterBin) { bintype = "Water"; renderOrder = 1.2; processAddOrder = 1.2; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(FoliageBin) { bintype = "Foliage"; renderOrder = 1.3; processAddOrder = 1.3; } );
DiffuseRenderPassManager.addManager( new RenderParticleMgr(ParticleBin) { renderOrder = 1.35; processAddOrder = 1.35; } );
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr(TranslucentBin){ renderOrder = 1.4; processAddOrder = 1.4; } );
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
// Note that the GlowPostFx is triggered after this bin.
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
// We render any editor stuff from this bin. Note that the HDR is
// completed before this bin to keep editor elements from tone mapping.
DiffuseRenderPassManager.addManager( new RenderObjectMgr(EditorBin) { bintype = "Editor"; renderOrder = 1.6; processAddOrder = 1.6; } );
// Resolve format change token last.
DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } );
}
/// This is the Default PostFX state block. Put here to prevent any missing object
/// errors for below dependencies
singleton GFXStateBlockData( PFX_DefaultStateBlock )
{
zDefined = true;
zEnable = false;
zWriteEnable = false;
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
};
/// This post effect is used to copy data from the non-MSAA back-buffer to the
/// device back buffer (which could be MSAA). It must be declared here so that
/// it is initialized when 'AL_FormatToken' is initialzed.
singleton GFXStateBlockData( AL_FormatTokenState : PFX_DefaultStateBlock )
{
samplersDefined = true;
samplerStates[0] = SamplerClampPoint;
};
singleton PostEffect( AL_FormatCopy )
{
// This PostEffect is used by 'AL_FormatToken' directly. It is never added to
// the PostEffectManager. Do not call enable() on it.
isEnabled = false;
allowReflectPass = true;
shader = PFX_PassthruShader;
stateBlock = AL_FormatTokenState;
texture[0] = "$inTex";
target = "$backbuffer";
};

View file

@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// 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 SFXAmbience( AudioAmbienceDefault )
{
environment = AudioEnvOff;
};
singleton SFXAmbience( AudioAmbienceOutside )
{
environment = AudioEnvPlain;
states[ 0 ] = AudioLocationOutside;
};
singleton SFXAmbience( AudioAmbienceInside )
{
environment = AudioEnvRoom;
states[ 0 ] = AudioLocationInside;
};
singleton SFXAmbience( AudioAmbienceUnderwater )
{
environment = AudioEnvUnderwater;
states[ 0 ] = AudioLocationUnderwater;
};

View file

@ -0,0 +1,42 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Game specific audio descriptions. Always declare SFXDescription's (the type of sound)
// before SFXProfile's (the sound itself) when creating new ones
singleton SFXDescription(BulletFireDesc : AudioEffect )
{
isLooping = false;
is3D = true;
ReferenceDistance = 10.0;
MaxDistance = 60.0;
};
singleton SFXDescription(BulletImpactDesc : AudioEffect )
{
isLooping = false;
is3D = true;
ReferenceDistance = 10.0;
MaxDistance = 30.0;
volume = 0.4;
pitch = 1.4;
};

View file

@ -0,0 +1,143 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Always declare SFXDescription's (the type of sound) before SFXProfile's (the
// sound itself) when creating new ones
//-----------------------------------------------------------------------------
// 3D Sounds
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Single shot sounds
//-----------------------------------------------------------------------------
singleton SFXDescription( AudioDefault3D : AudioEffect )
{
is3D = true;
ReferenceDistance = 20.0;
MaxDistance = 100.0;
};
singleton SFXDescription( AudioSoft3D : AudioEffect )
{
is3D = true;
ReferenceDistance = 20.0;
MaxDistance = 100.0;
volume = 0.4;
};
singleton SFXDescription( AudioClose3D : AudioEffect )
{
is3D = true;
ReferenceDistance = 10.0;
MaxDistance = 60.0;
};
singleton SFXDescription( AudioClosest3D : AudioEffect )
{
is3D = true;
ReferenceDistance = 5.0;
MaxDistance = 10.0;
};
//-----------------------------------------------------------------------------
// Looping sounds
//-----------------------------------------------------------------------------
singleton SFXDescription( AudioDefaultLoop3D : AudioEffect )
{
isLooping = true;
is3D = true;
ReferenceDistance = 20.0;
MaxDistance = 100.0;
};
singleton SFXDescription( AudioCloseLoop3D : AudioEffect )
{
isLooping = true;
is3D = true;
ReferenceDistance = 18.0;
MaxDistance = 25.0;
};
singleton SFXDescription( AudioClosestLoop3D : AudioEffect )
{
isLooping = true;
is3D = true;
ReferenceDistance = 5.0;
MaxDistance = 10.0;
};
//-----------------------------------------------------------------------------
// 2d sounds
//-----------------------------------------------------------------------------
// Used for non-looping environmental sounds (like power on, power off)
singleton SFXDescription( Audio2D : AudioEffect )
{
isLooping = false;
};
// Used for Looping Environmental Sounds
singleton SFXDescription( AudioLoop2D : AudioEffect )
{
isLooping = true;
};
singleton SFXDescription( AudioStream2D : AudioEffect )
{
isStreaming = true;
};
singleton SFXDescription( AudioStreamLoop2D : AudioEffect )
{
isLooping = true;
isStreaming = true;
};
//-----------------------------------------------------------------------------
// Music
//-----------------------------------------------------------------------------
singleton SFXDescription( AudioMusic2D : AudioMusic )
{
isStreaming = true;
};
singleton SFXDescription( AudioMusicLoop2D : AudioMusic )
{
isLooping = true;
isStreaming = true;
};
singleton SFXDescription( AudioMusic3D : AudioMusic )
{
isStreaming = true;
is3D = true;
};
singleton SFXDescription( AudioMusicLoop3D : AudioMusic )
{
isStreaming = true;
is3D = true;
isLooping = true;
};

View file

@ -0,0 +1,916 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Reverb environment presets.
//
// For customized presets, best derive from one of these presets.
singleton SFXEnvironment( AudioEnvOff )
{
envSize = "7.5";
envDiffusion = "1.0";
room = "-10000";
roomHF = "-10000";
roomLF = "0";
decayTime = "1.0";
decayHFRatio = "1.0";
decayLFRatio = "1.0";
reflections = "-2602";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "200";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "0.0";
density = "0.0";
flags = 0x33;
};
singleton SFXEnvironment( AudioEnvGeneric )
{
envSize = "7.5";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-100";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.83";
decayLFRatio = "1.0";
reflections = "-2602";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "200";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvRoom )
{
envSize = "1.9";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-454";
roomLF = "0";
decayTime = "0.4";
decayHFRatio = "0.83";
decayLFRatio = "1.0";
reflections = "-1646";
reflectionsDelay = "0.002";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "53";
reverbDelay = "0.003";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvPaddedCell )
{
envSize = "1.4";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-6000";
roomLF = "0";
decayTime = "0.17";
decayHFRatio = "0.1";
decayLFRatio = "1.0";
reflections = "-1204";
reflectionsDelay = "0.001";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "207";
reverbDelay = "0.002";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvBathroom )
{
envSize = "1.4";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-1200";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.54";
decayLFRatio = "1.0";
reflections = "-370";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "1030";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "60.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvLivingRoom )
{
envSize = "2.5";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-6000";
roomLF = "0";
decayTime = "0.5";
decayHFRatio = "0.1";
decayLFRatio = "1.0";
reflections = "-1376";
reflectionsDelay = "0.003";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1104";
reverbDelay = "0.004";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvStoneRoom )
{
envSize = "11.6";
envDiffusion = "1.0";
room = "-1000";
roomHF = "300";
roomLF = "0";
decayTime = "2.31";
decayHFRatio = "0.64";
decayLFRatio = "1.0";
reflections = "-711";
reflectionsDelay = "0.012";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "83";
reverbDelay = "0.017";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "-5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvAuditorium )
{
envSize = "21.6";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-476";
roomLF = "0";
decayTime = "4.32";
decayHFRatio = "0.59";
decayLFRatio = "1.0";
reflections = "1";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-289";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvConcertHall )
{
envSize = "19.6";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-500";
roomLF = "0";
decayTime = "3.92";
decayHFRatio = "0.7";
decayLFRatio = "1.0";
reflections = "-1230";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-2";
reverbDelay = "0.029";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvCave )
{
envSize = "14.6";
envDiffusion = "1.0";
room = "-1000";
roomHF = "0";
roomLF = "0";
decayTime = "2.91";
decayHFRatio = "1.3";
decayLFRatio = "1.0";
reflections = "-602";
reflectionsDelay = "0.015";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-302";
reverbDelay = "0.022";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x1f;
};
singleton SFXEnvironment( AudioEnvArena )
{
envSize = "36.2f";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-698";
roomLF = "0";
decayTime = "7.24";
decayHFRatio = "0.33";
decayLFRatio = "1.0";
reflections = "-1166";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "16";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvHangar )
{
envSize = "50.3";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-1000";
roomLF = "0";
decayTime = "10.05";
decayHFRatio = "0.23";
decayLFRatio = "1.0";
reflections = "-602";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "198";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvCarpettedHallway )
{
envSize = "1.9";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-4000";
roomLF = "0";
decayTime = "0.3";
decayHFRatio = "0.1";
decayLFRatio = "1.0";
reflections = "-1831";
reflectionsDelay = "0.002";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1630";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvHallway )
{
envSize = "1.8";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-300";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.59";
decayLFRatio = "1.0";
reflections = "-1219";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "441";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvStoneCorridor )
{
envSize = "13.5";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-237";
roomLF = "0";
decayTime = "2.7";
decayHFRatio = "0.79";
decayLFRatio = "1.0";
reflections = "-1214";
reflectionsDelay = "0.013";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "395";
reverbDelay = "0.02";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvAlley )
{
envSize = "7.5";
envDiffusion = "0.3";
room = "-1000";
roomHF = "-270";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.86";
decayLFRatio = "1.0";
reflections = "-1204";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-4";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.125";
echoDepth = "0.95";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvForest )
{
envSize = "38.0";
envDiffusion = "0.3";
room = "-1000";
roomHF = "-3300";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.54";
decayLFRatio = "1.0";
reflections = "-2560";
reflectionsDelay = "0.162";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-229";
reverbDelay = "0.088";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.125";
echoDepth = "1.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "79.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvCity )
{
envSize = "7.5";
envDiffusion = "0.5";
room = "-1000";
roomHF = "-800";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.67";
decayLFRatio = "1.0";
reflections = "-2273";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1691";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "50.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvMountains )
{
envSize = "100.0";
envDiffusion = "0.27";
room = "-1000";
roomHF = "-2500";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.21";
decayLFRatio = "1.0";
reflections = "-2780";
reflectionsDelay = "0.3";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1434";
reverbDelay = "0.1";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "1.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "27.0";
density = "100.0";
flags = 0x1f;
};
singleton SFXEnvironment( AudioEnvQuary )
{
envSize = "17.5";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-1000";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.83";
decayLFRatio = "1.0";
reflections = "-10000";
reflectionsDelay = "0.061";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "500";
reverbDelay = "0.025";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.125";
echoDepth = "0.7";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvPlain )
{
envSize = "42.5";
envDiffusion = "0.21";
room = "-1000";
roomHF = "-2000";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.5";
decayLFRatio = "1.0";
reflections = "-2466";
reflectionsDelay = "0.179";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1926";
reverbDelay = "0.1";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "1.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "21.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvParkingLot )
{
envSize = "8.3";
envDiffusion = "1.0";
room = "-1000";
roomHF = "0";
roomLF = "0";
decayTime = "1.65";
decayHFRatio = "1.5";
decayLFRatio = "1.0";
reflections = "-1363";
reflectionsDelay = "0.008";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-1153";
reverbDelay = "0.012";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x1f;
};
singleton SFXEnvironment( AudioEnvSewerPipe )
{
envSize = "1.7";
envDiffusion = "0.8";
room = "-1000";
roomHF = "-1000";
roomLF = "0";
decayTime = "2.81";
decayHFRatio = "0.14";
decayLFRatio = "1.0";
reflections = "429";
reflectionsDelay = "0.014";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "1023";
reverbDelay = "0.21";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "0.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "80.0";
density = "60.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvUnderwater )
{
envSize = "1.8";
envDiffusion = "1.0";
room = "-1000";
roomHF = "-4000";
roomLF = "0";
decayTime = "1.49";
decayHFRatio = "0.1";
decayLFRatio = "1.0";
reflections = "-449";
reflectionsDelay = "0.007";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "1700";
reverbDelay = "0.011";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "1.18";
modulationDepth = "0.348";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x3f;
};
singleton SFXEnvironment( AudioEnvDrugged )
{
envSize = "1.9";
envDiffusion = "0.5";
room = "-1000";
roomHF = "0";
roomLF = "0";
decayTime = "8.39";
decayHFRatio = "1.39";
decayLFRatio = "1.0";
reflections = "-115";
reflectionsDelay = "0.002";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "985";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "0.25";
modulationDepth = "1.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x1f;
};
singleton SFXEnvironment( AudioEnvDizzy )
{
envSize = "1.8";
envDiffusion = "0.6";
room = "-1000.0";
roomHF = "-400";
roomLF = "0";
decayTime = "17.23";
decayHFRatio = "0.56";
decayLFRatio = "1.0";
reflections = "-1713";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "-613";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "1.0";
modulationTime = "0.81";
modulationDepth = "0.31";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x1f;
};
singleton SFXEnvironment( AudioEnvPsychotic )
{
envSize = "1.0";
envDiffusion = "0.5";
room = "-1000";
roomHF = "-151";
roomLF = "0";
decayTime = "7.56";
decayHFRatio = "0.91";
decayLFRatio = "1.0";
reflections = "-626";
reflectionsDelay = "0.02";
reflectionsPan[ 0 ] = "0.0";
reflectionsPan[ 1 ] = "0.0";
reflectionsPan[ 2 ] = "0.0";
reverb = "774";
reverbDelay = "0.03";
reverbPan[ 0 ] = "0.0";
reverbPan[ 1 ] = "0.0";
reverbPan[ 2 ] = "0.0";
echoTime = "0.25";
echoDepth = "0.0";
modulationTime = "4.0";
modulationDepth = "1.0";
airAbsorptionHF = "-5.0";
HFReference = "5000.0";
LFReference = "250.0";
roomRolloffFactor = "0.0";
diffusion = "100.0";
density = "100.0";
flags = 0x1f;
};

View file

@ -0,0 +1,158 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Some state presets.
/// Return the first active SFXState in the given SimSet/SimGroup.
function sfxGetActiveStateInGroup( %group )
{
%count = %group.getCount();
for( %i = 0; %i < %count; %i ++ )
{
%obj = %group.getObject( %i );
if( !%obj.isMemberOfClass( "SFXState" ) )
continue;
if( %obj.isActive() )
return %obj;
}
return 0;
}
//-----------------------------------------------------------------------------
// Special audio state that will always and only be active when no other
// state is active. Useful for letting slots apply specifically when no
// other slot in a list applies.
singleton SFXState( AudioStateNone ) {};
AudioStateNone.activate();
function SFXState::onActivate( %this )
{
if( %this.getId() != AudioStateNone.getId() )
AudioStateNone.disable();
}
function SFXState::onDeactivate( %this )
{
if( %this.getId() != AudioStateNone.getId() )
AudioStateNone.enable();
}
//-----------------------------------------------------------------------------
// AudioStateExclusive class.
//
// Automatically deactivates sibling SFXStates in its parent SimGroup
// when activated.
function AudioStateExclusive::onActivate( %this )
{
Parent::onActivate( %this );
%group = %this.parentGroup;
%count = %group.getCount();
for( %i = 0; %i < %count; %i ++ )
{
%obj = %group.getObject( %i );
if( %obj != %this && %obj.isMemberOfClass( "SFXState" ) && %obj.isActive() )
%obj.deactivate();
}
}
//-----------------------------------------------------------------------------
// Location-dependent states.
singleton SimGroup( AudioLocation );
/// State when the listener is outside.
singleton SFXState( AudioLocationOutside )
{
parentGroup = AudioLocation;
className = "AudioStateExclusive";
};
/// State when the listener is submerged.
singleton SFXState( AudioLocationUnderwater )
{
parentGroup = AudioLocation;
className = "AudioStateExclusive";
};
/// State when the listener is indoors.
singleton SFXState( AudioLocationInside )
{
parentGroup = AudioLocation;
className = "AudioStateExclusive";
};
/// Return the currently active SFXState in AudioLocation.
function sfxGetLocation()
{
return sfxGetActiveStateInGroup( AudioLocation );
}
//-----------------------------------------------------------------------------
// Mood-dependent states.
singleton SimGroup( AudioMood );
singleton SFXState( AudioMoodNeutral )
{
parentGroup = AudioMood;
className = "AudioStateExclusive";
};
singleton SFXState( AudioMoodAggressive )
{
parentGroup = AudioMood;
className = "AudioStateExclusive";
};
singleton SFXState( AudioMoodTense )
{
parentGroup = AudioMood;
className = "AudioStateExclusive";
};
singleton SFXState( AudioMoodVictory )
{
parentGroup = AudioMood;
className = "AudioStateExclusive";
};
singleton SFXState( AudioMoodCalm )
{
parentGroup = AudioMood;
className = "AudioStateExclusive";
};
/// Return the currently active SFXState in AudioMood.
function sfxGetMood()
{
return sfxGetActiveStateInGroup( AudioMood );
}

View file

@ -0,0 +1,112 @@
// The general flow of a gane - server's creation, loading and hosting clients, and then destruction is as follows:
// First, a client will always create a server in the event that they want to host a single player
// game. Torque3D treats even single player connections as a soft multiplayer game, with some stuff
// in the networking short-circuited to sidestep around lag and packet transmission times.
// initServer() is called, loading the default server scripts.
// After that, if this is a dedicated server session, initDedicated() is called, otherwise initClient is called
// to prep a playable client session.
// When a local game is started - a listen server - via calling StartGame() a server is created and then the client is
// connected to it via createAndConnectToLocalServer().
function ClientServer::create( %this )
{
echo("\n--------- Initializing Directory: scripts ---------");
exec( "./scripts/client/client.cs" );
exec( "./scripts/server/server.cs" );
$Game::MissionGroup = "MissionGroup";
initServer();
%dbList = new ArrayObject(DatablockFilesList);
// Start up in either client, or dedicated server mode
if ($Server::Dedicated)
{
initDedicated();
}
else
{
initClient();
}
}
function ClientServer::destroy( %this )
{
// Ensure that we are disconnected and/or the server is destroyed.
// This prevents crashes due to the SceneGraph being deleted before
// the objects it contains.
if ($Server::Dedicated)
destroyServer();
else
disconnect();
// Destroy the physics plugin.
physicsDestroy();
sfxShutdown();
echo("Exporting client prefs");
%prefPath = getPrefpath();
export("$pref::*", %prefPath @ "/clientPrefs.cs", false);
echo("Exporting server prefs");
export("$Pref::Server::*", %prefPath @ "/serverPrefs.cs", false);
BanList::Export(%prefPath @ "/banlist.cs");
}
//-----------------------------------------------------------------------------
function StartGame( %mission, %hostingType )
{
if( %mission $= "" )
{
%id = CL_levelList.getSelectedId();
%mission = getField(CL_levelList.getRowTextById(%id), 1);
//error("Cannot start a level with no level selected!");
}
if (%hostingType !$= "")
{
%serverType = %hostingType;
}
else
{
if ($pref::HostMultiPlayer)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
}
// Show the loading screen immediately.
if ( isObject( LoadingGui ) )
{
Canvas.setContent("LoadingGui");
LoadingProgress.setValue(1);
LoadingProgressTxt.setValue("LOADING MISSION FILE");
Canvas.repaint();
}
createAndConnectToLocalServer( %serverType, %mission );
}
function JoinGame( %serverIndex )
{
// The server info index is stored in the row along with the
// rest of displayed info.
if( setServerInfo( %serverIndex ) )
{
Canvas.setContent("LoadingGui");
LoadingProgress.setValue(1);
LoadingProgressTxt.setValue("WAITING FOR SERVER");
Canvas.repaint();
%conn = new GameConnection(ServerConnection);
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($Client::Password);
%conn.connect($ServerInfo::Address);
}
}

View file

@ -0,0 +1,9 @@
<ModuleDefinition
ModuleId="ClientServer"
VersionId="1"
Description="Default module for the game."
ScriptFile="ClientServer.cs"
CreateFunction="create"
DestroyFunction="destroy"
Group="Game">
</ModuleDefinition>

View file

@ -0,0 +1,29 @@
function initClient()
{
echo("\n--------- Initializing " @ $appName @ ": Client Scripts ---------");
// Make sure this variable reflects the correct state.
$Server::Dedicated = false;
// Game information used to query the master server
$Client::GameTypeQuery = $appName;
$Client::MissionTypeQuery = "Any";
exec( "data/clientServer/scripts/client/message.cs" );
exec( "data/clientServer/scripts/client/connectionToServer.cs" );
exec( "data/clientServer/scripts/client/levelDownload.cs" );
exec( "data/clientServer/scripts/client/levelLoad.cs" );
//load prefs
%prefPath = getPrefpath();
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
exec( %prefPath @ "/clientPrefs.cs" );
else
exec( "data/defaults.cs" );
loadMaterials();
// Copy saved script prefs into C++ code.
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );
}

View file

@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Functions dealing with connecting to a server
//----------------------------------------------------------------------------
// GameConnection client callbacks
//----------------------------------------------------------------------------
// Called on the new connection object after connect() succeeds.
function GameConnection::onConnectionAccepted(%this)
{
// Startup the physX world on the client before any
// datablocks and objects are ghosted over.
physicsInitWorld( "client" );
}
function GameConnection::initialControlSet(%this)
{
echo ("*** Initial Control Object");
// The first control object has been set by the server
// and we are now ready to go.
// first check if the editor is active
if (!isToolBuild() || !isMethod("Editor", "checkActiveLoadDone") || !Editor::checkActiveLoadDone())
{
if (Canvas.getContent() != PlayGui.getId())
Canvas.setContent(PlayGui);
}
}
function GameConnection::onControlObjectChange(%this)
{
echo ("*** Control Object Changed");
// Reset the current FOV to match the new object
// and turn off any current zoom.
resetCurrentFOV();
turnOffZoom();
}
function GameConnection::onConnectionError(%this, %msg)
{
// General connection error, usually raised by ghosted objects
// initialization problems, such as missing files. We'll display
// the server's connection error message.
disconnectedCleanup();
MessageBoxOK( "DISCONNECT", $ServerConnectionErrorMessage @ " (" @ %msg @ ")" );
}
//-----------------------------------------------------------------------------
// Server connection error
//-----------------------------------------------------------------------------
addMessageCallback( 'MsgConnectionError', handleConnectionErrorMessage );
function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
{
// On connect the server transmits a message to display if there
// are any problems with the connection. Most connection errors
// are game version differences, so hopefully the server message
// will tell us where to get the latest version of the game.
$ServerConnectionErrorMessage = %msgError;
}
//-----------------------------------------------------------------------------
// Disconnect
//-----------------------------------------------------------------------------
function disconnect()
{
// We need to stop the client side simulation
// else physics resources will not cleanup properly.
physicsStopSimulation( "client" );
// Delete the connection if it's still there.
if (isObject(ServerConnection))
ServerConnection.delete();
disconnectedCleanup();
// Call destroyServer in case we're hosting
destroyServer();
}
function disconnectedCleanup()
{
// End mission, if it's running.
if( $Client::missionRunning )
clientEndMission();
// Disable mission lighting if it's going, this is here
// in case we're disconnected while the mission is loading.
$lightingMission = false;
$sceneLighting::terminateLighting = true;
// Back to the launch screen
if (isObject( MainMenuGui ))
Canvas.setContent( MainMenuGui );
// Before we destroy the client physics world
// make sure all ServerConnection objects are deleted.
if(isObject(ServerConnection))
{
ServerConnection.deleteAllObjects();
}
// We can now delete the client physics simulation.
physicsDestroyWorld( "client" );
}

View file

@ -0,0 +1,185 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Mission Loading
// The client portion of the client/server mission loading process
//-----------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Loading Phases:
// Phase 1: Transmit Datablocks
// Transmit targets
// Phase 2: Transmit Ghost Objects
// Phase 3: Start Game
//
// The server invokes the client MissionStartPhase[1-3] function to request
// permission to start each phase. When a client is ready for a phase,
// it responds with MissionStartPhase[1-3]Ack.
//----------------------------------------------------------------------------
// Phase 1
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase1(%seq, %missionName)
{
// These need to come after the cls.
echo ("*** New Mission: " @ %missionName);
echo ("*** Phase 1: Download Datablocks & Targets");
//Prep the postFX stuff
// Load the post effect presets for this mission.
%path = filePath( %missionName ) @ "/" @ fileBase( %missionName ) @ $PostFXManager::fileExtension;
if ( isScriptFile( %path ) )
{
postFXManager::loadPresetHandler( %path );
}
else
{
PostFXManager::settingsApplyDefaultPreset();
}
onMissionDownloadPhase("LOADING DATABLOCKS");
commandToServer('MissionStartPhase1Ack', %seq);
}
function onDataBlockObjectReceived(%index, %total)
{
onMissionDownloadProgress(%index / %total);
}
//----------------------------------------------------------------------------
// Phase 2
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase2(%seq,%missionName)
{
onPhaseComplete();
echo ("*** Phase 2: Download Ghost Objects");
onMissionDownloadPhase("LOADING OBJECTS");
commandToServer('MissionStartPhase2Ack', %seq);
}
function onGhostAlwaysStarted(%ghostCount)
{
$ghostCount = %ghostCount;
$ghostsRecvd = 0;
}
function onGhostAlwaysObjectReceived()
{
$ghostsRecvd++;
onMissionDownloadProgress($ghostsRecvd / $ghostCount);
}
//----------------------------------------------------------------------------
// Phase 3
//----------------------------------------------------------------------------
function clientCmdMissionStartPhase3(%seq,%missionName)
{
onPhaseComplete();
StartClientReplication();
StartFoliageReplication();
// Load the static mission decals.
if(isFile(%missionName @ ".decals"))
decalManagerLoad( %missionName @ ".decals" );
echo ("*** Phase 3: Mission Lighting");
$MSeq = %seq;
$Client::MissionFile = %missionName;
// Need to light the mission before we are ready.
// The sceneLightingComplete function will complete the handshake
// once the scene lighting is done.
if (lightScene("sceneLightingComplete", ""))
{
echo("Lighting mission....");
schedule(1, 0, "updateLightingProgress");
onMissionDownloadPhase("LIGHTING MISSION");
$lightingMission = true;
}
}
function updateLightingProgress()
{
onMissionDownloadProgress($SceneLighting::lightingProgress);
if ($lightingMission)
$lightingProgressThread = schedule(1, 0, "updateLightingProgress");
}
function sceneLightingComplete()
{
echo("Mission lighting done");
$lightingMission = false;
onPhaseComplete("STARTING MISSION");
// The is also the end of the mission load cycle.
commandToServer('MissionStartPhase3Ack', $MSeq);
}
//----------------------------------------------------------------------------
// Helper functions
//----------------------------------------------------------------------------
function connect(%server)
{
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($Client::Password);
%conn.connect(%server);
}
function onMissionDownloadPhase(%phase)
{
if ( !isObject( LoadingProgress ) )
return;
LoadingProgress.setValue(0);
LoadingProgressTxt.setValue(%phase);
Canvas.repaint();
}
function onMissionDownloadProgress(%progress)
{
if ( !isObject( LoadingProgress ) )
return;
LoadingProgress.setValue(%progress);
Canvas.repaint(33);
}
function onPhaseComplete(%text)
{
if ( !isObject( LoadingProgress ) )
return;
if(%text !$= "")
LoadingProgressTxt.setValue(%text);
LoadingProgress.setValue( 1 );
Canvas.repaint();
}

View file

@ -0,0 +1,92 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// Whether the local client is currently running a mission.
$Client::missionRunning = false;
// Sequence number for currently running mission.
$Client::missionSeq = -1;
// Called when mission is started.
function clientStartMission()
{
// The client recieves a mission start right before
// being dropped into the game.
physicsStartSimulation( "client" );
// Start game audio effects channels.
AudioChannelEffects.play();
// Create client mission cleanup group.
new SimGroup( ClientMissionCleanup );
// Done.
$Client::missionRunning = true;
}
// Called when mission is ended (either through disconnect or
// mission end client command).
function clientEndMission()
{
// Stop physics simulation on client.
physicsStopSimulation( "client" );
// Stop game audio effects channels.
AudioChannelEffects.stop();
// Delete all the decals.
decalManagerClear();
// Delete client mission cleanup group.
if( isObject( ClientMissionCleanup ) )
ClientMissionCleanup.delete();
clearClientPaths();
// Done.
$Client::missionRunning = false;
}
//----------------------------------------------------------------------------
// Mission start / end events sent from the server
//----------------------------------------------------------------------------
function clientCmdMissionStart(%seq)
{
clientStartMission();
$Client::missionSeq = %seq;
}
function clientCmdMissionEnd( %seq )
{
if( $Client::missionRunning && $Client::missionSeq == %seq )
{
clientEndMission();
$Client::missionSeq = -1;
}
}

View file

@ -0,0 +1,94 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Functions that process commands sent from the server.
// Game event descriptions, which may or may not include text messages, can be
// sent using the message* functions in core/scripts/server/message.cs. Those
// functions do commandToClient with the tag ServerMessage, which invokes the
// function below.
// For ServerMessage messages, the client can install callbacks that will be
// run, according to the "type" of the message.
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
// Get the message type; terminates at any whitespace.
%tag = getWord(%msgType, 0);
// First see if there is a callback installed that doesn't have a type;
// if so, that callback is always executed when a message arrives.
for (%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++) {
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
// Next look for a callback for this particular type of ServerMessage.
if (%tag !$= "") {
for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++) {
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
}
}
// Called by the client to install a callback for a particular type of
// ServerMessage.
function addMessageCallback(%msgType, %func)
{
for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++) {
// If it already exists as a callback for this type,
// nothing to do.
if (%afunc $= %func) {
return;
}
}
// Set it up.
$MSGCB[%msgType, %i] = %func;
}
// The following is the callback that will be executed for every ServerMessage,
// because we're going to install it without a specified type. Any type-
// specific callbacks will be executed afterward.
// This just invokes onServerMessage, which can be overridden by the game
function onServerMessage(%a, %b, %c, %d, %e, %f, %g, %h, %i)
{
echo("onServerMessage: ");
if(%a !$= "") echo(" +- a: " @ %a);
if(%b !$= "") echo(" +- b: " @ %b);
if(%c !$= "") echo(" +- c: " @ %c);
if(%d !$= "") echo(" +- d: " @ %d);
if(%e !$= "") echo(" +- e: " @ %e);
if(%f !$= "") echo(" +- f: " @ %f);
if(%g !$= "") echo(" +- g: " @ %g);
if(%h !$= "") echo(" +- h: " @ %h);
if(%i !$= "") echo(" +- i: " @ %i);
}
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
{
onServerMessage(detag(%msgString));
}
// Register that default message handler now.
addMessageCallback("", defaultMessageCallback);

View file

@ -0,0 +1,40 @@
//-----------------------------------------------------------------------------
// 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 ServerPlay2D(%profile)
{
// Play the given sound profile on every client.
// The sounds will be transmitted as an event, not attached to any object.
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
ClientGroup.getObject(%idx).play2D(%profile);
}
function ServerPlay3D(%profile,%transform)
{
// Play the given sound profile at the given position on every client
// The sound will be transmitted as an event, not attached to any object.
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
ClientGroup.getObject(%idx).play3D(%profile,%transform);
}

View file

@ -0,0 +1,35 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Misc. server commands avialable to clients
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Debug commands
//----------------------------------------------------------------------------
function serverCmdNetSimulateLag( %client, %msDelay, %packetLossPercent )
{
if ( %client.isAdmin )
%client.setSimulatedNetParams( %packetLossPercent / 100.0, %msDelay );
}

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