mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
Updates macromagic to properly set up for init'ing when image assets are set in material and terrain materials
This commit is contained in:
parent
8e4edc3545
commit
f0068c2435
6 changed files with 569 additions and 8 deletions
|
|
@ -115,6 +115,101 @@ void TerrainMaterial::initPersistFields()
|
|||
Sim::getTerrainMaterialSet();
|
||||
}
|
||||
|
||||
bool TerrainMaterial::_setDiffuseMapAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainMaterial* mat = static_cast<TerrainMaterial*>(obj);
|
||||
|
||||
mat->mDiffuseMapAssetId = StringTable->insert(data);
|
||||
|
||||
if (ImageAsset::getAssetById(mat->mDiffuseMapAssetId, &mat->mDiffuseMapAsset))
|
||||
{
|
||||
if (mat->mDiffuseMapAsset.getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
||||
{
|
||||
mat->mDiffuseMapFilename = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainMaterial::_setNormalMapAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainMaterial* mat = static_cast<TerrainMaterial*>(obj);
|
||||
|
||||
mat->mNormalMapAssetId = StringTable->insert(data);
|
||||
|
||||
if (ImageAsset::getAssetById(mat->mNormalMapAssetId, &mat->mNormalMapAsset))
|
||||
{
|
||||
if (mat->mNormalMapAsset.getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
||||
{
|
||||
mat->mNormalMapFilename = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainMaterial::_setDetailMapAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainMaterial* mat = static_cast<TerrainMaterial*>(obj);
|
||||
|
||||
mat->mDetailMapAssetId = StringTable->insert(data);
|
||||
|
||||
if (ImageAsset::getAssetById(mat->mDetailMapAssetId, &mat->mDetailMapAsset))
|
||||
{
|
||||
if (mat->mDetailMapAsset.getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
||||
{
|
||||
mat->mDetailMapFilename = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainMaterial::_setORMConfigMapAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainMaterial* mat = static_cast<TerrainMaterial*>(obj);
|
||||
|
||||
mat->mORMConfigMapAssetId = StringTable->insert(data);
|
||||
|
||||
if (ImageAsset::getAssetById(mat->mORMConfigMapAssetId, &mat->mORMConfigMapAsset))
|
||||
{
|
||||
if (mat->mORMConfigMapAsset.getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
||||
{
|
||||
mat->mORMConfigMapFilename = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainMaterial::_setMacroMapAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainMaterial* mat = static_cast<TerrainMaterial*>(obj);
|
||||
|
||||
mat->mMacroMapAssetId = StringTable->insert(data);
|
||||
|
||||
if (ImageAsset::getAssetById(mat->mMacroMapAssetId, &mat->mMacroMapAsset))
|
||||
{
|
||||
if (mat->mMacroMapAsset.getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
||||
{
|
||||
mat->mMacroMapFilename = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainMaterial::onAdd()
|
||||
{
|
||||
if ( !Parent::onAdd() )
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ public:
|
|||
bool onAdd();
|
||||
static void initPersistFields();
|
||||
|
||||
static bool _setDiffuseMapAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setNormalMapAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setDetailMapAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setORMConfigMapAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setMacroMapAsset(void* obj, const char* index, const char* data);
|
||||
|
||||
DECLARE_CONOBJECT( TerrainMaterial );
|
||||
|
||||
/// This method locates the TerrainMaterial if it exists, tries
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue