mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-27 18:43:48 +00:00
Converts all game, gui editor, and system classes to utilize assets
Processed core, tools and default modules to utilize assets Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption Removed unneeded MainEditor mockup module Removed some unused/duplicate image assets from the tools
This commit is contained in:
parent
83b0432283
commit
5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions
|
|
@ -170,14 +170,14 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
|||
{
|
||||
torquePath = texName.C_Str();
|
||||
if (!torquePath.isEmpty())
|
||||
mat->mDiffuseMapFilename[0] = cleanTextureName(torquePath, cleanFile, path, false);
|
||||
mat->mDiffuseMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
|
||||
}
|
||||
|
||||
if (AI_SUCCESS == mAIMat->Get(AI_MATKEY_TEXTURE(aiTextureType_NORMALS, 0), texName))
|
||||
{
|
||||
torquePath = texName.C_Str();
|
||||
if (!torquePath.isEmpty())
|
||||
mat->mNormalMapFilename[0] = cleanTextureName(torquePath, cleanFile, path, false);
|
||||
mat->mNormalMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
|
||||
}
|
||||
|
||||
#ifdef TORQUE_PBR_MATERIALS
|
||||
|
|
@ -194,20 +194,20 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
|||
{ // If we have either map, fill all three slots
|
||||
if (rmName.isNotEmpty())
|
||||
{
|
||||
mat->mRoughMapFilename[0] = cleanTextureName(rmName, cleanFile, path, false); // Roughness
|
||||
mat->mRoughMapName[0] = cleanTextureName(rmName, cleanFile, path, false); // Roughness
|
||||
mat->mRoughnessChan[0] = 1.0f;
|
||||
mat->mInvertRoughness[0] = (floatVal == 1.0f);
|
||||
mat->mMetalMapFilename[0] = cleanTextureName(rmName, cleanFile, path, false); // Metallic
|
||||
mat->mMetalMapName[0] = cleanTextureName(rmName, cleanFile, path, false); // Metallic
|
||||
mat->mMetalChan[0] = 2.0f;
|
||||
}
|
||||
if (aoName.isNotEmpty())
|
||||
{
|
||||
mat->mAOMapFilename[0] = cleanTextureName(aoName, cleanFile, path, false); // occlusion
|
||||
mat->mAOMapName[0] = cleanTextureName(aoName, cleanFile, path, false); // occlusion
|
||||
mat->mAOChan[0] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
mat->mAOMapFilename[0] = cleanTextureName(rmName, cleanFile, path, false); // occlusion
|
||||
mat->mAOMapName[0] = cleanTextureName(rmName, cleanFile, path, false); // occlusion
|
||||
mat->mAOChan[0] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,8 +208,8 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const
|
|||
Material *newMat = MATMGR->allocateAndRegister( cleanName, getName() );
|
||||
Con::setVariable("$Con::File", oldScriptFile); // restore script path
|
||||
|
||||
newMat->mDiffuseMapFilename[0] = diffuseMap;
|
||||
newMat->mNormalMapFilename[0] = normalMap;
|
||||
newMat->mDiffuseMapName[0] = diffuseMap;
|
||||
newMat->mNormalMapName[0] = normalMap;
|
||||
|
||||
newMat->mDiffuse[0] = diffuseColor;
|
||||
newMat->mRoughness[0] = roughness;
|
||||
|
|
|
|||
|
|
@ -497,8 +497,13 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
|
|||
{
|
||||
Material *mat = dynamic_cast<Material*>( persistMgr.getDirtyList()[iMat].getObject() );
|
||||
|
||||
copySketchupTexture(path, mat->mDiffuseMapFilename[0]);
|
||||
copySketchupTexture(path, mat->mNormalMapFilename[0]);
|
||||
String difMapName;
|
||||
copySketchupTexture(path, difMapName);
|
||||
mat->mDiffuseMapName[0] = difMapName;
|
||||
|
||||
String normMapName;
|
||||
copySketchupTexture(path, normMapName);
|
||||
mat->mNormalMapName[0] = normMapName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1026,8 +1026,8 @@ void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const Optimize
|
|||
{
|
||||
Torque::Path diffusePath;
|
||||
|
||||
if (mat->mDiffuseMapFilename[0].isNotEmpty())
|
||||
diffusePath = mat->mDiffuseMapFilename[0];
|
||||
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
|
||||
diffusePath = mat->mDiffuseMapName[0];
|
||||
else
|
||||
diffusePath = String("warningMat");
|
||||
|
||||
|
|
@ -1036,8 +1036,8 @@ void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const Optimize
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mat->mDiffuseMapFilename[0].isNotEmpty())
|
||||
diffuseMap += mat->mDiffuseMapFilename[0];
|
||||
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
|
||||
diffuseMap += mat->mDiffuseMapName[0];
|
||||
else
|
||||
diffuseMap += "warningMat";
|
||||
}
|
||||
|
|
@ -1310,8 +1310,8 @@ void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const ExportDa
|
|||
{
|
||||
Torque::Path diffusePath;
|
||||
|
||||
if (mat->mDiffuseMapFilename[0].isNotEmpty())
|
||||
diffusePath = mat->mDiffuseMapFilename[0];
|
||||
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
|
||||
diffusePath = mat->mDiffuseMapName[0];
|
||||
else
|
||||
diffusePath = String("warningMat");
|
||||
|
||||
|
|
@ -1320,8 +1320,8 @@ void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const ExportDa
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mat->mDiffuseMapFilename[0].isNotEmpty())
|
||||
diffuseMap += mat->mDiffuseMapFilename[0];
|
||||
if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
|
||||
diffuseMap += mat->mDiffuseMapName[0];
|
||||
else
|
||||
diffuseMap += "warningMat";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,8 +218,8 @@ void TSLastDetail::update( bool forceUpdate )
|
|||
// Setup the material for this imposter.
|
||||
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
|
||||
mMaterial->mAutoGenerated = true;
|
||||
mMaterial->mDiffuseMapFilename[0] = diffuseMapPath;
|
||||
mMaterial->mNormalMapFilename[0] = _getNormalMapPath();
|
||||
mMaterial->mDiffuseMapName[0] = diffuseMapPath;
|
||||
mMaterial->mNormalMapName[0] = _getNormalMapPath();
|
||||
mMaterial->mImposterLimits.set( (mNumPolarSteps * 2) + 1, mNumEquatorSteps, mPolarAngle, mIncludePoles );
|
||||
mMaterial->mTranslucent = true;
|
||||
mMaterial->mTranslucentBlendOp = Material::None;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static void SplitSequencePathAndName( String& srcPath, String& srcName )
|
|||
IMPLEMENT_CONOBJECT(TSShapeConstructor);
|
||||
|
||||
TSShapeConstructor::TSShapeConstructor()
|
||||
: mShapePath(""), mLoadingShape(false)
|
||||
: mShapePath(StringTable->EmptyString()), mLoadingShape(false)
|
||||
{
|
||||
mOptions.upAxis = UPAXISTYPE_COUNT;
|
||||
mOptions.unit = -1.0f;
|
||||
|
|
@ -186,7 +186,7 @@ bool TSShapeConstructor::addSequenceFromField( void *obj, const char *index, con
|
|||
TSShapeConstructor *pObj = static_cast<TSShapeConstructor*>( obj );
|
||||
|
||||
if ( data && data[0] )
|
||||
pObj->mSequences.push_back( FileName(data) );
|
||||
pObj->mSequences.push_back( StringTable->insert(data) );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -408,11 +408,12 @@ bool TSShapeConstructor::onAdd()
|
|||
return false;
|
||||
|
||||
// Prevent multiple objects pointing at the same shape file
|
||||
TSShapeConstructor* tss = findShapeConstructor( mShapePath );
|
||||
FileName path = mShapePath;
|
||||
TSShapeConstructor* tss = findShapeConstructor( path );
|
||||
if ( tss )
|
||||
{
|
||||
Con::errorf("TSShapeConstructor::onAdd failed: %s is already referenced by "
|
||||
"another TSShapeConstructor object (%s - %d)", mShapePath.c_str(),
|
||||
"another TSShapeConstructor object (%s - %d)", mShapePath,
|
||||
tss->getName(), tss->getId());
|
||||
return false;
|
||||
}
|
||||
|
|
@ -481,7 +482,7 @@ void TSShapeConstructor::_onLoad(TSShape* shape)
|
|||
_onUnload();
|
||||
|
||||
#ifdef DEBUG_SPEW
|
||||
Con::printf( "[TSShapeConstructor] attaching to shape '%s'", mShapePath.c_str() );
|
||||
Con::printf( "[TSShapeConstructor] attaching to shape '%s'", mShapePath );
|
||||
#endif
|
||||
|
||||
mShape = shape;
|
||||
|
|
@ -491,7 +492,7 @@ void TSShapeConstructor::_onLoad(TSShape* shape)
|
|||
// Add sequences defined using field syntax
|
||||
for ( S32 i = 0; i < mSequences.size(); i++ )
|
||||
{
|
||||
if ( mSequences[i].isEmpty() )
|
||||
if ( mSequences[i] == StringTable->EmptyString())
|
||||
continue;
|
||||
|
||||
// Split the sequence path from the target sequence name
|
||||
|
|
@ -512,7 +513,7 @@ void TSShapeConstructor::_onLoad(TSShape* shape)
|
|||
void TSShapeConstructor::_onUnload()
|
||||
{
|
||||
#ifdef DEBUG_SPEW
|
||||
Con::printf( "[TSShapeConstructor] detaching from '%s'", mShapePath.c_str() );
|
||||
Con::printf( "[TSShapeConstructor] detaching from '%s'", mShapePath );
|
||||
#endif
|
||||
|
||||
onUnload_callback();
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ public:
|
|||
static const S32 MaxLegacySequences = 127;
|
||||
|
||||
protected:
|
||||
FileName mShapePath;
|
||||
Vector<FileName> mSequences;
|
||||
StringTableEntry mShapePath;
|
||||
Vector<StringTableEntry> mSequences;
|
||||
ChangeSet mChangeSet;
|
||||
|
||||
// Paths to shapes used by MeshFit
|
||||
|
|
@ -196,7 +196,7 @@ public:
|
|||
public:
|
||||
|
||||
TSShapeConstructor();
|
||||
TSShapeConstructor(const String& path) : mShapePath(path), mShape(NULL), mLoadingShape(false){ }
|
||||
TSShapeConstructor(StringTableEntry path) : mShapePath(path), mShape(NULL), mLoadingShape(false){ }
|
||||
~TSShapeConstructor();
|
||||
|
||||
DECLARE_CONOBJECT(TSShapeConstructor);
|
||||
|
|
@ -222,7 +222,7 @@ public:
|
|||
///@}
|
||||
|
||||
TSShape* getShape() const { return mShape; }
|
||||
const String& getShapePath() const { return mShapePath; }
|
||||
StringTableEntry getShapePath() const { return mShapePath; }
|
||||
|
||||
/// @name Dumping
|
||||
///@{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue