From 8956559bfd27c3e73bf67a3b6b299abff574a993 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 19 Sep 2020 18:25:10 -0500 Subject: [PATCH 1/2] Various misc. tweaks and fixes based on static code analysis to minimize/fix memleaks, crashes, or other performance impacting code. --- Engine/source/T3D/Scene.cpp | 3 +- Engine/source/T3D/aiPlayer.cpp | 2 + Engine/source/T3D/assets/GameObjectAsset.cpp | 2 +- Engine/source/T3D/assets/MaterialAsset.cpp | 2 +- Engine/source/T3D/decal/decalManager.cpp | 2 +- .../source/T3D/lighting/reflectionProbe.cpp | 44 ++++++---- Engine/source/T3D/player.cpp | 1 + Engine/source/T3D/sfx/sfxEmitter.cpp | 3 +- Engine/source/T3D/shapeBase.cpp | 50 +++++------ Engine/source/T3D/vehicles/wheeledVehicle.cpp | 7 +- Engine/source/app/net/serverQuery.cpp | 8 +- Engine/source/collision/collision.h | 2 +- Engine/source/console/console.cpp | 3 + Engine/source/console/fieldBrushObject.cpp | 4 +- Engine/source/environment/VolumetricFog.cpp | 4 +- Engine/source/gfx/gfxTextureManager.cpp | 2 + Engine/source/gfx/sim/cubemapData.cpp | 4 +- Engine/source/gui/controls/guiMLTextCtrl.cpp | 3 +- .../editor/inspector/variableInspector.cpp | 4 +- Engine/source/gui/worldEditor/worldEditor.cpp | 17 ---- .../glsl/advancedLightingFeaturesGLSL.cpp | 4 - .../hlsl/advancedLightingFeaturesHLSL.cpp | 4 - .../materials/customMaterialDefinition.cpp | 5 +- .../source/materials/materialDefinition.cpp | 35 -------- Engine/source/materials/materialDefinition.h | 10 --- .../materials/processedCustomMaterial.cpp | 2 +- Engine/source/materials/processedMaterial.h | 2 - .../materials/processedShaderMaterial.cpp | 19 +---- .../materials/processedShaderMaterial.h | 2 +- Engine/source/math/mPolyhedron.h | 2 +- Engine/source/module/moduleManager.cpp | 2 +- .../source/renderInstance/renderProbeMgr.cpp | 4 +- .../renderInstance/renderTranslucentMgr.cpp | 1 - Engine/source/scene/fogStructs.h | 4 +- Engine/source/scene/sceneObject.cpp | 2 +- Engine/source/sfx/sfxSound.cpp | 2 +- .../source/shaderGen/customShaderFeature.cpp | 2 + Engine/source/shaderGen/shaderGen.cpp | 85 +------------------ Engine/source/shaderGen/shaderGen.h | 11 +-- Engine/source/sim/netConnection.h | 2 +- Engine/source/terrain/terrCellMaterial.cpp | 4 +- Engine/source/ts/collada/colladaUtils.cpp | 6 +- Engine/source/ts/tsDump.cpp | 3 +- Engine/source/ts/tsShapeConstruct.cpp | 2 + 44 files changed, 124 insertions(+), 258 deletions(-) diff --git a/Engine/source/T3D/Scene.cpp b/Engine/source/T3D/Scene.cpp index c882adc4f..7189fb4ff 100644 --- a/Engine/source/T3D/Scene.cpp +++ b/Engine/source/T3D/Scene.cpp @@ -11,7 +11,8 @@ Scene::Scene() : mParentScene(nullptr), mSceneId(-1), mIsEditing(false), - mIsDirty(false) + mIsDirty(false), + mEditPostFX(0) { mGameModeName = StringTable->EmptyString(); } diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index e5137dec1..68d2954c3 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -120,6 +120,8 @@ AIPlayer::AIPlayer() for( S32 i = 0; i < MaxTriggerKeys; i ++ ) mMoveTriggers[ i ] = false; + + mAttackRadius = 1; } /** diff --git a/Engine/source/T3D/assets/GameObjectAsset.cpp b/Engine/source/T3D/assets/GameObjectAsset.cpp index c7cf5301c..f1a006228 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.cpp +++ b/Engine/source/T3D/assets/GameObjectAsset.cpp @@ -266,7 +266,7 @@ GuiControl* GuiInspectorTypeGameObjectAssetPtr::constructEditControl() const char* assetId = getData(); - if (assetId == "") + if (dStrEqual(assetId, "")) { mGameObjectEditButton->setText("Create Game Object"); diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index db1fa1a02..6b4203938 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -280,7 +280,7 @@ bool GuiInspectorTypeMaterialAssetPtr::updateRects() bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); - if (mMatEdContainer != nullptr) + if (mMatEdContainer != nullptr && mMatPreviewButton != nullptr) { mMatPreviewButton->resize(mEditCtrlRect.point, mEditCtrlRect.extent); } diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index c11faf325..2ea8f5b68 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -783,7 +783,7 @@ U32 DecalManager::_generateConvexHull( const Vector &points, Vector= 0 && i < maxmin ) + if (i < maxmin && isLeft(points[minmin], points[maxmin], points[i]) >= 0) continue; // ignore P[i] above or on the lower line while (top > 0) // there are at least 2 points on the stack diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index 22faf0599..4a5a3b2f8 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -747,14 +747,21 @@ void ReflectionProbe::processStaticCubemap() if (Platform::isFile(irradFileName)) { - mIrridianceMap->setCubemapFile(FileName(irradFileName)); - mIrridianceMap->updateFaces(); - } + if (mIrridianceMap == nullptr) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName); + return; + } - if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) - { - Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName); - return; + mIrridianceMap->setCubemapFile(FileName(irradFileName)); + + if (mIrridianceMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName); + return; + } + + mIrridianceMap->updateFaces(); } char prefilterFileName[256]; @@ -762,14 +769,21 @@ void ReflectionProbe::processStaticCubemap() if (Platform::isFile(prefilterFileName)) { - mPrefilterMap->setCubemapFile(FileName(prefilterFileName)); - mPrefilterMap->updateFaces(); - } + if (mPrefilterMap == nullptr) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName); + return; + } - if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) - { - Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName); - return; + mPrefilterMap->setCubemapFile(FileName(prefilterFileName)); + + if (mPrefilterMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName); + return; + } + + mPrefilterMap->updateFaces(); } if (!Platform::isFile(prefilterFileName) || !Platform::isFile(irradFileName)) @@ -809,7 +823,7 @@ void ReflectionProbe::processStaticCubemap() IBLUtilities::SaveCubeMap(prefilterFileName, mPrefilterMap->mCubemap); } - if ((mIrridianceMap != nullptr || !mIrridianceMap->mCubemap.isNull()) && (mPrefilterMap != nullptr || !mPrefilterMap->mCubemap.isNull())) + if ((mIrridianceMap != nullptr && !mIrridianceMap->mCubemap.isNull()) && (mPrefilterMap != nullptr && !mPrefilterMap->mCubemap.isNull())) { mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 91444bb53..1ee32b545 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -290,6 +290,7 @@ PlayerData::PlayerData() maxStepHeight = 1.0f; runSurfaceAngle = 80.0f; + runSurfaceCos = mCos(mDegToRad(runSurfaceAngle)); fallingSpeedThreshold = -10.0f; diff --git a/Engine/source/T3D/sfx/sfxEmitter.cpp b/Engine/source/T3D/sfx/sfxEmitter.cpp index 01fc6ee41..3e26151c7 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.cpp +++ b/Engine/source/T3D/sfx/sfxEmitter.cpp @@ -120,8 +120,7 @@ SFXEmitter::~SFXEmitter() { mLocalProfile._unregisterSignals(); - if( mSource ) - SFX_DELETE( mSource ); + SFX_DELETE( mSource ); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index d9830785d..5bac35033 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -1210,7 +1210,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) } ShapeBaseData *prevDB = dynamic_cast( mDataBlock ); - bool isInitialDataBlock = ( mDataBlock == 0 ); + bool isInitialDataBlock = (prevDB == 0); if ( Parent::onNewDataBlock( dptr, reload ) == false ) return false; @@ -1236,13 +1236,14 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) { ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; - Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); - for (S32 j = 0; j < mat_names.size(); j++) + Vector& mat_names = (Vector&) mat_list->getMaterialNameList(); + S32 old_tagLen = dStrlen(remap->old_tag); + for (S32 j = 0; j < mat_names.size(); j++) { - if (mat_names[j].compare(remap->old_tag, dStrlen(remap->old_tag), String::NoCase) == 0) + if (mat_names[j].compare(remap->old_tag, old_tagLen, String::NoCase) == 0) { mat_names[j] = String(remap->new_tag); - mat_names[j].insert(0,'#'); + mat_names[j].insert(0, '#'); break; } } @@ -1263,14 +1264,15 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) { ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; - Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); - for (S32 j = 0; j < mat_names.size(); j++) + Vector& mat_names = (Vector&) mat_list->getMaterialNameList(); + S32 new_tagLen = dStrlen(remap->new_tag); + for (S32 j = 0; j < mat_names.size(); j++) { String::SizeType len = mat_names[j].length(); if (len > 1) { - String temp_name = mat_names[j].substr(1,len-1); - if (temp_name.compare(remap->new_tag, dStrlen(remap->new_tag)) == 0) + String temp_name = mat_names[j].substr(1, len - 1); + if (temp_name.compare(remap->new_tag, new_tagLen) == 0) { mat_names[j] = String(remap->old_tag); break; @@ -1286,7 +1288,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) resetWorldBox(); // Set the initial mesh hidden state. - mMeshHidden.setSize( mDataBlock->mShape->objects.size() ); + mMeshHidden.setSize(mDataBlock->mShape->objects.size()); mMeshHidden.clear(); // Initialize the threads @@ -1304,37 +1306,37 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) // initialized either by the constructor or from the server. bool reset = st.thread != 0; st.thread = 0; - + // New datablock/shape may not actually HAVE this sequence. // In that case stop playing it. - - AssertFatal( prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?" ); - - const TSShape *prevShape = prevDB->mShape; - const TSShape::Sequence &prevSeq = prevShape->sequences[st.sequence]; - const String &prevSeqName = prevShape->names[prevSeq.nameIndex]; - st.sequence = mDataBlock->mShape->findSequence( prevSeqName ); + AssertFatal(prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?"); - if ( st.sequence != -1 ) + const TSShape* prevShape = prevDB->mShape; + const TSShape::Sequence& prevSeq = prevShape->sequences[st.sequence]; + const String& prevSeqName = prevShape->names[prevSeq.nameIndex]; + + st.sequence = mDataBlock->mShape->findSequence(prevSeqName); + + if (st.sequence != -1) { - setThreadSequence( i, st.sequence, reset ); - } + setThreadSequence(i, st.sequence, reset); + } } } if (mDataBlock->damageSequence != -1) { mDamageThread = mShapeInstance->addThread(); mShapeInstance->setSequence(mDamageThread, - mDataBlock->damageSequence,0); + mDataBlock->damageSequence, 0); } if (mDataBlock->hulkSequence != -1) { mHulkThread = mShapeInstance->addThread(); mShapeInstance->setSequence(mHulkThread, - mDataBlock->hulkSequence,0); + mDataBlock->hulkSequence, 0); } - if( isGhost() ) + if (isGhost()) { // Reapply the current skin mAppliedSkinName = ""; diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 03b66b259..3e9d686a2 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -339,8 +339,13 @@ bool WheeledVehicleData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { for (S32 i = 0; i < MaxSounds; i++) - if( !sfxResolve( &sound[ i ], errorStr ) ) + { + if (!sfxResolve(&sound[i], errorStr)) + { + delete si; return false; + } + } if (tireEmitter) Sim::findObject(SimObjectId((uintptr_t)tireEmitter),tireEmitter); diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index a1f60cd74..03defe700 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -1584,8 +1584,8 @@ static void handleMasterServerListResponse( BitStream* stream, U32 key, U8 /*fla { if ( i != packetIndex ) { - PacketStatus* p = new PacketStatus( i, gMasterServerPing.key, currentTime ); - gPacketStatusList.push_back( *p ); + PacketStatus p = PacketStatus( i, gMasterServerPing.key, currentTime ); + gPacketStatusList.push_back( p ); } } @@ -1674,8 +1674,8 @@ static void handleExtendedMasterServerListResponse(BitStream* stream, U32 key, U { if (i != packetIndex) { - PacketStatus* p = new PacketStatus(i, gMasterServerPing.key, currentTime); - gPacketStatusList.push_back(*p); + PacketStatus p = PacketStatus(i, gMasterServerPing.key, currentTime); + gPacketStatusList.push_back(p); } } diff --git a/Engine/source/collision/collision.h b/Engine/source/collision/collision.h index e5134c1a7..be40199e6 100644 --- a/Engine/source/collision/collision.h +++ b/Engine/source/collision/collision.h @@ -160,7 +160,7 @@ typedef Chunker BSPTree; /// @see Collision struct RayInfo : public Collision { - RayInfo() : userData( NULL ) {} + RayInfo() : t(0), userData( NULL ) {} // The collision struct has object, point, normal & material. diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index d9e86e1c2..d830b2b90 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -1579,6 +1579,9 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar } bool result; const char* methodRes = CInterface::CallMethod(object, argv[0], argv_str, argc - 2, &result); + + free(argv_str); + if (result) { return ConsoleValueRef::fromValue(CSTK.pushString(methodRes)); diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 52e8cc391..e66b495fa 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -542,6 +542,8 @@ void FieldBrushObject::pasteFields( SimObject* pSimObject ) // Force modification of static-fields on target object! pSimObject->setModStaticFields( true ); + S32 prefixLength = dStrlen(INTERNAL_FIELD_PREFIX); + // Iterate fields. for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr ) { @@ -553,7 +555,7 @@ void FieldBrushObject::pasteFields( SimObject* pSimObject ) if ( pInternalField == fieldEntry->slotName ) { // Yes, so skip the prefix. - pInternalField += dStrlen(INTERNAL_FIELD_PREFIX); + pInternalField += prefixLength; // Is this a static-field on the target object? // NOTE:- We're doing this so we don't end-up creating a dynamic-field if it isn't present. diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 2d1a0623a..8374af42f 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -606,7 +606,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (mShapeAssetId != StringTable->EmptyString()) { - mShape = mShape = mShapeAsset->getShapeResource(); + mShape = mShapeAsset->getShapeResource(); } else if (mShapeName && mShapeName[0] != '\0') { @@ -1048,7 +1048,7 @@ void VolumetricFog::prepRenderImage(SceneRenderState *state) return; if (mNumDetailLevels > 1) { - if ((det_size[mCurDetailLevel].det_size > mPixelSize) && (mCurDetailLevel < mNumDetailLevels - 1)) + if ((mCurDetailLevel < mNumDetailLevels - 1) && (det_size[mCurDetailLevel].det_size > mPixelSize)) UpdateBuffers(mCurDetailLevel + 1); else if (mCurDetailLevel > 0) { diff --git a/Engine/source/gfx/gfxTextureManager.cpp b/Engine/source/gfx/gfxTextureManager.cpp index 9ab48dfce..357a3bebb 100644 --- a/Engine/source/gfx/gfxTextureManager.cpp +++ b/Engine/source/gfx/gfxTextureManager.cpp @@ -375,6 +375,8 @@ GFXTextureObject *GFXTextureManager::_createTexture( GBitmap *bmp, if(!ret) { + SAFE_DELETE(realBmp); + Con::errorf("GFXTextureManager - failed to create texture (1) for '%s'", (resourceName.isNotEmpty() ? resourceName.c_str() : "unknown")); return NULL; } diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index 973acdfcc..02927073e 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -202,7 +202,7 @@ DefineEngineMethod(CubemapData, save, void, (const char* filename, const GFXForm "Returns the script filename of where the CubemapData object was " "defined. This is used by the material editor.") { - if (filename == "") + if (dStrEqual(filename, "")) filename = object->getName(); //add dds extension if needed @@ -211,4 +211,4 @@ DefineEngineMethod(CubemapData, save, void, (const char* filename, const GFXForm finalName += String(".dds"); CubemapSaver::save(object->mCubemap, finalName, format); -} \ No newline at end of file +} diff --git a/Engine/source/gui/controls/guiMLTextCtrl.cpp b/Engine/source/gui/controls/guiMLTextCtrl.cpp index 85d093f26..67ce7beaf 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.cpp +++ b/Engine/source/gui/controls/guiMLTextCtrl.cpp @@ -528,8 +528,7 @@ void GuiMLTextCtrl::inspectPostApply() setText(mInitialText, dStrlen(mInitialText)); - if (mLineSpacingPixels < 0) - mLineSpacingPixels = 0; + mLineSpacingPixels = 0; } diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index ee78d49c9..40e525815 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -268,7 +268,7 @@ DefineEngineMethod(GuiVariableInspector, addField, void, (const char* name, cons const char* description, const char* defaultValue, const char* dataValues, SimObject* ownerObj), ("","","","","", "", nullAsType()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, ownerObject )") { - if (name == "" || typeName == "") + if (dStrEqual(name, "") || dStrEqual(typeName, "")) return; object->addField(name, label, typeName, description, defaultValue, dataValues, "", ownerObj); @@ -278,7 +278,7 @@ DefineEngineMethod(GuiVariableInspector, addCallbackField, void, (const char* na const char* description, const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj), ("", "", "", "", "", "", nullAsType()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, callbackName, ownerObject )") { - if (name == "" || typeName == "") + if (dStrEqual(name, "") || dStrEqual(typeName, "")) return; object->addCallbackField(name, label, typeName, description, defaultValue, dataValues, callbackName, ownerObj); diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 6ed9dc6fd..493975608 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -4042,23 +4042,6 @@ bool WorldEditor::makeSelectionAMesh(const char *filename) return true; else return false; - - // Allocate TSStatic object and add to level. - TSStatic *ts = new TSStatic(); - ts->setShapeFileName(StringTable->insert(filename)); - fabMat.inverse(); - ts->setTransform(fabMat); - ts->registerObject(); - scene->addObject(ts); - - // Select it, mark level as dirty. - clearSelection(); - selectObject(ts); - setDirty(); - - // Delete original objects and temporary SimGroup. - for (S32 i = 0; i < objectList.size(); i++) - objectList[i]->deleteObject(); } DefineEngineMethod( WorldEditor, makeSelectionPrefab, void, ( const char* filename, bool dontDeleteOriginals ), (false), diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index 24325d14f..74074a42f 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -114,10 +114,6 @@ void DeferredRTLightingFeatGLSL::processPix( Vector &component meta->addStatement( new GenOp( " @.y = 1.0 - @.y;\r\n", uvScene, uvScene ) ); // flip the y axis meta->addStatement( new GenOp( " @ = ( @ * @.zw ) + @.xy;\r\n", uvScene, uvScene, rtParams, rtParams) ); // scale it down and offset it to the rt size - Var *lightInfoSamp = new Var; - lightInfoSamp->setType( "vec4" ); - lightInfoSamp->setName( "lightInfoSample" ); - // create texture var Var *lightInfoBuffer = new Var; lightInfoBuffer->setType( "sampler2D" ); diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index bb3b41142..ab6b9450b 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -115,10 +115,6 @@ void DeferredRTLightingFeatHLSL::processPix( Vector &component meta->addStatement( new GenOp( " @.y = 1.0 - @.y;\r\n", uvScene, uvScene ) ); // flip the y axis meta->addStatement( new GenOp( " @ = ( @ * @.zw ) + @.xy;\r\n", uvScene, uvScene, rtParams, rtParams) ); // scale it down and offset it to the rt size - Var *lightInfoSamp = new Var; - lightInfoSamp->setType( "float4" ); - lightInfoSamp->setName( "lightInfoSample" ); - // create texture var Var *lightInfoBuffer = new Var; lightInfoBuffer->setType( "SamplerState" ); diff --git a/Engine/source/materials/customMaterialDefinition.cpp b/Engine/source/materials/customMaterialDefinition.cpp index 489a6b9ce..329ed59b1 100644 --- a/Engine/source/materials/customMaterialDefinition.cpp +++ b/Engine/source/materials/customMaterialDefinition.cpp @@ -120,6 +120,7 @@ bool CustomMaterial::onAdd() } const char* samplerDecl = "sampler"; + S32 samplerDeclLen = dStrlen(samplerDecl); S32 i = 0; for (SimFieldDictionaryIterator itr(getFieldDictionary()); *itr; ++itr) { @@ -132,7 +133,7 @@ bool CustomMaterial::onAdd() return false; } - if (dStrlen(entry->slotName) == dStrlen(samplerDecl)) + if (dStrlen(entry->slotName) == samplerDeclLen) { logError("sampler declarations must have a sampler name, e.g. sampler[\"diffuseMap\"]"); return false; @@ -140,7 +141,7 @@ bool CustomMaterial::onAdd() // Assert sampler names are defined on ShaderData S32 pos = -1; - String samplerName = entry->slotName + dStrlen(samplerDecl); + String samplerName = entry->slotName + samplerDeclLen; samplerName.insert(0, '$'); mShaderData->hasSamplerDef(samplerName, pos); diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 753b86d0e..abd4b49c6 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -502,11 +502,6 @@ void Material::initPersistFields() endGroup( "Behavioral" ); - addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn, - "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors); - addProtectedField("CustomShaderFeatureUniforms", TypeRealString, NULL, &protectedSetCustomShaderFeatureUniforms, &defaultProtectedGetFn, - "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors); - Parent::initPersistFields(); } @@ -524,36 +519,6 @@ bool Material::writeField( StringTableEntry fieldname, const char *value ) return Parent::writeField( fieldname, value ); } -bool Material::protectedSetCustomShaderFeature(void *object, const char *index, const char *data) -{ - Material *material = static_cast< Material* >(object); - - CustomShaderFeatureData* customFeature; - if (!Sim::findObject(data, customFeature)) - return false; - - material->mCustomShaderFeatures.push_back(customFeature); - - return false; -} - -bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data) -{ - Material *material = static_cast< Material* >(object); - - if (index != NULL) - { - char featureName[256] = { 0 }; - U32 id = 0; - dSscanf(index, "%s_%i", featureName, id); - - String uniformName = data; - } - - return false; -} - - bool Material::onAdd() { if (Parent::onAdd() == false) diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index f7701a240..32b79b92d 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -41,10 +41,6 @@ #include "console/dynamicTypes.h" #endif -#ifndef CUSTOMSHADERFEATURE_H -#include "shaderGen/customShaderFeature.h" -#endif - #ifndef IMAGE_ASSET_H #include "T3D/assets/ImageAsset.h" #endif @@ -59,7 +55,6 @@ class FeatureSet; class FeatureType; class MaterialSoundProfile; class MaterialPhysicsProfile; -class CustomShaderFeatureData; /// The basic material definition. class Material : public BaseMaterialDefinition @@ -356,8 +351,6 @@ public: F32 mDirectSoundOcclusion; ///< Amount of volume occlusion on direct sounds. F32 mReverbSoundOcclusion; ///< Amount of volume occlusion on reverb sounds. - Vector mCustomShaderFeatures; - ///@} String mMapTo; // map Material to this texture name @@ -395,9 +388,6 @@ public: virtual void inspectPostApply(); virtual bool writeField( StringTableEntry fieldname, const char *value ); - static bool protectedSetCustomShaderFeature(void *object, const char *index, const char *data); - static bool protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data); - // // ConsoleObject interface // diff --git a/Engine/source/materials/processedCustomMaterial.cpp b/Engine/source/materials/processedCustomMaterial.cpp index e5751715f..e347c088f 100644 --- a/Engine/source/materials/processedCustomMaterial.cpp +++ b/Engine/source/materials/processedCustomMaterial.cpp @@ -238,7 +238,7 @@ bool ProcessedCustomMaterial::init( const FeatureSet &features, return false; } - rpd->shaderHandles.init( rpd->shader, mCustomMaterial->mCustomShaderFeatures, mCustomMaterial ); + rpd->shaderHandles.init( rpd->shader, mCustomMaterial ); _initMaterialParameters(); mDefaultParameters = allocMaterialParameters(); setMaterialParameters( mDefaultParameters, 0 ); diff --git a/Engine/source/materials/processedMaterial.h b/Engine/source/materials/processedMaterial.h index 657182cbb..d316fc450 100644 --- a/Engine/source/materials/processedMaterial.h +++ b/Engine/source/materials/processedMaterial.h @@ -85,8 +85,6 @@ public: MaterialFeatureData mFeatureData; - Vector mCustomShaderFeatureData; - bool mGlow; Material::BlendOp mBlendOp; diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 5a89d27c3..fcd2a0c6a 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -54,7 +54,7 @@ /// /// ShaderConstHandles /// -void ShaderConstHandles::init( GFXShader *shader, Vector customFeatureData, CustomMaterial* mat /*=NULL*/) +void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/) { mDiffuseColorSC = shader->getShaderConstHandle("$diffuseMaterialColor"); mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat); @@ -125,19 +125,6 @@ void ShaderConstHandles::init( GFXShader *shader, VectorgetShaderConstHandle(ShaderGenVars::matInfoFlags); - - //custom features - for (U32 f = 0; f < customFeatureData.size(); ++f) - { - for (U32 i = 0; i < customFeatureData[f]->mAddedShaderConstants.size(); ++i) - { - customHandleData newSC; - newSC.handle = shader->getShaderConstHandle(String("$") + String(customFeatureData[f]->mAddedShaderConstants[i])); - newSC.handleName = customFeatureData[f]->mAddedShaderConstants[i]; - - mCustomHandles.push_back(newSC); - } - } } /// @@ -686,10 +673,10 @@ bool ProcessedShaderMaterial::_addPass( ShaderRenderPassData &rpd, // Generate shader GFXShader::setLogging( true, true ); - rpd.shader = SHADERGEN->getShader( rpd.mFeatureData, mMaterial->mCustomShaderFeatures, mVertexFormat, &mUserMacros, samplers ); + rpd.shader = SHADERGEN->getShader( rpd.mFeatureData, mVertexFormat, &mUserMacros, samplers ); if( !rpd.shader ) return false; - rpd.shaderHandles.init( rpd.shader, mMaterial->mCustomShaderFeatures); + rpd.shaderHandles.init( rpd.shader ); // If a pass glows, we glow if( rpd.mGlow ) diff --git a/Engine/source/materials/processedShaderMaterial.h b/Engine/source/materials/processedShaderMaterial.h index 89bd372bd..c0bc14cf7 100644 --- a/Engine/source/materials/processedShaderMaterial.h +++ b/Engine/source/materials/processedShaderMaterial.h @@ -110,7 +110,7 @@ public: }; Vector mCustomHandles; - void init( GFXShader* shader, Vector customFeatureData, CustomMaterial* mat = NULL); + void init( GFXShader* shader, CustomMaterial* mat = NULL); }; diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index c52d40b8a..4496b219c 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -98,7 +98,7 @@ struct PolyhedronData /// it defines a *clockwise* orientation for face[ 0 ]. This is important! U32 vertex[ 2 ]; - Edge() { std::fill_n(face, 2, 0), std::fill_n(vertex, 0, 0); } + Edge() { std::fill_n(face, 2, 0), std::fill_n(vertex, 2, 0); } Edge( U32 face1, U32 face2, U32 vertex1, U32 vertex2 ) { face[ 0 ] = face1; diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index 22c877594..5cf0ae59c 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -616,7 +616,7 @@ bool ModuleManager::unloadModuleGroup( const char* pModuleGroup ) if ( mEchoInfo ) { Con::printf( "Module Manager: Unloading group '%s' but could not unload module Id '%s' at version Id '%d'.", - moduleGroup, pLoadedEntry->mpModuleDefinition->getModuleId(), pLoadedEntry->mpModuleDefinition->getVersionId() ); + moduleGroup, pLoadReadyModuleDefinition->getModuleId(), pLoadReadyModuleDefinition->getVersionId()); } // Skip. continue; diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index 2fcd6ecfb..89c42fe08 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -918,7 +918,7 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe *probe, bool writeFiles) Frustum culler; culler.set(false, query.fov, - (F32)resolution / (F32)resolution, + 1.0f, query.nearPlane, query.farPlane, query.cameraMatrix); @@ -962,6 +962,8 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe *probe, bool writeFiles) IBLUtilities::GenerateIrradianceMap(renderTarget, cubeRefl.getCubemap(), clientProbe->mIrridianceMap->mCubemap); IBLUtilities::GeneratePrefilterMap(renderTarget, cubeRefl.getCubemap(), prefilterMipLevels, clientProbe->mPrefilterMap->mCubemap); + renderTarget->destroySelf(); + U32 endMSTime = Platform::getRealMilliseconds(); F32 diffTime = F32(endMSTime - startMSTime); Con::warnf("RenderProbeMgr::bake() - Finished Capture! Took %g milliseconds", diffTime); diff --git a/Engine/source/renderInstance/renderTranslucentMgr.cpp b/Engine/source/renderInstance/renderTranslucentMgr.cpp index 2e1d6879d..223ebc22e 100644 --- a/Engine/source/renderInstance/renderTranslucentMgr.cpp +++ b/Engine/source/renderInstance/renderTranslucentMgr.cpp @@ -306,7 +306,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state ) if (passRI->accuTex != lastAccuTex) { sgData.accuTex = passRI->accuTex; - lastAccuTex = lastAccuTex; dirty = true; } diff --git a/Engine/source/scene/fogStructs.h b/Engine/source/scene/fogStructs.h index 8e4853ee7..f051ee88f 100644 --- a/Engine/source/scene/fogStructs.h +++ b/Engine/source/scene/fogStructs.h @@ -58,10 +58,10 @@ struct WaterFogData densityOffset = 0.0f; wetDepth = 0.0f; wetDarkening = 0.0f; - color.set( 0.5f, 0.5f, 0.5f, 1.0f ); + color = ColorI(128, 128, 128, 128); plane.set( 0.0f, 0.0f, 1.0f, 1e10 ); // Default to global bounds distance depthGradMax = 0.0f; } }; -#endif // _FOGSTRUCTS_H_ \ No newline at end of file +#endif // _FOGSTRUCTS_H_ diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 10443cf18..90a812c1c 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -1704,7 +1704,7 @@ void SceneObject::updateRenderChangesByParent(){ // This is needed by objects that update their own render transform thru interpolate tick // Mostly for stationary objects. - if (getClassName() == "Player") + if (getClassName() == StringTable->insert("Player")) mat.mul(offset,getRenderTransform()); else mat.mul(offset,getTransform()); diff --git a/Engine/source/sfx/sfxSound.cpp b/Engine/source/sfx/sfxSound.cpp index c62c41605..a4f2c05d3 100644 --- a/Engine/source/sfx/sfxSound.cpp +++ b/Engine/source/sfx/sfxSound.cpp @@ -149,7 +149,7 @@ SFXSound* SFXSound::_create( SFXDevice* device, SFXBuffer* buffer = SFX->_createBuffer( stream, description ); if( !buffer ) { - source->deleteObject(); + SAFE_DELETE_OBJECT(source); Con::errorf( "SFXSound::_create() - Could not create device buffer!" ); return NULL; diff --git a/Engine/source/shaderGen/customShaderFeature.cpp b/Engine/source/shaderGen/customShaderFeature.cpp index f2444ab07..e17cdc088 100644 --- a/Engine/source/shaderGen/customShaderFeature.cpp +++ b/Engine/source/shaderGen/customShaderFeature.cpp @@ -185,6 +185,8 @@ bool CustomShaderFeatureData::hasFeature(String name) if (GFX->getAdapterType() == GFXAdapterType::OpenGL) return mFeatureGLSL->hasFeature(name); #endif + + return false; } void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv) diff --git a/Engine/source/shaderGen/shaderGen.cpp b/Engine/source/shaderGen/shaderGen.cpp index 282ead138..90ca96e65 100644 --- a/Engine/source/shaderGen/shaderGen.cpp +++ b/Engine/source/shaderGen/shaderGen.cpp @@ -141,16 +141,13 @@ void ShaderGen::generateShader( const MaterialFeatureData &featureData, F32 *pixVersion, const GFXVertexFormat *vertexFormat, const char* cacheName, - Vector ¯os, - Vector &customFeatureData) + Vector ¯os) { PROFILE_SCOPE( ShaderGen_GenerateShader ); mFeatureData = featureData; mVertexFormat = vertexFormat; - mCustomFeaturesData = customFeatureData; - _uninit(); _init(); @@ -290,44 +287,6 @@ void ShaderGen::_processVertFeatures( Vector ¯os, bool macro } } - //Handle if we have any custom features - if (!mCustomFeaturesData.empty()) - { - for (U32 i = 0; i < mCustomFeaturesData.size(); ++i) - { -#ifdef TORQUE_D3D11 - if (GFX->getAdapterType() == GFXAdapterType::Direct3D11) - { - mCustomFeaturesData[i]->mFeatureHLSL->processVert(mComponents, mFeatureData); - - String line = String::ToString(" // %s\r\n", mCustomFeaturesData[i]->mFeatureHLSL->getName().c_str()); - mOutput->addStatement(new GenOp(line)); - - if (mCustomFeaturesData[i]->mFeatureHLSL->getOutput()) - mOutput->addStatement(mCustomFeaturesData[i]->mFeatureHLSL->getOutput()); - - mCustomFeaturesData[i]->mFeatureHLSL->reset(); - mOutput->addStatement(new GenOp(" \r\n")); - } -#endif -#ifdef TORQUE_OPENGL - if (GFX->getAdapterType() == GFXAdapterType::OpenGL) - { - mCustomFeaturesData[i]->mFeatureGLSL->processVert(mComponents, mFeatureData); - - String line = String::ToString(" // %s\r\n", mCustomFeaturesData[i]->mFeatureGLSL->getName().c_str()); - mOutput->addStatement(new GenOp(line)); - - if (mCustomFeaturesData[i]->mFeatureGLSL->getOutput()) - mOutput->addStatement(mCustomFeaturesData[i]->mFeatureGLSL->getOutput()); - - mCustomFeaturesData[i]->mFeatureGLSL->reset(); - mOutput->addStatement(new GenOp(" \r\n")); - } -#endif - } - } - ShaderConnector *connect = dynamic_cast( mComponents[C_CONNECTOR] ); connect->sortVars(); } @@ -367,44 +326,6 @@ void ShaderGen::_processPixFeatures( Vector ¯os, bool macros mOutput->addStatement( new GenOp( " \r\n" ) ); } } - - //Handle if we have any custom features - if (!mCustomFeaturesData.empty()) - { - for (U32 i = 0; i < mCustomFeaturesData.size(); ++i) - { -#ifdef TORQUE_D3D11 - if (GFX->getAdapterType() == GFXAdapterType::Direct3D11) - { - mCustomFeaturesData[i]->mFeatureHLSL->processPix(mComponents, mFeatureData); - - String line = String::ToString(" // %s\r\n", mCustomFeaturesData[i]->mFeatureHLSL->getName().c_str()); - mOutput->addStatement(new GenOp(line)); - - if (mCustomFeaturesData[i]->mFeatureHLSL->getOutput()) - mOutput->addStatement(mCustomFeaturesData[i]->mFeatureHLSL->getOutput()); - - mCustomFeaturesData[i]->mFeatureHLSL->reset(); - mOutput->addStatement(new GenOp(" \r\n")); - } -#endif -#ifdef TORQUE_OPENGL - if (GFX->getAdapterType() == GFXAdapterType::OpenGL) - { - mCustomFeaturesData[i]->mFeatureGLSL->processPix(mComponents, mFeatureData); - - String line = String::ToString(" // %s\r\n", mCustomFeaturesData[i]->mFeatureGLSL->getName().c_str()); - mOutput->addStatement(new GenOp(line)); - - if (mCustomFeaturesData[i]->mFeatureGLSL->getOutput()) - mOutput->addStatement(mCustomFeaturesData[i]->mFeatureGLSL->getOutput()); - - mCustomFeaturesData[i]->mFeatureGLSL->reset(); - mOutput->addStatement(new GenOp(" \r\n")); - } -#endif - } - } ShaderConnector *connect = dynamic_cast( mComponents[C_CONNECTOR] ); connect->sortVars(); @@ -528,7 +449,7 @@ void ShaderGen::_printPixShader( Stream &stream ) mPrinter->printPixelShaderCloser(stream); } -GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, Vector &customFeatureData, const GFXVertexFormat *vertexFormat, const Vector *macros, const Vector &samplers ) +GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, const GFXVertexFormat *vertexFormat, const Vector *macros, const Vector &samplers ) { PROFILE_SCOPE( ShaderGen_GetShader ); @@ -568,7 +489,7 @@ GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, Vector< shaderMacros.push_back( GFXShaderMacro( "TORQUE_SHADERGEN" ) ); if ( macros ) shaderMacros.merge( *macros ); - generateShader( featureData, vertFile, pixFile, &pixVersion, vertexFormat, cacheKey, shaderMacros, customFeatureData ); + generateShader( featureData, vertFile, pixFile, &pixVersion, vertexFormat, cacheKey, shaderMacros ); GFXShader *shader = GFX->createShader(); if (!shader->init(vertFile, pixFile, pixVersion, shaderMacros, samplers, &mInstancingFormat)) diff --git a/Engine/source/shaderGen/shaderGen.h b/Engine/source/shaderGen/shaderGen.h index 829487602..8ff8ef0f6 100644 --- a/Engine/source/shaderGen/shaderGen.h +++ b/Engine/source/shaderGen/shaderGen.h @@ -47,10 +47,6 @@ #include "materials/materialFeatureData.h" #endif -#ifndef CUSTOMSHADERFEATURE_H -#include "shadergen/customShaderFeature.h" -#endif - /// Base class used by shaderGen to be API agnostic. Subclasses implement the various methods /// in an API specific way. class ShaderGenPrinter @@ -155,11 +151,10 @@ public: F32 *pixVersion, const GFXVertexFormat *vertexFormat, const char* cacheName, - Vector ¯os, - Vector &customFeatureData); + Vector ¯os); // Returns a shader that implements the features listed by dat. - GFXShader* getShader( const MaterialFeatureData &dat, Vector &customFeatureData, const GFXVertexFormat *vertexFormat, const Vector *macros, const Vector &samplers ); + GFXShader* getShader( const MaterialFeatureData &dat, const GFXVertexFormat *vertexFormat, const Vector *macros, const Vector &samplers ); // This will delete all of the procedural shaders that we have. Used to regenerate shaders when // the ShaderFeatures have changed (due to lighting system change, or new plugin) @@ -181,8 +176,6 @@ protected: Vector< ShaderComponent *> mComponents; - Vector< CustomShaderFeatureData* > mCustomFeaturesData; - AutoPtr mPrinter; AutoPtr mComponentFactory; diff --git a/Engine/source/sim/netConnection.h b/Engine/source/sim/netConnection.h index ab58ac0e0..3503275ef 100644 --- a/Engine/source/sim/netConnection.h +++ b/Engine/source/sim/netConnection.h @@ -863,7 +863,7 @@ public: void setScopeObject(NetObject *object); /// Get the object around which we are currently scoping network traffic. - NetObject* getScopeObject() {}; + NetObject* getScopeObject() { return nullptr; }; /// Add an object to scope. void objectInScope(NetObject *object); diff --git a/Engine/source/terrain/terrCellMaterial.cpp b/Engine/source/terrain/terrCellMaterial.cpp index 64d2ea8e6..8897601e7 100644 --- a/Engine/source/terrain/terrCellMaterial.cpp +++ b/Engine/source/terrain/terrCellMaterial.cpp @@ -482,8 +482,6 @@ bool TerrainCellMaterial::_createPass( Vector *materials, featureData.features = features; featureData.materialFeatures = features; - Vector customFeatures; - // Check to see how many vertex shader output // registers we're gonna need. U32 numTex = 0; @@ -526,7 +524,7 @@ bool TerrainCellMaterial::_createPass( Vector *materials, const bool logErrors = true;// matCount == 1; GFXShader::setLogging( logErrors, true ); - pass->shader = SHADERGEN->getShader( featureData, customFeatures, getGFXVertexFormat(), NULL, mSamplerNames ); + pass->shader = SHADERGEN->getShader( featureData, getGFXVertexFormat(), NULL, mSamplerNames ); } // If we got a shader then we can continue. diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 974d2a8ed..6f194b0f3 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -770,6 +770,8 @@ static void conditioner_createDefaultClip(domCOLLADA* root) static void conditioner_fixupAnimation(domAnimation* anim) { + S32 visibilityLen = dStrlen("/visibility"); + for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) { // Get the animation elements: , @@ -815,7 +817,7 @@ static void conditioner_fixupAnimation(domAnimation* anim) // Get parent SID string char *parentSID = dStrdup(channel->getTarget()); - parentSID[dStrlen(parentSID) - dStrlen("/visibility")] = '\0'; + parentSID[dStrlen(parentSID) - visibilityLen] = '\0'; // Find the parent element (should be a ) daeSIDResolver parentResolver(channel, parentSID); @@ -3039,4 +3041,4 @@ void ColladaUtils::ExportData::processData() } } } -} \ No newline at end of file +} diff --git a/Engine/source/ts/tsDump.cpp b/Engine/source/ts/tsDump.cpp index 987b2b757..9195bf27d 100644 --- a/Engine/source/ts/tsDump.cpp +++ b/Engine/source/ts/tsDump.cpp @@ -64,6 +64,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector if (objectList.size() == 0) dumpLine("\r\n"); + S32 nodeNameLen = dStrlen(nodeName); S32 spaceCount = -1; for (S32 j=0;j 2000) spaceCount = 2000; diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 0de7478c3..4e1244aac 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -424,6 +424,8 @@ bool TSShapeConstructor::onAdd() group = new SimGroup(); if ( !group->registerObject("TSShapeConstructorGroup") ) { + SAFE_DELETE(group); + Con::errorf("TSShapeConstructor::onAdd failed: Could not register " "TSShapeConstructorGroup"); return false; From 350d3e67022725500b9e0db12d63ab39f03d4da7 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 20 Sep 2020 01:19:08 -0500 Subject: [PATCH 2/2] Fixes 2 minor mistake corrections --- Engine/source/gui/controls/guiMLTextCtrl.cpp | 3 ++- Engine/source/gui/controls/guiMLTextCtrl.h | 2 +- Engine/source/renderInstance/renderTranslucentMgr.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/controls/guiMLTextCtrl.cpp b/Engine/source/gui/controls/guiMLTextCtrl.cpp index 67ce7beaf..85d093f26 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.cpp +++ b/Engine/source/gui/controls/guiMLTextCtrl.cpp @@ -528,7 +528,8 @@ void GuiMLTextCtrl::inspectPostApply() setText(mInitialText, dStrlen(mInitialText)); - mLineSpacingPixels = 0; + if (mLineSpacingPixels < 0) + mLineSpacingPixels = 0; } diff --git a/Engine/source/gui/controls/guiMLTextCtrl.h b/Engine/source/gui/controls/guiMLTextCtrl.h index 3aefa22e7..8eb3ff263 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.h +++ b/Engine/source/gui/controls/guiMLTextCtrl.h @@ -253,7 +253,7 @@ class GuiMLTextCtrl : public GuiControl Resource mFont; // Console settable parameters - U32 mLineSpacingPixels; + S32 mLineSpacingPixels; bool mAllowColorChars; bool mUseURLMouseCursor; diff --git a/Engine/source/renderInstance/renderTranslucentMgr.cpp b/Engine/source/renderInstance/renderTranslucentMgr.cpp index 223ebc22e..94598262d 100644 --- a/Engine/source/renderInstance/renderTranslucentMgr.cpp +++ b/Engine/source/renderInstance/renderTranslucentMgr.cpp @@ -306,6 +306,7 @@ void RenderTranslucentMgr::render( SceneRenderState *state ) if (passRI->accuTex != lastAccuTex) { sgData.accuTex = passRI->accuTex; + lastAccuTex = passRI->accuTex; dirty = true; }