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:
Areloch 2021-07-19 01:07:08 -05:00
parent 83b0432283
commit 5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions

View file

@ -402,26 +402,27 @@ void ProcessedMaterial::_setStageData()
for (i = 0; i < Material::MAX_STAGES; i++)
{
// DiffuseMap
if (mMaterial->mDiffuseMapFilename[i].isNotEmpty())
if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
{
mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->mDiffuseMapFilename[i], &GFXStaticTextureSRGBProfile));
mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMapResource(i));
//mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
if (!mStages[i].getTex(MFT_DiffuseMap))
{
//If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass. So we'll
//pass on the error rather than spamming the console
if (!mMaterial->mDiffuseMapFilename[i].startsWith("#"))
mMaterial->logError("Failed to load diffuse map %s for stage %i", _getTexturePath(mMaterial->mDiffuseMapFilename[i]).c_str(), i);
// Load a debug texture to make it clear to the user
// that the texture for this stage was missing.
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
}
}
else if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
else if (mMaterial->mDiffuseMapName[i] != StringTable->EmptyString())
{
mStages[i].setTex(MFT_DiffuseMap, mMaterial->mDiffuseMapAsset[i]->getImage(GFXStaticTextureSRGBProfile));
mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->mDiffuseMapName[i], &GFXStaticTextureSRGBProfile));
if (!mStages[i].getTex(MFT_DiffuseMap))
{
//If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass. So we'll
//pass on the error rather than spamming the console
if (!String(mMaterial->mDiffuseMapName[i]).startsWith("#"))
mMaterial->logError("Failed to load diffuse map %s for stage %i", _getTexturePath(mMaterial->mDiffuseMapName[i]).c_str(), i);
// Load a debug texture to make it clear to the user
// that the texture for this stage was missing.
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
@ -429,85 +430,86 @@ void ProcessedMaterial::_setStageData()
}
// OverlayMap
if (mMaterial->mOverlayMapFilename[i].isNotEmpty())
if (mMaterial->getOverlayMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_OverlayMap, _createTexture(mMaterial->mOverlayMapFilename[i], &GFXStaticTextureSRGBProfile));
mStages[i].setTex(MFT_OverlayMap, mMaterial->getOverlayMapResource(i));
if (!mStages[i].getTex(MFT_OverlayMap))
mMaterial->logError("Failed to load overlay map %s for stage %i", _getTexturePath(mMaterial->mOverlayMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load overlay map %s for stage %i", mMaterial->getOverlayMap(i), i);
}
// LightMap
if (mMaterial->mLightMapFilename[i].isNotEmpty())
if (mMaterial->getLightMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_LightMap, _createTexture(mMaterial->mLightMapFilename[i], &GFXStaticTextureSRGBProfile));
mStages[i].setTex(MFT_LightMap, mMaterial->getLightMapResource(i));
if (!mStages[i].getTex(MFT_LightMap))
mMaterial->logError("Failed to load light map %s for stage %i", _getTexturePath(mMaterial->mLightMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load light map %s for stage %i", mMaterial->getLightMap(i), i);
}
// ToneMap
if (mMaterial->mToneMapFilename[i].isNotEmpty())
if (mMaterial->getToneMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_ToneMap, _createTexture(mMaterial->mToneMapFilename[i], &GFXStaticTextureProfile));
mStages[i].setTex(MFT_ToneMap, mMaterial->getToneMapResource(i));
if (!mStages[i].getTex(MFT_ToneMap))
mMaterial->logError("Failed to load tone map %s for stage %i", _getTexturePath(mMaterial->mToneMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load tone map %s for stage %i", mMaterial->getToneMap(i), i);
}
// DetailMap
if (mMaterial->mDetailMapFilename[i].isNotEmpty())
if (mMaterial->getDetailMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_DetailMap, _createTexture(mMaterial->mDetailMapFilename[i], &GFXStaticTextureProfile));
mStages[i].setTex(MFT_DetailMap, mMaterial->getDetailMapResource(i));
if (!mStages[i].getTex(MFT_DetailMap))
mMaterial->logError("Failed to load detail map %s for stage %i", _getTexturePath(mMaterial->mDetailMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load detail map %s for stage %i", mMaterial->getDetailMap(i), i);
}
// NormalMap
if (mMaterial->mNormalMapFilename[i].isNotEmpty())
if (mMaterial->getNormalMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_NormalMap, _createTexture(mMaterial->mNormalMapFilename[i], &GFXNormalMapProfile));
mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMapResource(i));
if (!mStages[i].getTex(MFT_NormalMap))
mMaterial->logError("Failed to load normal map %s for stage %i", _getTexturePath(mMaterial->mNormalMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getNormalMap(i), i);
}
// Detail Normal Map
if (mMaterial->mDetailNormalMapFilename[i].isNotEmpty())
if (mMaterial->getDetailNormalMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_DetailNormalMap, _createTexture(mMaterial->mDetailNormalMapFilename[i], &GFXNormalMapProfile));
mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMapResource(i));
if (!mStages[i].getTex(MFT_DetailNormalMap))
mMaterial->logError("Failed to load normal map %s for stage %i", _getTexturePath(mMaterial->mDetailNormalMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getDetailNormalMap(i), i);
}
//depending on creation method this may or may not have been shoved into srgb space eroneously
GFXTextureProfile* profile = &GFXStaticTextureProfile;
if (mMaterial->mIsSRGb[i])
profile = &GFXStaticTextureSRGBProfile;
// ORMConfig
if (mMaterial->mORMConfigMapFilename[i].isNotEmpty())
if (mMaterial->getORMConfigMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_OrmMap, _createTexture(mMaterial->mORMConfigMapFilename[i], profile));
mStages[i].setTex(MFT_OrmMap, _createTexture(mMaterial->getORMConfigMap(i), profile));
if (!mStages[i].getTex(MFT_OrmMap))
mMaterial->logError("Failed to load PBR Config map %s for stage %i", _getTexturePath(mMaterial->mORMConfigMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load PBR Config map %s for stage %i", mMaterial->getORMConfigMap(i), i);
}
else
{
if (mMaterial->mRoughMapFilename[i].isNotEmpty() && mMaterial->mMetalMapFilename[i].isNotEmpty())
if ((mMaterial->getRoughMap(i) != StringTable->EmptyString()) && (mMaterial->getMetalMap(i) != StringTable->EmptyString()))
{
U32 inputKey[4];
inputKey[0] = mMaterial->mAOChan[i];
inputKey[1] = mMaterial->mRoughnessChan[i];
inputKey[2] = mMaterial->mMetalChan[i];
inputKey[3] = 0;
mStages[i].setTex(MFT_OrmMap, _createCompositeTexture( mMaterial->mAOMapFilename[i], mMaterial->mRoughMapFilename[i],
mMaterial->mMetalMapFilename[i], "",
mStages[i].setTex(MFT_OrmMap, _createCompositeTexture( mMaterial->getAOMap(i), mMaterial->getRoughMap(i),
mMaterial->getMetalMap(i), "",
inputKey, profile));
if (!mStages[i].getTex(MFT_OrmMap))
mMaterial->logError("Failed to load PBR Config map %s for stage %i", _getTexturePath(mMaterial->mORMConfigMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i);
}
}
if (mMaterial->mGlowMapFilename[i].isNotEmpty())
if (mMaterial->getGlowMap(i) != StringTable->EmptyString())
{
mStages[i].setTex(MFT_GlowMap, _createTexture(mMaterial->mGlowMapFilename[i], &GFXStaticTextureProfile));
mStages[i].setTex(MFT_GlowMap, mMaterial->getGlowMapResource(i));
if (!mStages[i].getTex(MFT_GlowMap))
mMaterial->logError("Failed to load glow map %s for stage %i", _getTexturePath(mMaterial->mGlowMapFilename[i]).c_str(), i);
mMaterial->logError("Failed to load glow map %s for stage %i", mMaterial->getGlowMap(i), i);
}
}