final rev

add safeties to getters
getTextureBitmap/ functions to return member variable that is collected when the image is set
This commit is contained in:
marauder2k7 2025-03-28 15:32:16 +00:00
parent 6eac6d767b
commit b707b2e2b7
2 changed files with 16 additions and 6 deletions

View file

@ -153,6 +153,7 @@ ImageAsset::ImageAsset() :
mIsNamedTarget(false),
mImageWidth(-1),
mImageHeight(-1),
mImageDepth(-1),
mImageChannels(-1)
{
mLoadedState = AssetErrCode::NotLoaded;
@ -423,6 +424,9 @@ void ImageAsset::setImageFile(StringTableEntry pImageFile)
Con::errorf("ImageAsset::setImageFile STB Get file info failed: %s", stbErr);
}
}
// we only support 2d textures..... for no ;)
mImageDepth = 1;
}
refreshAsset();
@ -643,6 +647,7 @@ void ImageAsset::onTamlCustomWrite(TamlCustomNodes& customNodes)
pImageInfoNode->addField(StringTable->insert("ImageWidth"), mImageWidth);
pImageInfoNode->addField(StringTable->insert("ImageHeight"), mImageHeight);
pImageInfoNode->addField(StringTable->insert("ImageDepth"), mImageDepth);
}
@ -676,6 +681,10 @@ void ImageAsset::onTamlCustomRead(const TamlCustomNodes& customNodes)
{
pField->getFieldValue(mImageHeight);
}
else if (fieldName == StringTable->insert("ImageDepth"))
{
pField->getFieldValue(mImageDepth);
}
else
{
// Unknown name so warn.