mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
fully working
This commit is contained in:
parent
85463c85ac
commit
f6dc694bd4
10 changed files with 88 additions and 75 deletions
|
|
@ -208,49 +208,53 @@ public:
|
|||
//-----------------------------------------------------------------------
|
||||
// Data
|
||||
//-----------------------------------------------------------------------
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES);
|
||||
void onImageAssetChanged() {
|
||||
reload();
|
||||
}
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
|
||||
|
||||
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
|
||||
|
||||
bool mIsSRGb[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap);
|
||||
F32 mAOChan[MAX_STAGES];
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap);
|
||||
bool mInvertRoughness[MAX_STAGES];
|
||||
F32 mRoughnessChan[MAX_STAGES];
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap);
|
||||
|
||||
F32 mMetalChan[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap);
|
||||
|
||||
F32 mGlowMul[MAX_STAGES];
|
||||
/// A second normal map which repeats at the detail map
|
||||
/// scale and blended with the base normal map.
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES, onImageAssetChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
|
||||
|
||||
/// The strength scalar for the detail normal map.
|
||||
|
|
|
|||
|
|
@ -398,29 +398,20 @@ void ProcessedMaterial::_setStageData()
|
|||
//mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
|
||||
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||
{
|
||||
// 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->mDiffuseMapName[i] != StringTable->EmptyString())
|
||||
{
|
||||
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("#") || String(mMaterial->mDiffuseMapName[i]).startsWith("$"))
|
||||
if (String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("#") || String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("$"))
|
||||
{
|
||||
NamedTexTarget* namedTarget = NamedTexTarget::find(mMaterial->mDiffuseMapName[i] + 1);
|
||||
if(namedTarget)
|
||||
NamedTexTarget* namedTarget = NamedTexTarget::find(mMaterial->mDiffuseMapAsset[i]->getImageFileName() + 1);
|
||||
if (namedTarget)
|
||||
mStages[i].setTex(MFT_DiffuseMap, namedTarget->getTexture(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!String(mMaterial->mDiffuseMapName[i]).startsWith("#"))
|
||||
mMaterial->logError("Failed to load diffuse map %s for stage %i", mMaterial->mDiffuseMapName[i], i);
|
||||
if (mStages[i].getTex(MFT_DiffuseMap))
|
||||
{
|
||||
mMaterial->mDiffuseMap[i] = namedTarget->getTexture(0);
|
||||
}
|
||||
|
||||
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||
mHasSetStageData = false;
|
||||
}
|
||||
else {
|
||||
// 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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue