mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
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:
parent
6eac6d767b
commit
b707b2e2b7
2 changed files with 16 additions and 6 deletions
|
|
@ -153,6 +153,7 @@ ImageAsset::ImageAsset() :
|
||||||
mIsNamedTarget(false),
|
mIsNamedTarget(false),
|
||||||
mImageWidth(-1),
|
mImageWidth(-1),
|
||||||
mImageHeight(-1),
|
mImageHeight(-1),
|
||||||
|
mImageDepth(-1),
|
||||||
mImageChannels(-1)
|
mImageChannels(-1)
|
||||||
{
|
{
|
||||||
mLoadedState = AssetErrCode::NotLoaded;
|
mLoadedState = AssetErrCode::NotLoaded;
|
||||||
|
|
@ -423,6 +424,9 @@ void ImageAsset::setImageFile(StringTableEntry pImageFile)
|
||||||
Con::errorf("ImageAsset::setImageFile STB Get file info failed: %s", stbErr);
|
Con::errorf("ImageAsset::setImageFile STB Get file info failed: %s", stbErr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we only support 2d textures..... for no ;)
|
||||||
|
mImageDepth = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
@ -643,6 +647,7 @@ void ImageAsset::onTamlCustomWrite(TamlCustomNodes& customNodes)
|
||||||
|
|
||||||
pImageInfoNode->addField(StringTable->insert("ImageWidth"), mImageWidth);
|
pImageInfoNode->addField(StringTable->insert("ImageWidth"), mImageWidth);
|
||||||
pImageInfoNode->addField(StringTable->insert("ImageHeight"), mImageHeight);
|
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);
|
pField->getFieldValue(mImageHeight);
|
||||||
}
|
}
|
||||||
|
else if (fieldName == StringTable->insert("ImageDepth"))
|
||||||
|
{
|
||||||
|
pField->getFieldValue(mImageDepth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Unknown name so warn.
|
// Unknown name so warn.
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ private:
|
||||||
bool mIsNamedTarget;
|
bool mIsNamedTarget;
|
||||||
S32 mImageWidth;
|
S32 mImageWidth;
|
||||||
S32 mImageHeight;
|
S32 mImageHeight;
|
||||||
|
S32 mImageDepth;
|
||||||
S32 mImageChannels;
|
S32 mImageChannels;
|
||||||
|
|
||||||
void generateTexture(void);
|
void generateTexture(void);
|
||||||
|
|
@ -186,13 +187,13 @@ public:
|
||||||
void setImageType(ImageTypes type) { mImageType = type; }
|
void setImageType(ImageTypes type) { mImageType = type; }
|
||||||
ImageTypes getImageType() { return mImageType; }
|
ImageTypes getImageType() { return mImageType; }
|
||||||
|
|
||||||
inline U32 getTextureWidth(void) const { return mTextureHandle->getWidth(); }
|
inline U32 getTextureWidth(void) const { return isAssetValid() ? mTextureHandle->getWidth() : 0; }
|
||||||
inline U32 getTextureHeight(void) const { return mTextureHandle->getHeight(); }
|
inline U32 getTextureHeight(void) const { return isAssetValid() ? mTextureHandle->getHeight() : 0; }
|
||||||
inline U32 getTextureDepth(void) const { return mTextureHandle->getDepth(); }
|
inline U32 getTextureDepth(void) const { return isAssetValid() ? mTextureHandle->getDepth() : 0; }
|
||||||
|
|
||||||
inline U32 getTextureBitmapWidth(void) const { return mTextureHandle->getBitmapWidth(); }
|
inline U32 getTextureBitmapWidth(void) const { return mImageWidth; }
|
||||||
inline U32 getTextureBitmapHeight(void) const { return mTextureHandle->getBitmapHeight(); }
|
inline U32 getTextureBitmapHeight(void) const { return mImageHeight; }
|
||||||
inline U32 getTextureBitmapDepth(void) const { return mTextureHandle->getBitmapDepth(); }
|
inline U32 getTextureBitmapDepth(void) const { return mImageDepth; }
|
||||||
bool isAssetValid(void) const override { return !mTextureHandle.isNull(); }
|
bool isAssetValid(void) const override { return !mTextureHandle.isNull(); }
|
||||||
|
|
||||||
bool isNamedTarget(void) const { return mIsNamedTarget; }
|
bool isNamedTarget(void) const { return mIsNamedTarget; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue