From a3fab3d4c409fa522ddaf461e83a4a4f3435f335 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 17:52:02 -0600 Subject: [PATCH 1/8] Projected Shadow fix With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // For ShapeBase objects this causes the shader to fade along with the // object and also prevents a rectangular shadow artifact from occuring // once the visibility is zero. --- Engine/source/lighting/common/projectedShadow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/source/lighting/common/projectedShadow.cpp b/Engine/source/lighting/common/projectedShadow.cpp index 8918ddf5a..1ad88cd10 100644 --- a/Engine/source/lighting/common/projectedShadow.cpp +++ b/Engine/source/lighting/common/projectedShadow.cpp @@ -230,6 +230,9 @@ bool ProjectedShadow::_updateDecal( const SceneRenderState *state ) lightCount++; } + if (mShapeBase) + fade *= mShapeBase->getFadeVal(); + lightDir.normalize(); // No light... no shadow. From a4adf28ef54c52235420d14bd2990b2c9a874cb0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 17:55:10 -0600 Subject: [PATCH 2/8] mVertexFormat validation fix With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << (no text, self evident) --- Engine/source/materials/matInstance.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine/source/materials/matInstance.cpp b/Engine/source/materials/matInstance.cpp index a61b75bf7..1a894f1a5 100644 --- a/Engine/source/materials/matInstance.cpp +++ b/Engine/source/materials/matInstance.cpp @@ -290,6 +290,12 @@ bool MatInstance::init( const FeatureSet &features, //---------------------------------------------------------------------------- bool MatInstance::reInit() { + if (!mVertexFormat) + { + mIsValid = false; + return mIsValid; + } + SAFE_DELETE(mProcessedMaterial); deleteAllHooks(); mIsValid = processMaterial(); From b2a4f3fd44e92d6172696e0c76be30659dada24f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 17:58:12 -0600 Subject: [PATCH 3/8] depth correction With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // This fix prevents some bad rendering artifacts that occur at the edge of the visibleDistance. // The artifacts are most obvious when there is fog present. --- Engine/source/shaderGen/HLSL/depthHLSL.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Engine/source/shaderGen/HLSL/depthHLSL.cpp b/Engine/source/shaderGen/HLSL/depthHLSL.cpp index 9f5726a51..ecb23d676 100644 --- a/Engine/source/shaderGen/HLSL/depthHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/depthHLSL.cpp @@ -25,7 +25,7 @@ #include "materials/materialFeatureTypes.h" #include "materials/materialFeatureData.h" - +#include "terrain/terrFeatureTypes.h" void EyeSpaceDepthOutHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) @@ -85,7 +85,12 @@ void EyeSpaceDepthOutHLSL::processPix( Vector &componentList, LangElement *depthOutDecl = new DecOp( depthOut ); meta->addStatement( new GenOp( "#ifndef CUBE_SHADOW_MAP\r\n" ) ); - meta->addStatement( new GenOp( " @ = dot(@, (@.xyz / @.w));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec ) ); + + if (fd.features.hasFeature(MFT_TerrainBaseMap)) + meta->addStatement(new GenOp(" @ =min(0.9999, dot(@, (@.xyz / @.w)));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec)); + else + meta->addStatement(new GenOp(" @ = dot(@, (@.xyz / @.w));\r\n", depthOutDecl, vEye, wsEyeVec, wsEyeVec)); + meta->addStatement( new GenOp( "#else\r\n" ) ); Var *farDist = (Var*)Var::find( "oneOverFarplane" ); From dbf9275037402bbd619d4c9e007445ee2d19fff7 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 18:01:18 -0600 Subject: [PATCH 4/8] Ref Count Catch With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // for events that are not GuaranteedOrdered we can get here w/o ever // incrementing ref-count on the event. --- Engine/source/sim/netEvent.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/sim/netEvent.cpp b/Engine/source/sim/netEvent.cpp index 07b90f6ca..08707ea7f 100644 --- a/Engine/source/sim/netEvent.cpp +++ b/Engine/source/sim/netEvent.cpp @@ -344,6 +344,8 @@ void NetConnection::eventReadPacket(BitStream *bstream) if(unguaranteedPhase) { evt->process(this); + if (evt->getRefCount() == 0) + evt->incRef(); evt->decRef(); if(mErrorBuffer.isNotEmpty()) return; From c76b44bb91fb49fd7ebc09d34ccdc293d9776324 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 18:03:52 -0600 Subject: [PATCH 5/8] Ref Count Catch With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << (no text, self evident) --- Engine/source/T3D/fx/particle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index 5b794748e..bf9e987f8 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -355,7 +355,7 @@ bool ParticleData::protectedSetSizes( void *object, const char *index, const cha U32 i; if (!index) - i = 0; + return (val >= 0.f && val <= MaxParticleSize); else i = dAtoui(index); @@ -371,7 +371,7 @@ bool ParticleData::protectedSetTimes( void *object, const char *index, const cha U32 i; if (!index) - i = 0; + return (val >= 0.f && val <= 1.f); else i = dAtoui(index); From 8c979a6d7bdcafa28fabd6ffe0d3e7f0c44eef1d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 18:05:43 -0600 Subject: [PATCH 6/8] Oriented Particles UV Correction With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // this fix re-orders the UV coords to produce a consistent orientation // with oriented particles in TGE. --- Engine/source/T3D/fx/particleEmitter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index b40148cea..4e4f9728b 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1825,22 +1825,22 @@ void ParticleEmitter::setupOriented( Particle *part, lVerts->point = start + crossDir; lVerts->color = partCol; // Here and below, we copy UVs from particle datablock's texCoords (oriented) - lVerts->texCoord = part->dataBlock->texCoords[0]; + lVerts->texCoord = part->dataBlock->texCoords[1]; ++lVerts; lVerts->point = start - crossDir; lVerts->color = partCol; - lVerts->texCoord = part->dataBlock->texCoords[1]; + lVerts->texCoord = part->dataBlock->texCoords[2]; ++lVerts; lVerts->point = end - crossDir; lVerts->color = partCol; - lVerts->texCoord = part->dataBlock->texCoords[2]; + lVerts->texCoord = part->dataBlock->texCoords[3]; ++lVerts; lVerts->point = end + crossDir; lVerts->color = partCol; - lVerts->texCoord = part->dataBlock->texCoords[3]; + lVerts->texCoord = part->dataBlock->texCoords[0]; ++lVerts; } From dbd8c6b37b375eba00692a4dcb0a70f6b478a3ba Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 22 Dec 2014 18:08:05 -0600 Subject: [PATCH 7/8] Player Networking DIVNULL error correction With Permission from Jeff Faust. // AFX CODE BLOCK (bug-fix) << // avoids a divide-by-zero when maxEnergy is set to zero. --- Engine/source/T3D/player.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 944d5c1fa..f9278e62b 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -6158,7 +6158,10 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFlag(!(mask & NoWarpMask)); } // Ghost need energy to predict reliably - stream->writeFloat(getEnergyLevel() / mDataBlock->maxEnergy,EnergyLevelBits); + if (mDataBlock->maxEnergy > 0.f) + stream->writeFloat(getEnergyLevel() / mDataBlock->maxEnergy, EnergyLevelBits); + else + stream->writeFloat(0.f, EnergyLevelBits); return retMask; } From 6ee81d94207dfa43da5c95779d963aacb23cf0e9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 26 Dec 2014 13:04:53 -0600 Subject: [PATCH 8/8] Revert "Ref Count Catch" This reverts commit dbf9275037402bbd619d4c9e007445ee2d19fff7. --- Engine/source/sim/netEvent.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/sim/netEvent.cpp b/Engine/source/sim/netEvent.cpp index 08707ea7f..07b90f6ca 100644 --- a/Engine/source/sim/netEvent.cpp +++ b/Engine/source/sim/netEvent.cpp @@ -344,8 +344,6 @@ void NetConnection::eventReadPacket(BitStream *bstream) if(unguaranteedPhase) { evt->process(this); - if (evt->getRefCount() == 0) - evt->incRef(); evt->decRef(); if(mErrorBuffer.isNotEmpty()) return;