|
@@ -121,7 +121,7 @@ Material::Material()
|
|
|
mRoughness[i] = 1.0f;
|
|
|
mMetalness[i] = 0.0f;
|
|
|
|
|
|
- mIsSRGb[i] = true;
|
|
|
+ mIsSRGb[i] = false;
|
|
|
mInvertRoughness[i] = false;
|
|
|
|
|
|
mRoughnessChan[i] = 0;
|
|
@@ -502,282 +502,6 @@ void Material::initPersistFields()
|
|
|
Parent::initPersistFields();
|
|
|
}
|
|
|
|
|
|
-bool Material::_setDiffuseMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mDiffuseMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mDiffuseMapAssetId[idx], &mat->mDiffuseMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mDiffuseMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mDiffuseMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setOverlayMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mOverlayMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mOverlayMapAssetId[idx], &mat->mOverlayMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mOverlayMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mOverlayMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setLightMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mLightMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mLightMapAssetId[idx], &mat->mLightMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mLightMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mLightMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setToneMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mToneMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mToneMapAssetId[idx], &mat->mToneMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mToneMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mToneMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setDetailMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mDetailMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mDetailMapAssetId[idx], &mat->mDetailMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mDetailMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mDetailMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setNormalMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mNormalMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mNormalMapAssetId[idx], &mat->mNormalMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mNormalMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mNormalMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setORMConfigMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mORMConfigMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mORMConfigMapAssetId[idx], &mat->mORMConfigMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mORMConfigMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mORMConfigMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setRoughMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mRoughMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mRoughMapAssetId[idx], &mat->mRoughMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mRoughMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mRoughMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setAOMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mAOMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mAOMapAssetId[idx], &mat->mAOMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mAOMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mAOMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setMetalMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mMetalMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mMetalMapAssetId[idx], &mat->mMetalMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mMetalMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mMetalMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setGlowMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mGlowMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mGlowMapAssetId[idx], &mat->mGlowMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mGlowMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mGlowMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-bool Material::_setDetailNormalMapAsset(void* obj, const char* index, const char* data)
|
|
|
-{
|
|
|
- Material* mat = static_cast<Material*>(obj);
|
|
|
-
|
|
|
- U32 idx = dAtoi(index);
|
|
|
- if (idx >= MAX_STAGES)
|
|
|
- return false;
|
|
|
-
|
|
|
- mat->mDetailNormalMapAssetId[idx] = StringTable->insert(data);
|
|
|
-
|
|
|
- if (ImageAsset::getAssetById(mat->mDetailNormalMapAssetId[idx], &mat->mDetailNormalMapAsset[idx]))
|
|
|
- {
|
|
|
- if (mat->mDetailNormalMapAsset[idx].getAssetId() != StringTable->insert("Core_Rendering:noMaterial"))
|
|
|
- {
|
|
|
- mat->mDetailNormalMapFilename[idx] = StringTable->EmptyString();
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
bool Material::writeField( StringTableEntry fieldname, const char *value )
|
|
|
{
|
|
|
// Never allow the old field names to be written.
|