mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Updates ImageAsset usage to utilize AssetRef, and standardizes the setter/getter functions and naming conventions, as well as the ability to use and bind named targets.
This commit is contained in:
parent
a858d8624e
commit
34e3f78a22
82 changed files with 1451 additions and 951 deletions
|
|
@ -251,7 +251,9 @@ void Material::initPersistFields()
|
|||
addArray("Stages", MAX_STAGES);
|
||||
|
||||
addGroup("Basic Texture Maps");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(DiffuseMap, MAX_STAGES, Material, "Albedo");
|
||||
ADD_FIELD("diffuseMapAsset", TypeImageAssetRef, Offset(mDiffuseMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief Albedo.");
|
||||
addField("diffuseColor", TypeColorF, Offset(mDiffuse, Material), MAX_STAGES,
|
||||
"This color is multiplied against the diffuse texture color. If no diffuse texture "
|
||||
"is present this is the material color.");
|
||||
|
|
@ -260,7 +262,9 @@ void Material::initPersistFields()
|
|||
addField("TileScale", TypePoint2F, Offset(mTileScale, Material), MAX_STAGES,
|
||||
"The scale factor for the detail map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(NormalMap, MAX_STAGES, Material, "NormalMap");
|
||||
ADD_FIELD("normalMapAsset", TypeImageAssetRef, Offset(mNormalMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief NormalMap.");
|
||||
endGroup("Basic Texture Maps");
|
||||
|
||||
addGroup("Light Influence Maps");
|
||||
|
|
@ -270,43 +274,63 @@ void Material::initPersistFields()
|
|||
addFieldV("metalness", TypeRangedF32, Offset(mMetalness, Material), &CommonValidators::F32_8BitPercent, MAX_STAGES,
|
||||
"The degree of Metalness when not using a ORMConfigMap.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(ORMConfigMap, MAX_STAGES, Material, "AO|Roughness|metalness map");
|
||||
ADD_FIELD("ORMConfigMapAsset", TypeImageAssetRef, Offset(mORMConfigMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief AO|Roughness|metalness map.");
|
||||
addField("isSRGb", TypeBool, Offset(mIsSRGb, Material), MAX_STAGES,
|
||||
"Substance Designer Workaround.");
|
||||
addField("invertRoughness", TypeBool, Offset(mInvertRoughness, Material), MAX_STAGES,
|
||||
"Treat Roughness as Roughness");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(AOMap, MAX_STAGES, Material, "AOMap");
|
||||
ADD_FIELD("AOMapAsset", TypeImageAssetRef, Offset(mAOMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief AOMap.");
|
||||
addField("AOChan", TYPEID< SourceChannelType >(), Offset(mAOChan, Material), MAX_STAGES,
|
||||
"The input channel AO maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(RoughMap, MAX_STAGES, Material, "RoughMap (also needs MetalMap)");
|
||||
ADD_FIELD("roughMapAsset", TypeImageAssetRef, Offset(mRoughMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief RoughMap (also needs MetalMap).");
|
||||
addField("roughnessChan", TYPEID< SourceChannelType >(), Offset(mRoughnessChan, Material), MAX_STAGES,
|
||||
"The input channel roughness maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(MetalMap, MAX_STAGES, Material, "MetalMap (also needs RoughMap)");
|
||||
ADD_FIELD("metalMapAsset", TypeImageAssetRef, Offset(mMetalMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief MetalMap (also needs RoughMap).");
|
||||
addField("metalChan", TYPEID< SourceChannelType >(), Offset(mMetalChan, Material), MAX_STAGES,
|
||||
"The input channel metalness maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(GlowMap, MAX_STAGES, Material, "GlowMap (needs Albedo)");
|
||||
ADD_FIELD("glowMapAsset", TypeImageAssetRef, Offset(mGlowMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief GlowMap (needs Albedo).");
|
||||
|
||||
addFieldV("glowMul", TypeRangedF32, Offset(mGlowMul, Material),&glowMulRange, MAX_STAGES,
|
||||
"glow mask multiplier");
|
||||
endGroup("Light Influence Maps");
|
||||
|
||||
addGroup("Advanced Texture Maps");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(DetailMap, MAX_STAGES, Material, "DetailMap");
|
||||
ADD_FIELD("detailMapAsset", TypeImageAssetRef, Offset(mDetailMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief DetailMap.");
|
||||
addField("detailScale", TypePoint2F, Offset(mDetailScale, Material), MAX_STAGES,
|
||||
"The scale factor for the detail map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap");
|
||||
ADD_FIELD("detailNormalMapAsset", TypeImageAssetRef, Offset(mDetailNormalMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief DetailNormalMap.");
|
||||
addFieldV("detailNormalMapStrength", TypeRangedF32, Offset(mDetailNormalMapStrength, Material), &CommonValidators::PositiveFloat, MAX_STAGES,
|
||||
|
||||
"Used to scale the strength of the detail normal map when blended with the base normal map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(OverlayMap, MAX_STAGES, Material, "Overlay");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(LightMap, MAX_STAGES, Material, "LightMap");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(ToneMap, MAX_STAGES, Material, "ToneMap");
|
||||
ADD_FIELD("overlayMapAsset", TypeImageAssetRef, Offset(mOverlayMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief Overlay.");
|
||||
ADD_FIELD("lightMapAsset", TypeImageAssetRef, Offset(mLightMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief LightMap.");
|
||||
ADD_FIELD("toneMapAsset", TypeImageAssetRef, Offset(mToneMapAssetRef, Material))
|
||||
.elements(MAX_STAGES)
|
||||
.doc("@brief ToneMap.");
|
||||
endGroup("Advanced Texture Maps");
|
||||
|
||||
addGroup("Accumulation Properties");
|
||||
|
|
@ -609,7 +633,7 @@ bool Material::isLightmapped() const
|
|||
{
|
||||
bool ret = false;
|
||||
for (U32 i = 0; i < MAX_STAGES; i++)
|
||||
ret |= mLightMapAsset[i].notNull() || mToneMapAsset[i].notNull() || mVertLit[i];
|
||||
ret |= mLightMapAssetRef[i].notNull() || mToneMapAssetRef[i].notNull() || mVertLit[i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -642,11 +666,11 @@ void Material::_mapMaterial()
|
|||
// If mapTo not defined in script, try to use the base texture name instead
|
||||
if (mMapTo.isEmpty())
|
||||
{
|
||||
if (mDiffuseMapAsset->isNull())
|
||||
if (mDiffuseMapAssetRef[0].isNull())
|
||||
return;
|
||||
else if (mDiffuseMapAsset->notNull())
|
||||
else if (mDiffuseMapAssetRef[0].notNull())
|
||||
{
|
||||
mMapTo = mDiffuseMapAsset[0]->getImageFile();
|
||||
mMapTo = mDiffuseMapAssetRef[0].assetPtr->getImageFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -815,21 +839,140 @@ bool Material::_setAccuEnabled(void* object, const char* index, const char* data
|
|||
}
|
||||
return true;
|
||||
}
|
||||
//declare general get<entry>, get<entry>Asset and set<entry> methods
|
||||
//declare general get<entry>Asset and set<entry> methods
|
||||
//signatures are:
|
||||
//using DiffuseMap as an example
|
||||
//material.getDiffuseMap(%layer); //returns the raw file referenced
|
||||
//material.getDiffuseMapAsset(%layer); //returns the asset id
|
||||
//material.setDiffuseMap(%texture, %layer); //tries to set the asset and failing that attempts a flat file reference
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, DiffuseMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, NormalMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, DetailNormalMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, OverlayMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, LightMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, ToneMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, DetailMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, ORMConfigMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, RoughMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, AOMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, MetalMap, Material::Constants::MAX_STAGES)
|
||||
DEF_IMAGEASSET_ARRAY_BINDS(Material, GlowMap, Material::Constants::MAX_STAGES)
|
||||
//material.getDiffuseMapAsset(%layer); //returns the assigned assetId (also covers raw file paths and #renderTarget names)
|
||||
//material.setDiffuseMap(%assetId, %layer); //assigns an ImageAsset id
|
||||
|
||||
DefineEngineMethod(Material, getDiffuseMapAsset, const char*, (S32 index), , "Get the DiffuseMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getDiffuseMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setDiffuseMap, void, (const char* assetId, S32 index), , "Set the DiffuseMap asset id for the given stage.")
|
||||
{
|
||||
object->setDiffuseMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getNormalMapAsset, const char*, (S32 index), , "Get the NormalMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getNormalMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setNormalMap, void, (const char* assetId, S32 index), , "Set the NormalMap asset id for the given stage.")
|
||||
{
|
||||
object->setNormalMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getDetailNormalMapAsset, const char*, (S32 index), , "Get the DetailNormalMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getDetailNormalMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setDetailNormalMap, void, (const char* assetId, S32 index), , "Set the DetailNormalMap asset id for the given stage.")
|
||||
{
|
||||
object->setDetailNormalMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getOverlayMapAsset, const char*, (S32 index), , "Get the OverlayMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getOverlayMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setOverlayMap, void, (const char* assetId, S32 index), , "Set the OverlayMap asset id for the given stage.")
|
||||
{
|
||||
object->setOverlayMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getLightMapAsset, const char*, (S32 index), , "Get the LightMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getLightMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setLightMap, void, (const char* assetId, S32 index), , "Set the LightMap asset id for the given stage.")
|
||||
{
|
||||
object->setLightMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getToneMapAsset, const char*, (S32 index), , "Get the ToneMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getToneMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setToneMap, void, (const char* assetId, S32 index), , "Set the ToneMap asset id for the given stage.")
|
||||
{
|
||||
object->setToneMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getDetailMapAsset, const char*, (S32 index), , "Get the DetailMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getDetailMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setDetailMap, void, (const char* assetId, S32 index), , "Set the DetailMap asset id for the given stage.")
|
||||
{
|
||||
object->setDetailMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getORMConfigMapAsset, const char*, (S32 index), , "Get the ORMConfigMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getORMConfigMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setORMConfigMap, void, (const char* assetId, S32 index), , "Set the ORMConfigMap asset id for the given stage.")
|
||||
{
|
||||
object->setORMConfigMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getRoughMapAsset, const char*, (S32 index), , "Get the RoughMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getRoughMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setRoughMap, void, (const char* assetId, S32 index), , "Set the RoughMap asset id for the given stage.")
|
||||
{
|
||||
object->setRoughMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getAOMapAsset, const char*, (S32 index), , "Get the AOMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getAOMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setAOMap, void, (const char* assetId, S32 index), , "Set the AOMap asset id for the given stage.")
|
||||
{
|
||||
object->setAOMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getMetalMapAsset, const char*, (S32 index), , "Get the MetalMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getMetalMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setMetalMap, void, (const char* assetId, S32 index), , "Set the MetalMap asset id for the given stage.")
|
||||
{
|
||||
object->setMetalMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Material, getGlowMapAsset, const char*, (S32 index), , "Get the GlowMap asset id for the given stage.")
|
||||
{
|
||||
if (index >= Material::Constants::MAX_STAGES || index < 0)
|
||||
return "";
|
||||
return object->getGlowMapAssetId(index);
|
||||
}
|
||||
DefineEngineMethod(Material, setGlowMap, void, (const char* assetId, S32 index), , "Set the GlowMap asset id for the given stage.")
|
||||
{
|
||||
object->setGlowMap(StringTable->insert(assetId), index);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,18 +216,70 @@ public:
|
|||
//-----------------------------------------------------------------------
|
||||
// Data
|
||||
//-----------------------------------------------------------------------
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, GFXStaticTextureSRGBProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, GFXNormalMapProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, GFXNormalMapProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, GFXStaticTextureProfile, MAX_STAGES)
|
||||
AssetRef<ImageAsset> mDiffuseMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getDiffuseMapAssetId(const U32& index) const { return mDiffuseMapAssetRef[index].assetId; }
|
||||
void setDiffuseMap(StringTableEntry assetId, const U32& index) { mDiffuseMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getDiffuseMap(const U32& index) { return mDiffuseMapAssetRef[index].notNull() ? mDiffuseMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : GFXTexHandle(); }
|
||||
AssetPtr<ImageAsset> getDiffuseMapAsset(const U32& index) { return mDiffuseMapAssetRef[index].assetPtr; }
|
||||
|
||||
AssetRef<ImageAsset> mNormalMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getNormalMapAssetId(const U32& index) const { return mNormalMapAssetRef[index].assetId; }
|
||||
void setNormalMap(StringTableEntry assetId, const U32& index) { mNormalMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getNormalMap(const U32& index) { return mNormalMapAssetRef[index].notNull() ? mNormalMapAssetRef[index].assetPtr->getTexture(&GFXNormalMapProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mDetailNormalMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getDetailNormalMapAssetId(const U32& index) const { return mDetailNormalMapAssetRef[index].assetId; }
|
||||
void setDetailNormalMap(StringTableEntry assetId, const U32& index) { mDetailNormalMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getDetailNormalMap(const U32& index) { return mDetailNormalMapAssetRef[index].notNull() ? mDetailNormalMapAssetRef[index].assetPtr->getTexture(&GFXNormalMapProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mOverlayMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getOverlayMapAssetId(const U32& index) const { return mOverlayMapAssetRef[index].assetId; }
|
||||
void setOverlayMap(StringTableEntry assetId, const U32& index) { mOverlayMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getOverlayMap(const U32& index) { return mOverlayMapAssetRef[index].notNull() ? mOverlayMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mLightMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getLightMapAssetId(const U32& index) const { return mLightMapAssetRef[index].assetId; }
|
||||
void setLightMap(StringTableEntry assetId, const U32& index) { mLightMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getLightMap(const U32& index) { return mLightMapAssetRef[index].notNull() ? mLightMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mToneMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getToneMapAssetId(const U32& index) const { return mToneMapAssetRef[index].assetId; }
|
||||
void setToneMap(StringTableEntry assetId, const U32& index) { mToneMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getToneMap(const U32& index) { return mToneMapAssetRef[index].notNull() ? mToneMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mDetailMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getDetailMapAssetId(const U32& index) const { return mDetailMapAssetRef[index].assetId; }
|
||||
void setDetailMap(StringTableEntry assetId, const U32& index) { mDetailMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getDetailMap(const U32& index) { return mDetailMapAssetRef[index].notNull() ? mDetailMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mORMConfigMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getORMConfigMapAssetId(const U32& index) const { return mORMConfigMapAssetRef[index].assetId; }
|
||||
void setORMConfigMap(StringTableEntry assetId, const U32& index) { mORMConfigMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getORMConfigMap(const U32& index) { return getORMConfigMap(&GFXStaticTextureProfile, index); }
|
||||
GFXTexHandle getORMConfigMap(GFXTextureProfile* requestedProfile, const U32& index) { return mORMConfigMapAssetRef[index].notNull() ? mORMConfigMapAssetRef[index].assetPtr->getTexture(requestedProfile) : GFXTexHandle(); }
|
||||
|
||||
AssetRef<ImageAsset> mAOMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getAOMapAssetId(const U32& index) const { return mAOMapAssetRef[index].assetId; }
|
||||
void setAOMap(StringTableEntry assetId, const U32& index) { mAOMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getAOMap(const U32& index) { return mAOMapAssetRef[index].notNull() ? mAOMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
StringTableEntry getAOMapFile(const U32& index) { return mAOMapAssetRef[index].notNull() ? mAOMapAssetRef[index].assetPtr->getImageFile() : StringTable->EmptyString(); }
|
||||
|
||||
AssetRef<ImageAsset> mRoughMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getRoughMapAssetId(const U32& index) const { return mRoughMapAssetRef[index].assetId; }
|
||||
void setRoughMap(StringTableEntry assetId, const U32& index) { mRoughMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getRoughMap(const U32& index) { return mRoughMapAssetRef[index].notNull() ? mRoughMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
StringTableEntry getRoughMapFile(const U32& index) { return mRoughMapAssetRef[index].notNull() ? mRoughMapAssetRef[index].assetPtr->getImageFile() : StringTable->EmptyString(); }
|
||||
|
||||
AssetRef<ImageAsset> mMetalMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getMetalMapAssetId(const U32& index) const { return mMetalMapAssetRef[index].assetId; }
|
||||
void setMetalMap(StringTableEntry assetId, const U32& index) { mMetalMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getMetalMap(const U32& index) { return mMetalMapAssetRef[index].notNull() ? mMetalMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
StringTableEntry getMetalMapFile(const U32& index) { return mMetalMapAssetRef[index].notNull() ? mMetalMapAssetRef[index].assetPtr->getImageFile() : StringTable->EmptyString(); }
|
||||
|
||||
AssetRef<ImageAsset> mGlowMapAssetRef[MAX_STAGES];
|
||||
inline StringTableEntry getGlowMapAssetId(const U32& index) const { return mGlowMapAssetRef[index].assetId; }
|
||||
void setGlowMap(StringTableEntry assetId, const U32& index) { mGlowMapAssetRef[index] = assetId; }
|
||||
GFXTexHandle getGlowMap(const U32& index) { return mGlowMapAssetRef[index].notNull() ? mGlowMapAssetRef[index].assetPtr->getTexture(&GFXStaticTextureProfile) : GFXTexHandle(); }
|
||||
|
||||
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
||||
bool mIsSRGb[MAX_STAGES]; // SRGB ORM
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ void MaterialList::mapMaterial( U32 i )
|
|||
newMat->mAutoGenerated = true;
|
||||
|
||||
// Overwrite diffuseMap in new material
|
||||
newMat->_setDiffuseMap(texHandle->mTextureLookupName,0);
|
||||
newMat->setDiffuseMap(texHandle->mTextureLookupName,0);
|
||||
|
||||
// Set up some defaults for transparent textures
|
||||
if (texHandle->mHasTransparency)
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_OverlayMap, mMaterial->getOverlayMap(i));
|
||||
if (!mStages[i].getTex(MFT_OverlayMap))
|
||||
mMaterial->logError("Failed to load overlay map %s for stage %i", mMaterial->_getOverlayMap(i), i);
|
||||
mMaterial->logError("Failed to load overlay map %s for stage %i", mMaterial->getOverlayMapAssetId(i), i);
|
||||
}
|
||||
|
||||
// LightMap
|
||||
|
|
@ -418,7 +418,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_LightMap, mMaterial->getLightMap(i));
|
||||
if (!mStages[i].getTex(MFT_LightMap))
|
||||
mMaterial->logError("Failed to load light map %s for stage %i", mMaterial->_getLightMap(i), i);
|
||||
mMaterial->logError("Failed to load light map %s for stage %i", mMaterial->getLightMapAssetId(i), i);
|
||||
}
|
||||
|
||||
// ToneMap
|
||||
|
|
@ -426,7 +426,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_ToneMap, mMaterial->getToneMap(i));
|
||||
if (!mStages[i].getTex(MFT_ToneMap))
|
||||
mMaterial->logError("Failed to load tone map %s for stage %i", mMaterial->_getToneMap(i), i);
|
||||
mMaterial->logError("Failed to load tone map %s for stage %i", mMaterial->getToneMapAssetId(i), i);
|
||||
}
|
||||
|
||||
// DetailMap
|
||||
|
|
@ -434,7 +434,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_DetailMap, mMaterial->getDetailMap(i));
|
||||
if (!mStages[i].getTex(MFT_DetailMap))
|
||||
mMaterial->logError("Failed to load detail map %s for stage %i", mMaterial->_getDetailMap(i), i);
|
||||
mMaterial->logError("Failed to load detail map %s for stage %i", mMaterial->getDetailMapAssetId(i), i);
|
||||
}
|
||||
|
||||
// NormalMap
|
||||
|
|
@ -454,7 +454,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMap(i));
|
||||
if (!mStages[i].getTex(MFT_DetailNormalMap))
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->_getDetailNormalMap(i), i);
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getDetailNormalMapAssetId(i), i);
|
||||
}
|
||||
|
||||
//depending on creation method this may or may not have been shoved into srgb space eroneously
|
||||
|
|
@ -467,7 +467,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_OrmMap, mMaterial->getORMConfigMap(profile, i));
|
||||
if (!mStages[i].getTex(MFT_OrmMap))
|
||||
mMaterial->logError("Failed to load PBR Config map %s for stage %i", mMaterial->_getORMConfigMap(i), i);
|
||||
mMaterial->logError("Failed to load PBR Config map %s for stage %i", mMaterial->getORMConfigMapAssetId(i), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -489,7 +489,7 @@ void ProcessedMaterial::_setStageData()
|
|||
{
|
||||
mStages[i].setTex(MFT_GlowMap, mMaterial->getGlowMap(i));
|
||||
if (!mStages[i].getTex(MFT_GlowMap))
|
||||
mMaterial->logError("Failed to load glow map %s for stage %i", mMaterial->_getGlowMap(i), i);
|
||||
mMaterial->logError("Failed to load glow map %s for stage %i", mMaterial->getGlowMapAssetId(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue