mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Various misc. tweaks and fixes based on static code analysis to minimize/fix memleaks, crashes, or other performance impacting code.
This commit is contained in:
parent
d76c73c252
commit
8956559bfd
44 changed files with 124 additions and 258 deletions
|
|
@ -11,7 +11,8 @@ Scene::Scene() :
|
||||||
mParentScene(nullptr),
|
mParentScene(nullptr),
|
||||||
mSceneId(-1),
|
mSceneId(-1),
|
||||||
mIsEditing(false),
|
mIsEditing(false),
|
||||||
mIsDirty(false)
|
mIsDirty(false),
|
||||||
|
mEditPostFX(0)
|
||||||
{
|
{
|
||||||
mGameModeName = StringTable->EmptyString();
|
mGameModeName = StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,8 @@ AIPlayer::AIPlayer()
|
||||||
|
|
||||||
for( S32 i = 0; i < MaxTriggerKeys; i ++ )
|
for( S32 i = 0; i < MaxTriggerKeys; i ++ )
|
||||||
mMoveTriggers[ i ] = false;
|
mMoveTriggers[ i ] = false;
|
||||||
|
|
||||||
|
mAttackRadius = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ GuiControl* GuiInspectorTypeGameObjectAssetPtr::constructEditControl()
|
||||||
|
|
||||||
const char* assetId = getData();
|
const char* assetId = getData();
|
||||||
|
|
||||||
if (assetId == "")
|
if (dStrEqual(assetId, ""))
|
||||||
{
|
{
|
||||||
mGameObjectEditButton->setText("Create Game Object");
|
mGameObjectEditButton->setText("Create Game Object");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ bool GuiInspectorTypeMaterialAssetPtr::updateRects()
|
||||||
|
|
||||||
bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
||||||
|
|
||||||
if (mMatEdContainer != nullptr)
|
if (mMatEdContainer != nullptr && mMatPreviewButton != nullptr)
|
||||||
{
|
{
|
||||||
mMatPreviewButton->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
mMatPreviewButton->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -783,7 +783,7 @@ U32 DecalManager::_generateConvexHull( const Vector<Point3F> &points, Vector<Poi
|
||||||
while ( ++i <= maxmin )
|
while ( ++i <= maxmin )
|
||||||
{
|
{
|
||||||
// the lower line joins P[minmin] with P[maxmin]
|
// the lower line joins P[minmin] with P[maxmin]
|
||||||
if ( isLeft( points[minmin], points[maxmin], points[i]) >= 0 && i < maxmin )
|
if (i < maxmin && isLeft(points[minmin], points[maxmin], points[i]) >= 0)
|
||||||
continue; // ignore P[i] above or on the lower line
|
continue; // ignore P[i] above or on the lower line
|
||||||
|
|
||||||
while (top > 0) // there are at least 2 points on the stack
|
while (top > 0) // there are at least 2 points on the stack
|
||||||
|
|
|
||||||
|
|
@ -747,14 +747,21 @@ void ReflectionProbe::processStaticCubemap()
|
||||||
|
|
||||||
if (Platform::isFile(irradFileName))
|
if (Platform::isFile(irradFileName))
|
||||||
{
|
{
|
||||||
mIrridianceMap->setCubemapFile(FileName(irradFileName));
|
if (mIrridianceMap == nullptr)
|
||||||
mIrridianceMap->updateFaces();
|
{
|
||||||
}
|
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull())
|
mIrridianceMap->setCubemapFile(FileName(irradFileName));
|
||||||
{
|
|
||||||
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName);
|
if (mIrridianceMap->mCubemap.isNull())
|
||||||
return;
|
{
|
||||||
|
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIrridianceMap->updateFaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
char prefilterFileName[256];
|
char prefilterFileName[256];
|
||||||
|
|
@ -762,14 +769,21 @@ void ReflectionProbe::processStaticCubemap()
|
||||||
|
|
||||||
if (Platform::isFile(prefilterFileName))
|
if (Platform::isFile(prefilterFileName))
|
||||||
{
|
{
|
||||||
mPrefilterMap->setCubemapFile(FileName(prefilterFileName));
|
if (mPrefilterMap == nullptr)
|
||||||
mPrefilterMap->updateFaces();
|
{
|
||||||
}
|
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull())
|
mPrefilterMap->setCubemapFile(FileName(prefilterFileName));
|
||||||
{
|
|
||||||
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName);
|
if (mPrefilterMap->mCubemap.isNull())
|
||||||
return;
|
{
|
||||||
|
Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPrefilterMap->updateFaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Platform::isFile(prefilterFileName) || !Platform::isFile(irradFileName))
|
if (!Platform::isFile(prefilterFileName) || !Platform::isFile(irradFileName))
|
||||||
|
|
@ -809,7 +823,7 @@ void ReflectionProbe::processStaticCubemap()
|
||||||
IBLUtilities::SaveCubeMap(prefilterFileName, mPrefilterMap->mCubemap);
|
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->mPrefilterCubemap = mPrefilterMap->mCubemap;
|
||||||
mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
|
mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ PlayerData::PlayerData()
|
||||||
|
|
||||||
maxStepHeight = 1.0f;
|
maxStepHeight = 1.0f;
|
||||||
runSurfaceAngle = 80.0f;
|
runSurfaceAngle = 80.0f;
|
||||||
|
runSurfaceCos = mCos(mDegToRad(runSurfaceAngle));
|
||||||
|
|
||||||
fallingSpeedThreshold = -10.0f;
|
fallingSpeedThreshold = -10.0f;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,7 @@ SFXEmitter::~SFXEmitter()
|
||||||
{
|
{
|
||||||
mLocalProfile._unregisterSignals();
|
mLocalProfile._unregisterSignals();
|
||||||
|
|
||||||
if( mSource )
|
SFX_DELETE( mSource );
|
||||||
SFX_DELETE( mSource );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1210,7 +1210,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
}
|
}
|
||||||
ShapeBaseData *prevDB = dynamic_cast<ShapeBaseData*>( mDataBlock );
|
ShapeBaseData *prevDB = dynamic_cast<ShapeBaseData*>( mDataBlock );
|
||||||
|
|
||||||
bool isInitialDataBlock = ( mDataBlock == 0 );
|
bool isInitialDataBlock = (prevDB == 0);
|
||||||
|
|
||||||
if ( Parent::onNewDataBlock( dptr, reload ) == false )
|
if ( Parent::onNewDataBlock( dptr, reload ) == false )
|
||||||
return 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++)
|
for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
|
||||||
{
|
{
|
||||||
ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
|
ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
|
||||||
Vector<String> & mat_names = (Vector<String>&) mat_list->getMaterialNameList();
|
Vector<String>& mat_names = (Vector<String>&) mat_list->getMaterialNameList();
|
||||||
|
S32 old_tagLen = dStrlen(remap->old_tag);
|
||||||
for (S32 j = 0; j < mat_names.size(); j++)
|
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] = String(remap->new_tag);
|
||||||
mat_names[j].insert(0,'#');
|
mat_names[j].insert(0, '#');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1263,14 +1264,15 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
|
for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
|
||||||
{
|
{
|
||||||
ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
|
ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i];
|
||||||
Vector<String> & mat_names = (Vector<String>&) mat_list->getMaterialNameList();
|
Vector<String>& mat_names = (Vector<String>&) mat_list->getMaterialNameList();
|
||||||
|
S32 new_tagLen = dStrlen(remap->new_tag);
|
||||||
for (S32 j = 0; j < mat_names.size(); j++)
|
for (S32 j = 0; j < mat_names.size(); j++)
|
||||||
{
|
{
|
||||||
String::SizeType len = mat_names[j].length();
|
String::SizeType len = mat_names[j].length();
|
||||||
if (len > 1)
|
if (len > 1)
|
||||||
{
|
{
|
||||||
String temp_name = mat_names[j].substr(1,len-1);
|
String temp_name = mat_names[j].substr(1, len - 1);
|
||||||
if (temp_name.compare(remap->new_tag, dStrlen(remap->new_tag)) == 0)
|
if (temp_name.compare(remap->new_tag, new_tagLen) == 0)
|
||||||
{
|
{
|
||||||
mat_names[j] = String(remap->old_tag);
|
mat_names[j] = String(remap->old_tag);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1286,7 +1288,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
resetWorldBox();
|
resetWorldBox();
|
||||||
|
|
||||||
// Set the initial mesh hidden state.
|
// Set the initial mesh hidden state.
|
||||||
mMeshHidden.setSize( mDataBlock->mShape->objects.size() );
|
mMeshHidden.setSize(mDataBlock->mShape->objects.size());
|
||||||
mMeshHidden.clear();
|
mMeshHidden.clear();
|
||||||
|
|
||||||
// Initialize the threads
|
// Initialize the threads
|
||||||
|
|
@ -1308,17 +1310,17 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
// New datablock/shape may not actually HAVE this sequence.
|
// New datablock/shape may not actually HAVE this sequence.
|
||||||
// In that case stop playing it.
|
// In that case stop playing it.
|
||||||
|
|
||||||
AssertFatal( prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?" );
|
AssertFatal(prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?");
|
||||||
|
|
||||||
const TSShape *prevShape = prevDB->mShape;
|
const TSShape* prevShape = prevDB->mShape;
|
||||||
const TSShape::Sequence &prevSeq = prevShape->sequences[st.sequence];
|
const TSShape::Sequence& prevSeq = prevShape->sequences[st.sequence];
|
||||||
const String &prevSeqName = prevShape->names[prevSeq.nameIndex];
|
const String& prevSeqName = prevShape->names[prevSeq.nameIndex];
|
||||||
|
|
||||||
st.sequence = mDataBlock->mShape->findSequence( prevSeqName );
|
st.sequence = mDataBlock->mShape->findSequence(prevSeqName);
|
||||||
|
|
||||||
if ( st.sequence != -1 )
|
if (st.sequence != -1)
|
||||||
{
|
{
|
||||||
setThreadSequence( i, st.sequence, reset );
|
setThreadSequence(i, st.sequence, reset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1326,15 +1328,15 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
if (mDataBlock->damageSequence != -1) {
|
if (mDataBlock->damageSequence != -1) {
|
||||||
mDamageThread = mShapeInstance->addThread();
|
mDamageThread = mShapeInstance->addThread();
|
||||||
mShapeInstance->setSequence(mDamageThread,
|
mShapeInstance->setSequence(mDamageThread,
|
||||||
mDataBlock->damageSequence,0);
|
mDataBlock->damageSequence, 0);
|
||||||
}
|
}
|
||||||
if (mDataBlock->hulkSequence != -1) {
|
if (mDataBlock->hulkSequence != -1) {
|
||||||
mHulkThread = mShapeInstance->addThread();
|
mHulkThread = mShapeInstance->addThread();
|
||||||
mShapeInstance->setSequence(mHulkThread,
|
mShapeInstance->setSequence(mHulkThread,
|
||||||
mDataBlock->hulkSequence,0);
|
mDataBlock->hulkSequence, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isGhost() )
|
if (isGhost())
|
||||||
{
|
{
|
||||||
// Reapply the current skin
|
// Reapply the current skin
|
||||||
mAppliedSkinName = "";
|
mAppliedSkinName = "";
|
||||||
|
|
|
||||||
|
|
@ -339,8 +339,13 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
||||||
// Resolve objects transmitted from server
|
// Resolve objects transmitted from server
|
||||||
if (!server) {
|
if (!server) {
|
||||||
for (S32 i = 0; i < MaxSounds; i++)
|
for (S32 i = 0; i < MaxSounds; i++)
|
||||||
if( !sfxResolve( &sound[ i ], errorStr ) )
|
{
|
||||||
|
if (!sfxResolve(&sound[i], errorStr))
|
||||||
|
{
|
||||||
|
delete si;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tireEmitter)
|
if (tireEmitter)
|
||||||
Sim::findObject(SimObjectId((uintptr_t)tireEmitter),tireEmitter);
|
Sim::findObject(SimObjectId((uintptr_t)tireEmitter),tireEmitter);
|
||||||
|
|
|
||||||
|
|
@ -1584,8 +1584,8 @@ static void handleMasterServerListResponse( BitStream* stream, U32 key, U8 /*fla
|
||||||
{
|
{
|
||||||
if ( i != packetIndex )
|
if ( i != packetIndex )
|
||||||
{
|
{
|
||||||
PacketStatus* p = new PacketStatus( i, gMasterServerPing.key, currentTime );
|
PacketStatus p = PacketStatus( i, gMasterServerPing.key, currentTime );
|
||||||
gPacketStatusList.push_back( *p );
|
gPacketStatusList.push_back( p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1674,8 +1674,8 @@ static void handleExtendedMasterServerListResponse(BitStream* stream, U32 key, U
|
||||||
{
|
{
|
||||||
if (i != packetIndex)
|
if (i != packetIndex)
|
||||||
{
|
{
|
||||||
PacketStatus* p = new PacketStatus(i, gMasterServerPing.key, currentTime);
|
PacketStatus p = PacketStatus(i, gMasterServerPing.key, currentTime);
|
||||||
gPacketStatusList.push_back(*p);
|
gPacketStatusList.push_back(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ typedef Chunker<BSPNode> BSPTree;
|
||||||
/// @see Collision
|
/// @see Collision
|
||||||
struct RayInfo : public Collision
|
struct RayInfo : public Collision
|
||||||
{
|
{
|
||||||
RayInfo() : userData( NULL ) {}
|
RayInfo() : t(0), userData( NULL ) {}
|
||||||
|
|
||||||
// The collision struct has object, point, normal & material.
|
// The collision struct has object, point, normal & material.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1579,6 +1579,9 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar
|
||||||
}
|
}
|
||||||
bool result;
|
bool result;
|
||||||
const char* methodRes = CInterface::CallMethod(object, argv[0], argv_str, argc - 2, &result);
|
const char* methodRes = CInterface::CallMethod(object, argv[0], argv_str, argc - 2, &result);
|
||||||
|
|
||||||
|
free(argv_str);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
return ConsoleValueRef::fromValue(CSTK.pushString(methodRes));
|
return ConsoleValueRef::fromValue(CSTK.pushString(methodRes));
|
||||||
|
|
|
||||||
|
|
@ -542,6 +542,8 @@ void FieldBrushObject::pasteFields( SimObject* pSimObject )
|
||||||
// Force modification of static-fields on target object!
|
// Force modification of static-fields on target object!
|
||||||
pSimObject->setModStaticFields( true );
|
pSimObject->setModStaticFields( true );
|
||||||
|
|
||||||
|
S32 prefixLength = dStrlen(INTERNAL_FIELD_PREFIX);
|
||||||
|
|
||||||
// Iterate fields.
|
// Iterate fields.
|
||||||
for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr )
|
for ( SimFieldDictionaryIterator itr(pFieldDictionary); *itr; ++itr )
|
||||||
{
|
{
|
||||||
|
|
@ -553,7 +555,7 @@ void FieldBrushObject::pasteFields( SimObject* pSimObject )
|
||||||
if ( pInternalField == fieldEntry->slotName )
|
if ( pInternalField == fieldEntry->slotName )
|
||||||
{
|
{
|
||||||
// Yes, so skip the prefix.
|
// Yes, so skip the prefix.
|
||||||
pInternalField += dStrlen(INTERNAL_FIELD_PREFIX);
|
pInternalField += prefixLength;
|
||||||
|
|
||||||
// Is this a static-field on the target object?
|
// 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.
|
// NOTE:- We're doing this so we don't end-up creating a dynamic-field if it isn't present.
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
||||||
|
|
||||||
if (mShapeAssetId != StringTable->EmptyString())
|
if (mShapeAssetId != StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
mShape = mShape = mShapeAsset->getShapeResource();
|
mShape = mShapeAsset->getShapeResource();
|
||||||
}
|
}
|
||||||
else if (mShapeName && mShapeName[0] != '\0')
|
else if (mShapeName && mShapeName[0] != '\0')
|
||||||
{
|
{
|
||||||
|
|
@ -1048,7 +1048,7 @@ void VolumetricFog::prepRenderImage(SceneRenderState *state)
|
||||||
return;
|
return;
|
||||||
if (mNumDetailLevels > 1)
|
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);
|
UpdateBuffers(mCurDetailLevel + 1);
|
||||||
else if (mCurDetailLevel > 0)
|
else if (mCurDetailLevel > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -375,6 +375,8 @@ GFXTextureObject *GFXTextureManager::_createTexture( GBitmap *bmp,
|
||||||
|
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
|
SAFE_DELETE(realBmp);
|
||||||
|
|
||||||
Con::errorf("GFXTextureManager - failed to create texture (1) for '%s'", (resourceName.isNotEmpty() ? resourceName.c_str() : "unknown"));
|
Con::errorf("GFXTextureManager - failed to create texture (1) for '%s'", (resourceName.isNotEmpty() ? resourceName.c_str() : "unknown"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ DefineEngineMethod(CubemapData, save, void, (const char* filename, const GFXForm
|
||||||
"Returns the script filename of where the CubemapData object was "
|
"Returns the script filename of where the CubemapData object was "
|
||||||
"defined. This is used by the material editor.")
|
"defined. This is used by the material editor.")
|
||||||
{
|
{
|
||||||
if (filename == "")
|
if (dStrEqual(filename, ""))
|
||||||
filename = object->getName();
|
filename = object->getName();
|
||||||
|
|
||||||
//add dds extension if needed
|
//add dds extension if needed
|
||||||
|
|
|
||||||
|
|
@ -528,8 +528,7 @@ void GuiMLTextCtrl::inspectPostApply()
|
||||||
|
|
||||||
setText(mInitialText, dStrlen(mInitialText));
|
setText(mInitialText, dStrlen(mInitialText));
|
||||||
|
|
||||||
if (mLineSpacingPixels < 0)
|
mLineSpacingPixels = 0;
|
||||||
mLineSpacingPixels = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ DefineEngineMethod(GuiVariableInspector, addField, void, (const char* name, cons
|
||||||
const char* description, const char* defaultValue, const char* dataValues, SimObject* ownerObj),
|
const char* description, const char* defaultValue, const char* dataValues, SimObject* ownerObj),
|
||||||
("","","","","", "", nullAsType<SimObject*>()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, ownerObject )")
|
("","","","","", "", nullAsType<SimObject*>()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, ownerObject )")
|
||||||
{
|
{
|
||||||
if (name == "" || typeName == "")
|
if (dStrEqual(name, "") || dStrEqual(typeName, ""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
object->addField(name, label, typeName, description, defaultValue, dataValues, "", ownerObj);
|
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),
|
const char* description, const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj),
|
||||||
("", "", "", "", "", "", nullAsType<SimObject*>()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, callbackName, ownerObject )")
|
("", "", "", "", "", "", nullAsType<SimObject*>()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, callbackName, ownerObject )")
|
||||||
{
|
{
|
||||||
if (name == "" || typeName == "")
|
if (dStrEqual(name, "") || dStrEqual(typeName, ""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
object->addCallbackField(name, label, typeName, description, defaultValue, dataValues, callbackName, ownerObj);
|
object->addCallbackField(name, label, typeName, description, defaultValue, dataValues, callbackName, ownerObj);
|
||||||
|
|
|
||||||
|
|
@ -4042,23 +4042,6 @@ bool WorldEditor::makeSelectionAMesh(const char *filename)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
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),
|
DefineEngineMethod( WorldEditor, makeSelectionPrefab, void, ( const char* filename, bool dontDeleteOriginals ), (false),
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,6 @@ void DeferredRTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
meta->addStatement( new GenOp( " @.y = 1.0 - @.y;\r\n", uvScene, uvScene ) ); // flip the y axis
|
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
|
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
|
// create texture var
|
||||||
Var *lightInfoBuffer = new Var;
|
Var *lightInfoBuffer = new Var;
|
||||||
lightInfoBuffer->setType( "sampler2D" );
|
lightInfoBuffer->setType( "sampler2D" );
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,6 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
meta->addStatement( new GenOp( " @.y = 1.0 - @.y;\r\n", uvScene, uvScene ) ); // flip the y axis
|
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
|
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
|
// create texture var
|
||||||
Var *lightInfoBuffer = new Var;
|
Var *lightInfoBuffer = new Var;
|
||||||
lightInfoBuffer->setType( "SamplerState" );
|
lightInfoBuffer->setType( "SamplerState" );
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ bool CustomMaterial::onAdd()
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* samplerDecl = "sampler";
|
const char* samplerDecl = "sampler";
|
||||||
|
S32 samplerDeclLen = dStrlen(samplerDecl);
|
||||||
S32 i = 0;
|
S32 i = 0;
|
||||||
for (SimFieldDictionaryIterator itr(getFieldDictionary()); *itr; ++itr)
|
for (SimFieldDictionaryIterator itr(getFieldDictionary()); *itr; ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +133,7 @@ bool CustomMaterial::onAdd()
|
||||||
return false;
|
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\"]");
|
logError("sampler declarations must have a sampler name, e.g. sampler[\"diffuseMap\"]");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -140,7 +141,7 @@ bool CustomMaterial::onAdd()
|
||||||
|
|
||||||
// Assert sampler names are defined on ShaderData
|
// Assert sampler names are defined on ShaderData
|
||||||
S32 pos = -1;
|
S32 pos = -1;
|
||||||
String samplerName = entry->slotName + dStrlen(samplerDecl);
|
String samplerName = entry->slotName + samplerDeclLen;
|
||||||
samplerName.insert(0, '$');
|
samplerName.insert(0, '$');
|
||||||
mShaderData->hasSamplerDef(samplerName, pos);
|
mShaderData->hasSamplerDef(samplerName, pos);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -502,11 +502,6 @@ void Material::initPersistFields()
|
||||||
|
|
||||||
endGroup( "Behavioral" );
|
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();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,36 +519,6 @@ bool Material::writeField( StringTableEntry fieldname, const char *value )
|
||||||
return Parent::writeField( fieldname, 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()
|
bool Material::onAdd()
|
||||||
{
|
{
|
||||||
if (Parent::onAdd() == false)
|
if (Parent::onAdd() == false)
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,6 @@
|
||||||
#include "console/dynamicTypes.h"
|
#include "console/dynamicTypes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CUSTOMSHADERFEATURE_H
|
|
||||||
#include "shaderGen/customShaderFeature.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IMAGE_ASSET_H
|
#ifndef IMAGE_ASSET_H
|
||||||
#include "T3D/assets/ImageAsset.h"
|
#include "T3D/assets/ImageAsset.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -59,7 +55,6 @@ class FeatureSet;
|
||||||
class FeatureType;
|
class FeatureType;
|
||||||
class MaterialSoundProfile;
|
class MaterialSoundProfile;
|
||||||
class MaterialPhysicsProfile;
|
class MaterialPhysicsProfile;
|
||||||
class CustomShaderFeatureData;
|
|
||||||
|
|
||||||
/// The basic material definition.
|
/// The basic material definition.
|
||||||
class Material : public BaseMaterialDefinition
|
class Material : public BaseMaterialDefinition
|
||||||
|
|
@ -356,8 +351,6 @@ public:
|
||||||
F32 mDirectSoundOcclusion; ///< Amount of volume occlusion on direct sounds.
|
F32 mDirectSoundOcclusion; ///< Amount of volume occlusion on direct sounds.
|
||||||
F32 mReverbSoundOcclusion; ///< Amount of volume occlusion on reverb sounds.
|
F32 mReverbSoundOcclusion; ///< Amount of volume occlusion on reverb sounds.
|
||||||
|
|
||||||
Vector<CustomShaderFeatureData*> mCustomShaderFeatures;
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
String mMapTo; // map Material to this texture name
|
String mMapTo; // map Material to this texture name
|
||||||
|
|
@ -395,9 +388,6 @@ public:
|
||||||
virtual void inspectPostApply();
|
virtual void inspectPostApply();
|
||||||
virtual bool writeField( StringTableEntry fieldname, const char *value );
|
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
|
// ConsoleObject interface
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ bool ProcessedCustomMaterial::init( const FeatureSet &features,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpd->shaderHandles.init( rpd->shader, mCustomMaterial->mCustomShaderFeatures, mCustomMaterial );
|
rpd->shaderHandles.init( rpd->shader, mCustomMaterial );
|
||||||
_initMaterialParameters();
|
_initMaterialParameters();
|
||||||
mDefaultParameters = allocMaterialParameters();
|
mDefaultParameters = allocMaterialParameters();
|
||||||
setMaterialParameters( mDefaultParameters, 0 );
|
setMaterialParameters( mDefaultParameters, 0 );
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,6 @@ public:
|
||||||
|
|
||||||
MaterialFeatureData mFeatureData;
|
MaterialFeatureData mFeatureData;
|
||||||
|
|
||||||
Vector<CustomShaderFeatureData*> mCustomShaderFeatureData;
|
|
||||||
|
|
||||||
bool mGlow;
|
bool mGlow;
|
||||||
|
|
||||||
Material::BlendOp mBlendOp;
|
Material::BlendOp mBlendOp;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
///
|
///
|
||||||
/// ShaderConstHandles
|
/// ShaderConstHandles
|
||||||
///
|
///
|
||||||
void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData*> customFeatureData, CustomMaterial* mat /*=NULL*/)
|
void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/)
|
||||||
{
|
{
|
||||||
mDiffuseColorSC = shader->getShaderConstHandle("$diffuseMaterialColor");
|
mDiffuseColorSC = shader->getShaderConstHandle("$diffuseMaterialColor");
|
||||||
mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat);
|
mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat);
|
||||||
|
|
@ -125,19 +125,6 @@ void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData
|
||||||
|
|
||||||
// Deferred Shading
|
// Deferred Shading
|
||||||
mMatInfoFlagsSC = shader->getShaderConstHandle(ShaderGenVars::matInfoFlags);
|
mMatInfoFlagsSC = shader->getShaderConstHandle(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
|
// Generate shader
|
||||||
GFXShader::setLogging( true, true );
|
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 )
|
if( !rpd.shader )
|
||||||
return false;
|
return false;
|
||||||
rpd.shaderHandles.init( rpd.shader, mMaterial->mCustomShaderFeatures);
|
rpd.shaderHandles.init( rpd.shader );
|
||||||
|
|
||||||
// If a pass glows, we glow
|
// If a pass glows, we glow
|
||||||
if( rpd.mGlow )
|
if( rpd.mGlow )
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public:
|
||||||
};
|
};
|
||||||
Vector<customHandleData> mCustomHandles;
|
Vector<customHandleData> mCustomHandles;
|
||||||
|
|
||||||
void init( GFXShader* shader, Vector<CustomShaderFeatureData*> customFeatureData, CustomMaterial* mat = NULL);
|
void init( GFXShader* shader, CustomMaterial* mat = NULL);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ struct PolyhedronData
|
||||||
/// it defines a *clockwise* orientation for face[ 0 ]. This is important!
|
/// it defines a *clockwise* orientation for face[ 0 ]. This is important!
|
||||||
U32 vertex[ 2 ];
|
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 )
|
Edge( U32 face1, U32 face2, U32 vertex1, U32 vertex2 )
|
||||||
{
|
{
|
||||||
face[ 0 ] = face1;
|
face[ 0 ] = face1;
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ bool ModuleManager::unloadModuleGroup( const char* pModuleGroup )
|
||||||
if ( mEchoInfo )
|
if ( mEchoInfo )
|
||||||
{
|
{
|
||||||
Con::printf( "Module Manager: Unloading group '%s' but could not unload module Id '%s' at version Id '%d'.",
|
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.
|
// Skip.
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -918,7 +918,7 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe *probe, bool writeFiles)
|
||||||
Frustum culler;
|
Frustum culler;
|
||||||
culler.set(false,
|
culler.set(false,
|
||||||
query.fov,
|
query.fov,
|
||||||
(F32)resolution / (F32)resolution,
|
1.0f,
|
||||||
query.nearPlane,
|
query.nearPlane,
|
||||||
query.farPlane,
|
query.farPlane,
|
||||||
query.cameraMatrix);
|
query.cameraMatrix);
|
||||||
|
|
@ -962,6 +962,8 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe *probe, bool writeFiles)
|
||||||
IBLUtilities::GenerateIrradianceMap(renderTarget, cubeRefl.getCubemap(), clientProbe->mIrridianceMap->mCubemap);
|
IBLUtilities::GenerateIrradianceMap(renderTarget, cubeRefl.getCubemap(), clientProbe->mIrridianceMap->mCubemap);
|
||||||
IBLUtilities::GeneratePrefilterMap(renderTarget, cubeRefl.getCubemap(), prefilterMipLevels, clientProbe->mPrefilterMap->mCubemap);
|
IBLUtilities::GeneratePrefilterMap(renderTarget, cubeRefl.getCubemap(), prefilterMipLevels, clientProbe->mPrefilterMap->mCubemap);
|
||||||
|
|
||||||
|
renderTarget->destroySelf();
|
||||||
|
|
||||||
U32 endMSTime = Platform::getRealMilliseconds();
|
U32 endMSTime = Platform::getRealMilliseconds();
|
||||||
F32 diffTime = F32(endMSTime - startMSTime);
|
F32 diffTime = F32(endMSTime - startMSTime);
|
||||||
Con::warnf("RenderProbeMgr::bake() - Finished Capture! Took %g milliseconds", diffTime);
|
Con::warnf("RenderProbeMgr::bake() - Finished Capture! Took %g milliseconds", diffTime);
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
||||||
if (passRI->accuTex != lastAccuTex)
|
if (passRI->accuTex != lastAccuTex)
|
||||||
{
|
{
|
||||||
sgData.accuTex = passRI->accuTex;
|
sgData.accuTex = passRI->accuTex;
|
||||||
lastAccuTex = lastAccuTex;
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ struct WaterFogData
|
||||||
densityOffset = 0.0f;
|
densityOffset = 0.0f;
|
||||||
wetDepth = 0.0f;
|
wetDepth = 0.0f;
|
||||||
wetDarkening = 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
|
plane.set( 0.0f, 0.0f, 1.0f, 1e10 ); // Default to global bounds distance
|
||||||
depthGradMax = 0.0f;
|
depthGradMax = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1704,7 +1704,7 @@ void SceneObject::updateRenderChangesByParent(){
|
||||||
// This is needed by objects that update their own render transform thru interpolate tick
|
// This is needed by objects that update their own render transform thru interpolate tick
|
||||||
// Mostly for stationary objects.
|
// Mostly for stationary objects.
|
||||||
|
|
||||||
if (getClassName() == "Player")
|
if (getClassName() == StringTable->insert("Player"))
|
||||||
mat.mul(offset,getRenderTransform());
|
mat.mul(offset,getRenderTransform());
|
||||||
else
|
else
|
||||||
mat.mul(offset,getTransform());
|
mat.mul(offset,getTransform());
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ SFXSound* SFXSound::_create( SFXDevice* device,
|
||||||
SFXBuffer* buffer = SFX->_createBuffer( stream, description );
|
SFXBuffer* buffer = SFX->_createBuffer( stream, description );
|
||||||
if( !buffer )
|
if( !buffer )
|
||||||
{
|
{
|
||||||
source->deleteObject();
|
SAFE_DELETE_OBJECT(source);
|
||||||
|
|
||||||
Con::errorf( "SFXSound::_create() - Could not create device buffer!" );
|
Con::errorf( "SFXSound::_create() - Could not create device buffer!" );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,8 @@ bool CustomShaderFeatureData::hasFeature(String name)
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
return mFeatureGLSL->hasFeature(name);
|
return mFeatureGLSL->hasFeature(name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
|
void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
|
||||||
|
|
|
||||||
|
|
@ -141,16 +141,13 @@ void ShaderGen::generateShader( const MaterialFeatureData &featureData,
|
||||||
F32 *pixVersion,
|
F32 *pixVersion,
|
||||||
const GFXVertexFormat *vertexFormat,
|
const GFXVertexFormat *vertexFormat,
|
||||||
const char* cacheName,
|
const char* cacheName,
|
||||||
Vector<GFXShaderMacro> ¯os,
|
Vector<GFXShaderMacro> ¯os)
|
||||||
Vector<CustomShaderFeatureData*> &customFeatureData)
|
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( ShaderGen_GenerateShader );
|
PROFILE_SCOPE( ShaderGen_GenerateShader );
|
||||||
|
|
||||||
mFeatureData = featureData;
|
mFeatureData = featureData;
|
||||||
mVertexFormat = vertexFormat;
|
mVertexFormat = vertexFormat;
|
||||||
|
|
||||||
mCustomFeaturesData = customFeatureData;
|
|
||||||
|
|
||||||
_uninit();
|
_uninit();
|
||||||
_init();
|
_init();
|
||||||
|
|
||||||
|
|
@ -290,44 +287,6 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯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<ShaderConnector *>( mComponents[C_CONNECTOR] );
|
ShaderConnector *connect = dynamic_cast<ShaderConnector *>( mComponents[C_CONNECTOR] );
|
||||||
connect->sortVars();
|
connect->sortVars();
|
||||||
}
|
}
|
||||||
|
|
@ -368,44 +327,6 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//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<ShaderConnector *>( mComponents[C_CONNECTOR] );
|
ShaderConnector *connect = dynamic_cast<ShaderConnector *>( mComponents[C_CONNECTOR] );
|
||||||
connect->sortVars();
|
connect->sortVars();
|
||||||
}
|
}
|
||||||
|
|
@ -528,7 +449,7 @@ void ShaderGen::_printPixShader( Stream &stream )
|
||||||
mPrinter->printPixelShaderCloser(stream);
|
mPrinter->printPixelShaderCloser(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, Vector<CustomShaderFeatureData*> &customFeatureData, const GFXVertexFormat *vertexFormat, const Vector<GFXShaderMacro> *macros, const Vector<String> &samplers )
|
GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, const GFXVertexFormat *vertexFormat, const Vector<GFXShaderMacro> *macros, const Vector<String> &samplers )
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( ShaderGen_GetShader );
|
PROFILE_SCOPE( ShaderGen_GetShader );
|
||||||
|
|
||||||
|
|
@ -568,7 +489,7 @@ GFXShader* ShaderGen::getShader( const MaterialFeatureData &featureData, Vector<
|
||||||
shaderMacros.push_back( GFXShaderMacro( "TORQUE_SHADERGEN" ) );
|
shaderMacros.push_back( GFXShaderMacro( "TORQUE_SHADERGEN" ) );
|
||||||
if ( macros )
|
if ( macros )
|
||||||
shaderMacros.merge( *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();
|
GFXShader *shader = GFX->createShader();
|
||||||
if (!shader->init(vertFile, pixFile, pixVersion, shaderMacros, samplers, &mInstancingFormat))
|
if (!shader->init(vertFile, pixFile, pixVersion, shaderMacros, samplers, &mInstancingFormat))
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,6 @@
|
||||||
#include "materials/materialFeatureData.h"
|
#include "materials/materialFeatureData.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CUSTOMSHADERFEATURE_H
|
|
||||||
#include "shadergen/customShaderFeature.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Base class used by shaderGen to be API agnostic. Subclasses implement the various methods
|
/// Base class used by shaderGen to be API agnostic. Subclasses implement the various methods
|
||||||
/// in an API specific way.
|
/// in an API specific way.
|
||||||
class ShaderGenPrinter
|
class ShaderGenPrinter
|
||||||
|
|
@ -155,11 +151,10 @@ public:
|
||||||
F32 *pixVersion,
|
F32 *pixVersion,
|
||||||
const GFXVertexFormat *vertexFormat,
|
const GFXVertexFormat *vertexFormat,
|
||||||
const char* cacheName,
|
const char* cacheName,
|
||||||
Vector<GFXShaderMacro> ¯os,
|
Vector<GFXShaderMacro> ¯os);
|
||||||
Vector<CustomShaderFeatureData*> &customFeatureData);
|
|
||||||
|
|
||||||
// Returns a shader that implements the features listed by dat.
|
// Returns a shader that implements the features listed by dat.
|
||||||
GFXShader* getShader( const MaterialFeatureData &dat, Vector<CustomShaderFeatureData*> &customFeatureData, const GFXVertexFormat *vertexFormat, const Vector<GFXShaderMacro> *macros, const Vector<String> &samplers );
|
GFXShader* getShader( const MaterialFeatureData &dat, const GFXVertexFormat *vertexFormat, const Vector<GFXShaderMacro> *macros, const Vector<String> &samplers );
|
||||||
|
|
||||||
// This will delete all of the procedural shaders that we have. Used to regenerate shaders when
|
// 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)
|
// the ShaderFeatures have changed (due to lighting system change, or new plugin)
|
||||||
|
|
@ -181,8 +176,6 @@ protected:
|
||||||
|
|
||||||
Vector< ShaderComponent *> mComponents;
|
Vector< ShaderComponent *> mComponents;
|
||||||
|
|
||||||
Vector< CustomShaderFeatureData* > mCustomFeaturesData;
|
|
||||||
|
|
||||||
AutoPtr<ShaderGenPrinter> mPrinter;
|
AutoPtr<ShaderGenPrinter> mPrinter;
|
||||||
AutoPtr<ShaderGenComponentFactory> mComponentFactory;
|
AutoPtr<ShaderGenComponentFactory> mComponentFactory;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -863,7 +863,7 @@ public:
|
||||||
void setScopeObject(NetObject *object);
|
void setScopeObject(NetObject *object);
|
||||||
|
|
||||||
/// Get the object around which we are currently scoping network traffic.
|
/// Get the object around which we are currently scoping network traffic.
|
||||||
NetObject* getScopeObject() {};
|
NetObject* getScopeObject() { return nullptr; };
|
||||||
|
|
||||||
/// Add an object to scope.
|
/// Add an object to scope.
|
||||||
void objectInScope(NetObject *object);
|
void objectInScope(NetObject *object);
|
||||||
|
|
|
||||||
|
|
@ -482,8 +482,6 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
||||||
featureData.features = features;
|
featureData.features = features;
|
||||||
featureData.materialFeatures = features;
|
featureData.materialFeatures = features;
|
||||||
|
|
||||||
Vector<CustomShaderFeatureData*> customFeatures;
|
|
||||||
|
|
||||||
// Check to see how many vertex shader output
|
// Check to see how many vertex shader output
|
||||||
// registers we're gonna need.
|
// registers we're gonna need.
|
||||||
U32 numTex = 0;
|
U32 numTex = 0;
|
||||||
|
|
@ -526,7 +524,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
||||||
const bool logErrors = true;// matCount == 1;
|
const bool logErrors = true;// matCount == 1;
|
||||||
GFXShader::setLogging( logErrors, true );
|
GFXShader::setLogging( logErrors, true );
|
||||||
|
|
||||||
pass->shader = SHADERGEN->getShader( featureData, customFeatures, getGFXVertexFormat<TerrVertex>(), NULL, mSamplerNames );
|
pass->shader = SHADERGEN->getShader( featureData, getGFXVertexFormat<TerrVertex>(), NULL, mSamplerNames );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got a shader then we can continue.
|
// If we got a shader then we can continue.
|
||||||
|
|
|
||||||
|
|
@ -770,6 +770,8 @@ static void conditioner_createDefaultClip(domCOLLADA* root)
|
||||||
|
|
||||||
static void conditioner_fixupAnimation(domAnimation* anim)
|
static void conditioner_fixupAnimation(domAnimation* anim)
|
||||||
{
|
{
|
||||||
|
S32 visibilityLen = dStrlen("/visibility");
|
||||||
|
|
||||||
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
|
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
|
||||||
|
|
||||||
// Get the animation elements: <channel>, <sampler>
|
// Get the animation elements: <channel>, <sampler>
|
||||||
|
|
@ -815,7 +817,7 @@ static void conditioner_fixupAnimation(domAnimation* anim)
|
||||||
|
|
||||||
// Get parent SID string
|
// Get parent SID string
|
||||||
char *parentSID = dStrdup(channel->getTarget());
|
char *parentSID = dStrdup(channel->getTarget());
|
||||||
parentSID[dStrlen(parentSID) - dStrlen("/visibility")] = '\0';
|
parentSID[dStrlen(parentSID) - visibilityLen] = '\0';
|
||||||
|
|
||||||
// Find the parent element (should be a <node>)
|
// Find the parent element (should be a <node>)
|
||||||
daeSIDResolver parentResolver(channel, parentSID);
|
daeSIDResolver parentResolver(channel, parentSID);
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
|
||||||
if (objectList.size() == 0)
|
if (objectList.size() == 0)
|
||||||
dumpLine("\r\n");
|
dumpLine("\r\n");
|
||||||
|
|
||||||
|
S32 nodeNameLen = dStrlen(nodeName);
|
||||||
S32 spaceCount = -1;
|
S32 spaceCount = -1;
|
||||||
for (S32 j=0;j<objectList.size(); j++)
|
for (S32 j=0;j<objectList.size(); j++)
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +102,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
|
||||||
|
|
||||||
// how many spaces should we prepend if we have another object on this node
|
// how many spaces should we prepend if we have another object on this node
|
||||||
if (spaceCount<0)
|
if (spaceCount<0)
|
||||||
spaceCount = (S32)(dStrlen(space) + dStrlen(nodeName));
|
spaceCount = (S32)(dStrlen(space) + nodeNameLen);
|
||||||
|
|
||||||
if(spaceCount > 2000)
|
if(spaceCount > 2000)
|
||||||
spaceCount = 2000;
|
spaceCount = 2000;
|
||||||
|
|
|
||||||
|
|
@ -424,6 +424,8 @@ bool TSShapeConstructor::onAdd()
|
||||||
group = new SimGroup();
|
group = new SimGroup();
|
||||||
if ( !group->registerObject("TSShapeConstructorGroup") )
|
if ( !group->registerObject("TSShapeConstructorGroup") )
|
||||||
{
|
{
|
||||||
|
SAFE_DELETE(group);
|
||||||
|
|
||||||
Con::errorf("TSShapeConstructor::onAdd failed: Could not register "
|
Con::errorf("TSShapeConstructor::onAdd failed: Could not register "
|
||||||
"TSShapeConstructorGroup");
|
"TSShapeConstructorGroup");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue