mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Includes required support functions for ImageAsset
This commit is contained in:
parent
4f319d3d2c
commit
4978538490
3 changed files with 66 additions and 16 deletions
|
|
@ -239,6 +239,50 @@ const char* ImageAsset::getImageInfo()
|
|||
return "";
|
||||
}
|
||||
|
||||
const char* ImageAsset::getImageTypeNameFromType(ImageAsset::ImageTypes type)
|
||||
{
|
||||
// must match ImageTypes order
|
||||
static const char* _names[] = {
|
||||
"Albedo"
|
||||
"Normal"
|
||||
"Composite"
|
||||
"GUI"
|
||||
"Roughness"
|
||||
"AO"
|
||||
"Metalness"
|
||||
"Glow"
|
||||
"Particle"
|
||||
"Decal"
|
||||
"Cubemap"
|
||||
};
|
||||
|
||||
if (type < 0 || type >= ImageTypeCount)
|
||||
{
|
||||
Con::errorf("ImageAsset::getAdapterNameFromType - Invalid ImageType, defaulting to Albedo");
|
||||
return _names[Albedo];
|
||||
}
|
||||
|
||||
return _names[type];
|
||||
}
|
||||
|
||||
ImageAsset::ImageTypes ImageAsset::getImageTypeFromName(const char* name)
|
||||
{
|
||||
S32 ret = -1;
|
||||
for (S32 i = 0; i < ImageTypeCount; i++)
|
||||
{
|
||||
if (!dStricmp(getImageTypeNameFromType((ImageTypes)i), name))
|
||||
ret = i;
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
Con::errorf("ImageAsset::getImageTypeFromName - Invalid ImageType name, defaulting to Albedo");
|
||||
ret = Albedo;
|
||||
}
|
||||
|
||||
return (ImageTypes)ret;
|
||||
}
|
||||
|
||||
DefineEngineMethod(ImageAsset, getImageFilename, const char*, (), ,
|
||||
"Creates an instance of the given GameObject given the asset definition.\n"
|
||||
"@return The GameObject entity created from the asset.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue