mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-08 13:14:33 +00:00
Merge pull request #1769 from Areloch/ImageAssetConvert
Updates ImageAsset usage to be more standardized
This commit is contained in:
commit
280866724d
82 changed files with 1451 additions and 951 deletions
|
|
@ -93,7 +93,9 @@ AccumulationVolume::~AccumulationVolume()
|
|||
void AccumulationVolume::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, AccumulationVolume, "Accumulation texture.")
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, AccumulationVolume))
|
||||
.network(U32(-1))
|
||||
.doc("Accumulation texture asset");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
|
@ -229,7 +231,7 @@ U32 AccumulationVolume::packUpdate( NetConnection *connection, U32 mask, BitStre
|
|||
|
||||
if (stream->writeFlag(mask & InitialUpdateMask))
|
||||
{
|
||||
PACK_ASSET_REFACTOR(connection, Texture);
|
||||
AssetDatabase.packUpdateAsset(connection, mask, stream, mTextureAssetRef.assetId);
|
||||
}
|
||||
|
||||
return retMask;
|
||||
|
|
@ -241,7 +243,7 @@ void AccumulationVolume::unpackUpdate( NetConnection *connection, BitStream *str
|
|||
|
||||
if (stream->readFlag())
|
||||
{
|
||||
UNPACK_ASSET_REFACTOR(connection, Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackUpdateAsset(connection, stream);
|
||||
//setTexture(mTextureName);
|
||||
}
|
||||
}
|
||||
|
|
@ -256,7 +258,8 @@ void AccumulationVolume::inspectPostApply()
|
|||
|
||||
void AccumulationVolume::setTexture( const String& name )
|
||||
{
|
||||
_setTexture(StringTable->insert(name.c_str()));
|
||||
mTextureAssetRef = StringTable->insert(name.c_str());
|
||||
setMaskBits(-1);
|
||||
refreshVolumes();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#include "gfx/gfxDevice.h"
|
||||
#endif
|
||||
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
/// A volume in space that blocks visibility.
|
||||
class AccumulationVolume : public ScenePolyhedralSpace
|
||||
{
|
||||
|
|
@ -61,7 +63,7 @@ class AccumulationVolume : public ScenePolyhedralSpace
|
|||
// SceneSpace.
|
||||
void _renderObject( ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* overrideMat ) override;
|
||||
|
||||
DECLARE_IMAGEASSET_NET(AccumulationVolume, Texture, GFXStaticTextureSRGBProfile, -1)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -78,6 +80,8 @@ class AccumulationVolume : public ScenePolyhedralSpace
|
|||
void inspectPostApply() override;
|
||||
void setTexture( const String& name );
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
// Static Functions.
|
||||
static void consoleInit();
|
||||
static void initPersistFields();
|
||||
|
|
|
|||
|
|
@ -65,7 +65,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
StringTableEntry ImageAsset::smNoImageAssetFallback = NULL;
|
||||
AssetPtr<ImageAsset> ImageAsset::smNoImageAssetFallbackAssetPtr = NULL;
|
||||
|
||||
StringTableEntry ImageAsset::smNamedTargetAssetFallback = NULL;
|
||||
AssetPtr<ImageAsset> ImageAsset::smNamedTargetAssetFallbackAssetPtr = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -116,14 +119,93 @@ ConsoleSetType(TypeImageAssetPtr)
|
|||
Con::warnf("(TypeImageAssetPtr) - Cannot set multiple args to a single asset.");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_STRUCT(AssetRef<ImageAsset>, AssetRefImageAsset, , "")
|
||||
END_IMPLEMENT_STRUCT
|
||||
|
||||
ConsoleType(ImageAssetRef, TypeImageAssetRef, AssetRef<ImageAsset>, ASSET_ID_FIELD_PREFIX)
|
||||
|
||||
|
||||
ConsoleGetType(TypeImageAssetRef)
|
||||
{
|
||||
AssetRef<ImageAsset>& ref = *((AssetRef<ImageAsset>*)dptr);
|
||||
|
||||
if (ref.assetPtr.isNull())
|
||||
return ref.assetId;
|
||||
else
|
||||
{
|
||||
if ((ref.assetId[0] == '$' || ref.assetId[0] == '#'))
|
||||
return ref.assetId;
|
||||
|
||||
return ref.assetPtr.getAssetId();
|
||||
}
|
||||
}
|
||||
|
||||
AssetPtr<ImageAsset> ImageAsset::getNamedTargetAssetPtr(StringTableEntry filePath)
|
||||
{
|
||||
// Do a lookup to see if we can find a hit on this path/id
|
||||
// If not, then we'll register it as a private asset and keep going
|
||||
// as if we're in this function, we're almost certainly dealing with
|
||||
// a named target anyways and require the special case.
|
||||
StringTableEntry imageAssetId = getAssetIdByFilename(filePath);
|
||||
if (imageAssetId == smNoImageAssetFallback)
|
||||
{
|
||||
ImageAsset* privateImage = new ImageAsset();
|
||||
privateImage->setImageFile(filePath);
|
||||
imageAssetId = AssetDatabase.addPrivateAsset(privateImage);
|
||||
}
|
||||
|
||||
AssetPtr<ImageAsset> assetPtr;
|
||||
assetPtr = imageAssetId;
|
||||
return assetPtr;
|
||||
}
|
||||
|
||||
ConsoleSetType(TypeImageAssetRef)
|
||||
{
|
||||
// Was a single argument specified?
|
||||
if (argc == 1)
|
||||
{
|
||||
// Yes, so fetch field value.
|
||||
const char* pFieldValue = argv[0];
|
||||
|
||||
// Fetch asset pointer.
|
||||
AssetRef<ImageAsset>* pAssetRef = (AssetRef<ImageAsset>*)(dptr);
|
||||
|
||||
// Is the asset pointer the correct type?
|
||||
if (pAssetRef == NULL)
|
||||
{
|
||||
Con::warnf("(TypeImageAssetRef) - Failed to set asset Id '%d'.", pFieldValue);
|
||||
return;
|
||||
}
|
||||
|
||||
StringTableEntry _in = StringTable->insert(pFieldValue);
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
pAssetRef->assetId = _in;
|
||||
pAssetRef->assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set asset.
|
||||
*pAssetRef = _in;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Warn.
|
||||
Con::warnf("(TypeImageAssetRef) - Cannot set multiple args to a single asset.");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// REFACTOR END
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ImplementEnumType(ImageAssetType,
|
||||
"Type of mesh data available in a shape.\n"
|
||||
"Type of image data this asset describes.\n"
|
||||
"@ingroup gameObjects")
|
||||
{ ImageAsset::Albedo, "Albedo", "" },
|
||||
{ ImageAsset::Albedo, "Albedo", "" },
|
||||
{ ImageAsset::Normal, "Normal", "" },
|
||||
{ ImageAsset::ORMConfig, "ORMConfig", "" },
|
||||
{ ImageAsset::GUI, "GUI", "" },
|
||||
|
|
@ -308,6 +390,26 @@ StringTableEntry ImageAsset::getAssetIdByFilename(StringTableEntry fileName)
|
|||
return imageAssetId;
|
||||
}
|
||||
|
||||
StringTableEntry ImageAsset::getAssetIdFromFilePath(StringTableEntry filePath)
|
||||
{
|
||||
if (filePath == StringTable->EmptyString())
|
||||
return filePath;
|
||||
|
||||
// Already a valid asset id.
|
||||
if (AssetDatabase.isDeclaredAsset(filePath))
|
||||
return filePath;
|
||||
|
||||
StringTableEntry assetId = getAssetIdByFilename(filePath);
|
||||
if (assetId == smNoImageAssetFallback)
|
||||
{
|
||||
ImageAsset* privateImage = new ImageAsset();
|
||||
privateImage->setImageFile(filePath);
|
||||
assetId = AssetDatabase.addPrivateAsset(privateImage);
|
||||
}
|
||||
|
||||
return assetId;
|
||||
}
|
||||
|
||||
U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* imageAsset)
|
||||
{
|
||||
(*imageAsset) = assetId;
|
||||
|
|
@ -318,8 +420,13 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* ima
|
|||
}
|
||||
else
|
||||
{
|
||||
//Didn't work, so have us fall back to a placeholder asset
|
||||
imageAsset->setAssetId(ImageAsset::smNoImageAssetFallback);
|
||||
|
||||
if (imageAsset->isNull())
|
||||
{
|
||||
//Well that's bad, loading the fallback failed.
|
||||
Con::errorf("ImageAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
|
||||
return AssetErrCode::Failed;
|
||||
}
|
||||
|
||||
|
|
@ -352,6 +459,25 @@ void ImageAsset::initializeAsset(void)
|
|||
Torque::FS::AddChangeNotification(mImageFile, this, &ImageAsset::_onResourceChanged);
|
||||
|
||||
populateImage();
|
||||
|
||||
//Make sure our fallbacks are valid
|
||||
if (smNoImageAssetFallbackAssetPtr.isNull())
|
||||
{
|
||||
smNoImageAssetFallbackAssetPtr = smNoImageAssetFallback;
|
||||
if (smNoImageAssetFallbackAssetPtr.isNull())
|
||||
Con::errorf("ImageAsset::initializeAsset could not find fallback asset %s!", smNoImageAssetFallback);
|
||||
else
|
||||
smNoImageAssetFallbackAssetPtr->load();
|
||||
}
|
||||
|
||||
if (smNamedTargetAssetFallbackAssetPtr.isNull())
|
||||
{
|
||||
smNamedTargetAssetFallbackAssetPtr = smNamedTargetAssetFallback;
|
||||
if (smNamedTargetAssetFallbackAssetPtr.isNull())
|
||||
Con::errorf("ImageAsset::initializeAsset could not find named target fallback asset %s!", smNamedTargetAssetFallback);
|
||||
else
|
||||
smNamedTargetAssetFallbackAssetPtr->load();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageAsset::onAssetRefresh(void)
|
||||
|
|
@ -470,23 +596,20 @@ GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
|||
|
||||
if (isNamedTarget())
|
||||
{
|
||||
GFXTexHandle tex;
|
||||
AssetPtr<ImageAsset> fallbackAsset;
|
||||
ImageAsset::getAssetById(smNamedTargetAssetFallback, &fallbackAsset);
|
||||
if (getNamedTarget().isValid())
|
||||
{
|
||||
tex = getNamedTarget()->getTexture();
|
||||
if (tex.isNull())
|
||||
GFXTexHandle tex = getNamedTarget()->getTexture();
|
||||
if (!tex.isNull())
|
||||
{
|
||||
return fallbackAsset->getTexture(requestedProfile);
|
||||
mResourceMap.insert(requestedProfile, tex);
|
||||
return tex;
|
||||
}
|
||||
mResourceMap.insert(requestedProfile, tex);
|
||||
return tex;
|
||||
}
|
||||
else
|
||||
{
|
||||
return fallbackAsset->getTexture(requestedProfile);
|
||||
}
|
||||
|
||||
if (smNamedTargetAssetFallbackAssetPtr.notNull())
|
||||
return smNamedTargetAssetFallbackAssetPtr->getTexture(requestedProfile);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mLoadedState == Ok)
|
||||
|
|
@ -501,6 +624,9 @@ GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
|||
}
|
||||
}
|
||||
|
||||
if (smNoImageAssetFallbackAssetPtr.notNull() && smNoImageAssetFallbackAssetPtr != this)
|
||||
return smNoImageAssetFallbackAssetPtr->getTexture(requestedProfile);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1047,4 +1173,21 @@ DefineEngineMethod(GuiInspectorTypeImageAssetPtr, setIsDeleteBtnVisible, void, (
|
|||
{
|
||||
object->setIsDeleteBtnVisible(isVisible);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiInspectorTypeImageAssetRef);
|
||||
|
||||
ConsoleDocClass(GuiInspectorTypeImageAssetRef,
|
||||
"@brief Inspector field type for AssetRef<ImageAsset> fields\n\n"
|
||||
"Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
||||
void GuiInspectorTypeImageAssetRef::consoleInit()
|
||||
{
|
||||
Parent::consoleInit();
|
||||
|
||||
ConsoleBaseType::getType(TypeImageAssetRef)->setInspectorFieldType("GuiInspectorTypeImageAssetRef");
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -114,7 +114,10 @@ public:
|
|||
};
|
||||
|
||||
static StringTableEntry smNoImageAssetFallback;
|
||||
static AssetPtr<ImageAsset> smNoImageAssetFallbackAssetPtr;
|
||||
|
||||
static StringTableEntry smNamedTargetAssetFallback;
|
||||
static AssetPtr<ImageAsset> smNamedTargetAssetFallbackAssetPtr;
|
||||
|
||||
enum ImageAssetErrCode
|
||||
{
|
||||
|
|
@ -193,6 +196,17 @@ public:
|
|||
|
||||
static U32 getAssetByFilename(StringTableEntry fileName, AssetPtr<ImageAsset>* imageAsset);
|
||||
static StringTableEntry getAssetIdByFilename(StringTableEntry fileName);
|
||||
|
||||
static StringTableEntry getAssetIdFromFilePath(StringTableEntry filePath);
|
||||
|
||||
/// Returns true if the given value follows the named target naming convention:
|
||||
/// ($backBuffer, #color)
|
||||
static bool isNamedTarget(StringTableEntry name) { return name != NULL && name != StringTable->EmptyString() && (name[0] == '$' || name[0] == '#'); }
|
||||
|
||||
/// Resolves a named render target ($backBuffer, #color) to an asset
|
||||
/// pointer, binding/creating a private ImageAsset if needed.
|
||||
static AssetPtr<ImageAsset> getNamedTargetAssetPtr(StringTableEntry filePath);
|
||||
|
||||
static U32 getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* imageAsset);
|
||||
static U32 getAssetById(String assetId, AssetPtr<ImageAsset>* imageAsset) { return getAssetById(assetId.c_str(), imageAsset); };
|
||||
|
||||
|
|
@ -228,267 +242,8 @@ protected:
|
|||
DECLARE_STRUCT(AssetPtr<ImageAsset>)
|
||||
DefineConsoleType(TypeImageAssetPtr, AssetPtr<ImageAsset> )
|
||||
|
||||
DECLARE_STRUCT(AssetRef<ImageAsset>)
|
||||
DefineConsoleType(TypeImageAssetRef, AssetRef<ImageAsset>)
|
||||
|
||||
typedef ImageAsset::ImageTypes ImageAssetType;
|
||||
DefineEnumType(ImageAssetType);
|
||||
|
||||
#pragma region Refactor Asset Macros
|
||||
|
||||
#define DECLARE_IMAGEASSET(className, name, profile) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset; \
|
||||
StringTableEntry m##name##File = StringTable->EmptyString(); \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in){ \
|
||||
if(m##name##Asset.getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File() == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset = NULL; \
|
||||
m##name##File = ""; \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry imageAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \
|
||||
{ \
|
||||
imageAssetId = ImageAsset::getAssetIdByFilename(_in); \
|
||||
if (imageAssetId == ImageAsset::smNoImageAssetFallback) \
|
||||
{ \
|
||||
ImageAsset* privateImage = new ImageAsset(); \
|
||||
privateImage->setImageFile(_in); \
|
||||
imageAssetId = AssetDatabase.addPrivateAsset(privateImage); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s using fallback", #className, #name, _in); \
|
||||
imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||
} \
|
||||
m##name##Asset = imageAssetId; \
|
||||
m##name##File = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset = _in; \
|
||||
m##name##File = get##name##File(); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
||||
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
||||
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;} \
|
||||
StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getImageFile() : ""; }
|
||||
|
||||
|
||||
#define DECLARE_IMAGEASSET_NET(className, name, profile, mask) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset; \
|
||||
StringTableEntry m##name##File = StringTable->EmptyString(); \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in){ \
|
||||
if(m##name##Asset.getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File() == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset = NULL; \
|
||||
m##name##File = ""; \
|
||||
setMaskBits(mask); \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry imageAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \
|
||||
{ \
|
||||
imageAssetId = ImageAsset::getAssetIdByFilename(_in); \
|
||||
if (imageAssetId == ImageAsset::smNoImageAssetFallback) \
|
||||
{ \
|
||||
ImageAsset* privateImage = new ImageAsset(); \
|
||||
privateImage->setImageFile(_in); \
|
||||
imageAssetId = AssetDatabase.addPrivateAsset(privateImage); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s using fallback", #className, #name, _in); \
|
||||
imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||
} \
|
||||
m##name##Asset = imageAssetId; \
|
||||
m##name##File = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset = _in; \
|
||||
m##name##File = get##name##File(); \
|
||||
} \
|
||||
setMaskBits(mask); \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
||||
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
||||
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;} \
|
||||
StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getImageFile() : ""; }
|
||||
|
||||
|
||||
#define INITPERSISTFIELD_IMAGEASSET(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeImageAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.)); \
|
||||
addProtectedField(assetText(name, File), TypeFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, file docs.), AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
|
||||
#define DECLARE_IMAGEASSET_ARRAY(className, name, profile, max) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset[max]; \
|
||||
StringTableEntry m##name##File[max] = {StringTable->EmptyString() }; \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in, const U32& index){ \
|
||||
if(m##name##Asset[index].getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File(index) == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset[index] = NULL; \
|
||||
m##name##File[index] = ""; \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry imageAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \
|
||||
{ \
|
||||
imageAssetId = ImageAsset::getAssetIdByFilename(_in); \
|
||||
if (imageAssetId == ImageAsset::smNoImageAssetFallback) \
|
||||
{ \
|
||||
ImageAsset* privateImage = new ImageAsset(); \
|
||||
privateImage->setImageFile(_in); \
|
||||
imageAssetId = AssetDatabase.addPrivateAsset(privateImage); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s using fallback", #className, #name, _in); \
|
||||
imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||
} \
|
||||
m##name##Asset[index] = imageAssetId; \
|
||||
m##name##File[index] = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset[index] = _in; \
|
||||
m##name##File[index] = get##name##File(index); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \
|
||||
GFXTexHandle get##name(const U32& index) { return get##name(&profile, index); } \
|
||||
GFXTexHandle get##name(GFXTextureProfile* requestedProfile, const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(requestedProfile) : NULL; }\
|
||||
AssetPtr<ImageAsset> get##name##Asset(const U32& index) { return m##name##Asset[index]; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false;}\
|
||||
StringTableEntry get##name##File(const U32& idx){ return m##name##Asset[idx].notNull() ? m##name##Asset[idx]->getImageFile() : ""; }
|
||||
|
||||
|
||||
#define DECLARE_IMAGEASSET_ARRAY_NET(className, name, profile, max, mask) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset[max]; \
|
||||
StringTableEntry m##name##File[max] = {StringTable->EmptyString() }; \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in, const U32& index){ \
|
||||
if(m##name##Asset[index].getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File(index) == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset[index] = NULL; \
|
||||
m##name##File[index] = ""; \
|
||||
setMaskBits(mask); \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry imageAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \
|
||||
{ \
|
||||
imageAssetId = ImageAsset::getAssetIdByFilename(_in); \
|
||||
if (imageAssetId == ImageAsset::smNoImageAssetFallback) \
|
||||
{ \
|
||||
ImageAsset* privateImage = new ImageAsset(); \
|
||||
privateImage->setImageFile(_in); \
|
||||
imageAssetId = AssetDatabase.addPrivateAsset(privateImage); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s using fallback", #className, #name, _in); \
|
||||
imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||
} \
|
||||
m##name##Asset[index] = imageAssetId; \
|
||||
m##name##File[index] = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset[index] = _in; \
|
||||
m##name##File[index] = get##name##File(index); \
|
||||
} \
|
||||
setMaskBits(mask); \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \
|
||||
GFXTexHandle get##name(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(&profile) : NULL; } \
|
||||
GFXTexHandle get##name(GFXTextureProfile* requestedProfile, const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(requestedProfile) : NULL; }\
|
||||
AssetPtr<ImageAsset> get##name##Asset(const U32& index) { return m##name##Asset[index]; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false;}\
|
||||
StringTableEntry get##name##File(const U32& idx){ return m##name##Asset[idx].notNull() ? m##name##Asset[idx]->getImageFile() : ""; }
|
||||
|
||||
|
||||
#define INITPERSISTFIELD_IMAGEASSET_ARRAY(name, arraySize, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeImageAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
|
||||
|
||||
#define DEF_IMAGEASSET_ARRAY_BINDS(className,name, max)\
|
||||
DefineEngineMethod(className, get##name, const char*, (S32 index), , "get name")\
|
||||
{\
|
||||
return object->get##name##Asset(index).notNull() ? object->get##name##Asset(index)->getImageFile() : ""; \
|
||||
}\
|
||||
DefineEngineMethod(className, get##name##Asset, const char*, (S32 index), , assetText(name, asset reference))\
|
||||
{\
|
||||
if(index >= max || index < 0)\
|
||||
return "";\
|
||||
return object->_get##name(index); \
|
||||
}\
|
||||
DefineEngineMethod(className, set##name, void, (const char* map, S32 index), , assetText(name,assignment. first tries asset then flat file.))\
|
||||
{\
|
||||
object->_set##name(StringTable->insert(map), index);\
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
|
|
|||
|
|
@ -51,4 +51,13 @@ public:
|
|||
DECLARE_CONOBJECT(GuiInspectorTypeImageAssetId);
|
||||
static void consoleInit();
|
||||
};
|
||||
|
||||
class GuiInspectorTypeImageAssetRef : public GuiInspectorTypeImageAssetPtr
|
||||
{
|
||||
typedef GuiInspectorTypeImageAssetPtr Parent;
|
||||
public:
|
||||
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeImageAssetRef);
|
||||
static void consoleInit();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ void GuiInspectorTypeMaterialAssetPtr::setPreviewImage(StringTableEntry assetId)
|
|||
MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(assetId);
|
||||
if (matAsset && matAsset->getMaterialDefinition())
|
||||
{
|
||||
mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->_getDiffuseMap(0));
|
||||
mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->getDiffuseMapAssetId(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2982,27 +2982,27 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|||
|
||||
if (imageType == ImageAsset::ImageTypes::Albedo || childItem->imageSuffixType.isEmpty())
|
||||
{
|
||||
newMat->_setDiffuseMap(assetMapFillInStr,0);
|
||||
newMat->setDiffuseMap(assetMapFillInStr,0);
|
||||
}
|
||||
else if (imageType == ImageAsset::ImageTypes::Normal)
|
||||
{
|
||||
newMat->_setNormalMap(assetMapFillInStr, 0);
|
||||
newMat->setNormalMap(assetMapFillInStr, 0);
|
||||
}
|
||||
else if (imageType == ImageAsset::ImageTypes::ORMConfig)
|
||||
{
|
||||
newMat->_setORMConfigMap(assetMapFillInStr, 0);
|
||||
newMat->setORMConfigMap(assetMapFillInStr, 0);
|
||||
}
|
||||
else if (imageType == ImageAsset::ImageTypes::Metalness)
|
||||
{
|
||||
newMat->_setMetalMap(assetMapFillInStr, 0);
|
||||
newMat->setMetalMap(assetMapFillInStr, 0);
|
||||
}
|
||||
else if (imageType == ImageAsset::ImageTypes::AO)
|
||||
{
|
||||
newMat->_setAOMap(assetMapFillInStr, 0);
|
||||
newMat->setAOMap(assetMapFillInStr, 0);
|
||||
}
|
||||
else if (imageType == ImageAsset::ImageTypes::Roughness)
|
||||
{
|
||||
newMat->_setRoughMap(assetMapFillInStr, 0);
|
||||
newMat->setRoughMap(assetMapFillInStr, 0);
|
||||
hasRoughness = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ void ParticleData::initPersistFields()
|
|||
{
|
||||
docsURL;
|
||||
addGroup("Basic");
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, ParticleData, "Texture to use for this particle.");
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, ParticleData))
|
||||
.doc("Texture asset to use for this particle");
|
||||
addField("useInvAlpha", TYPEID< bool >(), Offset(useInvAlpha, ParticleData),
|
||||
"@brief Controls how particles blend with the scene.\n\n"
|
||||
"If true, particles blend like ParticleBlendStyle NORMAL, if false, "
|
||||
|
|
@ -234,7 +235,8 @@ void ParticleData::initPersistFields()
|
|||
endGroup("Over Time");
|
||||
|
||||
addGroup("AFX");
|
||||
INITPERSISTFIELD_IMAGEASSET(TextureExt, ParticleData, "");
|
||||
ADD_FIELD("textureExtAsset", TypeImageAssetRef, Offset(mTextureExtAssetRef, ParticleData))
|
||||
.doc("");
|
||||
addField("constrainPos", TypeBool, Offset(constrain_pos, ParticleData));
|
||||
addFieldV("angle", TypeRangedF32, Offset(start_angle, ParticleData), &CommonValidators::DegreeRange);
|
||||
addFieldV("angleVariance", TypeRangedF32, Offset(angle_variance, ParticleData), &CommonValidators::DegreeRange);
|
||||
|
|
@ -299,7 +301,7 @@ void ParticleData::packData(BitStream* stream)
|
|||
stream->writeFloat( times[i], 8);
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
mathWrite(*stream, texCoords[i]);
|
||||
|
|
@ -313,7 +315,7 @@ void ParticleData::packData(BitStream* stream)
|
|||
stream->writeInt(framesPerSec, 8);
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(TextureExt);
|
||||
AssetDatabase.packDataAsset(stream, mTextureExtAssetRef.assetId);
|
||||
|
||||
stream->writeFlag(constrain_pos);
|
||||
stream->writeFloat(start_angle/360.0f, 11);
|
||||
|
|
@ -384,7 +386,7 @@ void ParticleData::unpackData(BitStream* stream)
|
|||
times[i] = stream->readFloat(8);
|
||||
}
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
mathRead(*stream, &texCoords[i]);
|
||||
|
|
@ -397,7 +399,7 @@ void ParticleData::unpackData(BitStream* stream)
|
|||
framesPerSec = stream->readInt(8);
|
||||
}
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(TextureExt);
|
||||
mTextureExtAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
constrain_pos = stream->readFlag();
|
||||
start_angle = 360.0f*stream->readFloat(11);
|
||||
|
|
@ -669,6 +671,10 @@ bool ParticleData::preload(bool server, String &errorStr)
|
|||
delete [] tokCopy;
|
||||
numFrames = animTexFrames.size();
|
||||
}
|
||||
|
||||
if (!mTextureAssetRef.isNull())
|
||||
mTextureAssetRef.assetPtr->load();
|
||||
|
||||
}
|
||||
|
||||
return !error;
|
||||
|
|
@ -773,12 +779,12 @@ ParticleData::ParticleData(const ParticleData& other, bool temp_clone) : SimData
|
|||
animTexFramesString = other.animTexFramesString;
|
||||
animTexFrames = other.animTexFrames; // -- parsed from animTexFramesString
|
||||
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
|
||||
spinBias = other.spinBias;
|
||||
randomizeSpinDir = other.randomizeSpinDir;
|
||||
|
||||
CLONE_ASSET_REFACTOR(TextureExt);
|
||||
mTextureExtAssetRef = other.mTextureExtAssetRef;
|
||||
|
||||
constrain_pos = other.constrain_pos;
|
||||
start_angle = other.start_angle;
|
||||
|
|
@ -814,7 +820,16 @@ void ParticleData::onPerformSubstitutions()
|
|||
reload(errorBuffer);
|
||||
}
|
||||
|
||||
DEF_ASSET_BINDS_REFACTOR(ParticleData, Texture);
|
||||
DefineEngineMethod(ParticleData, getTextureAsset, StringTableEntry, (), ,
|
||||
"Texture asset reference")
|
||||
{
|
||||
return object->mTextureAssetRef.getAssetId();
|
||||
}
|
||||
DefineEngineMethod(ParticleData, setTexture, void, (const char* assetName), ,
|
||||
"Texture assignment.")
|
||||
{
|
||||
object->mTextureAssetRef = StringTable->insert(assetName);
|
||||
}
|
||||
|
||||
ConsoleType(stringList, TypeParticleList, Vector<StringTableEntry>, "")
|
||||
|
||||
|
|
@ -907,8 +922,8 @@ GuiControl* GuiInspectorTypeParticleDataList::constructEditControl()
|
|||
mNewParticleBtn->setDataField(StringTable->insert("hovertime"), NULL, "1000");
|
||||
mNewParticleBtn->setDataField(StringTable->insert("tooltip"), NULL, "Add new particle slot");
|
||||
mNewParticleBtn->setHorizSizing(horizResizeRight);
|
||||
mNewParticleBtn->mMakeIconSquare = true;
|
||||
mNewParticleBtn->mFitBitmapToButton = true;
|
||||
mNewParticleBtn->setMakeIconSquare(true);
|
||||
mNewParticleBtn->setFitBitmapToButton(true);
|
||||
mNewParticleBtn->setExtent(20, 20);
|
||||
|
||||
char szBuffer[512];
|
||||
|
|
@ -1003,8 +1018,8 @@ GuiControl* GuiInspectorTypeParticleDataList::_buildParticleEntryField(const S32
|
|||
deleteSlotBtn->setDataField(StringTable->insert("tooltip"), NULL, "Delete this particle slot");
|
||||
deleteSlotBtn->setHorizSizing(horizResizeRight);
|
||||
deleteSlotBtn->setInternalName("deleteBtn");
|
||||
deleteSlotBtn->mMakeIconSquare = true;
|
||||
deleteSlotBtn->mFitBitmapToButton = true;
|
||||
deleteSlotBtn->setMakeIconSquare(true);
|
||||
deleteSlotBtn->setFitBitmapToButton(true);
|
||||
deleteSlotBtn->setPosition(editExtent.x - 20, 0);
|
||||
deleteSlotBtn->setExtent(20, 20);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,10 @@ class ParticleData : public SimDataBlock
|
|||
StringTableEntry animTexFramesString;
|
||||
Vector<U8> animTexFrames;
|
||||
|
||||
DECLARE_IMAGEASSET(ParticleData, Texture, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getTextureAsset() { return mTextureAssetRef.assetPtr; }
|
||||
|
||||
static bool protectedSetSizes(void* object, const char* index, const char* data);
|
||||
static bool protectedSetTimes(void* object, const char* index, const char* data);
|
||||
|
|
@ -115,7 +118,9 @@ public:
|
|||
F32 spinBias;
|
||||
bool randomizeSpinDir;
|
||||
public:
|
||||
DECLARE_IMAGEASSET(ParticleData, TextureExt,GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mTextureExtAssetRef;
|
||||
|
||||
GFXTexHandle getTextureExt() { return mTextureExtAssetRef.notNull() ? mTextureExtAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
bool constrain_pos;
|
||||
F32 start_angle;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ void PrecipitationData::initPersistFields()
|
|||
docsURL;
|
||||
INITPERSISTFIELD_SOUNDASSET(Sound, PrecipitationData, "Looping SFXProfile effect to play while Precipitation is active.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Drop, PrecipitationData, "@brief Texture for drop particles.\n\n"
|
||||
ADD_FIELD("DropAsset", TypeImageAssetRef, Offset(mDropAssetRef, PrecipitationData))
|
||||
.doc("@brief Texture asset for drop particles.\n\n"
|
||||
"The drop texture can contain several different drop sub-textures "
|
||||
"arranged in a grid. There must be the same number of rows as columns. A "
|
||||
"random frame will be chosen for each drop.");
|
||||
|
|
@ -150,7 +151,8 @@ void PrecipitationData::initPersistFields()
|
|||
addField( "dropShader", TypeString, Offset(mDropShaderName, PrecipitationData),
|
||||
"The name of the shader used for raindrops." );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Splash, PrecipitationData, "@brief Texture for splash particles.\n\n"
|
||||
ADD_FIELD("SplashAsset", TypeImageAssetRef, Offset(mSplashAssetRef, PrecipitationData))
|
||||
.doc("@brief Texture asset for splash particles.\n\n"
|
||||
"The splash texture can contain several different splash sub-textures "
|
||||
"arranged in a grid. There must be the same number of rows as columns. A "
|
||||
"random frame will be chosen for each splash.");
|
||||
|
|
@ -179,6 +181,12 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
|||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
||||
if (!mDropAssetRef.isNull())
|
||||
mDropAssetRef.assetPtr->load();
|
||||
|
||||
if (!mSplashAssetRef.isNull())
|
||||
mSplashAssetRef.assetPtr->load();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -190,11 +198,11 @@ void PrecipitationData::packData(BitStream* stream)
|
|||
|
||||
PACKDATA_ASSET(Sound);
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Drop);
|
||||
AssetDatabase.packDataAsset(stream, mDropAssetRef.assetId);
|
||||
|
||||
stream->writeString(mDropShaderName);
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Splash);
|
||||
AssetDatabase.packDataAsset(stream, mSplashAssetRef.assetId);
|
||||
|
||||
stream->writeString(mSplashShaderName);
|
||||
stream->write(mDropsPerSide);
|
||||
|
|
@ -207,11 +215,11 @@ void PrecipitationData::unpackData(BitStream* stream)
|
|||
|
||||
UNPACKDATA_ASSET(Sound);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Drop);
|
||||
mDropAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
mDropShaderName = stream->readSTString();
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Splash);
|
||||
mSplashAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
mSplashShaderName = stream->readSTString();
|
||||
stream->read(&mDropsPerSide);
|
||||
|
|
|
|||
|
|
@ -49,11 +49,17 @@ class PrecipitationData : public GameBaseData
|
|||
DECLARE_SOUNDASSET(PrecipitationData, Sound);
|
||||
DECLARE_ASSET_SETGET(PrecipitationData, Sound);
|
||||
|
||||
DECLARE_IMAGEASSET(PrecipitationData, Drop, GFXStaticTextureSRGBProfile) ///< Texture for drop particles
|
||||
AssetRef<ImageAsset> mDropAssetRef;
|
||||
|
||||
GFXTexHandle getDrop() { return mDropAssetRef.notNull() ? mDropAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getDropAsset() { return mDropAssetRef.assetPtr; }
|
||||
|
||||
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
|
||||
|
||||
DECLARE_IMAGEASSET(PrecipitationData, Splash, GFXStaticTextureSRGBProfile) ///< Texture for splash particles
|
||||
AssetRef<ImageAsset> mSplashAssetRef;
|
||||
|
||||
GFXTexHandle getSplash() { return mSplashAssetRef.notNull() ? mSplashAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getSplashAsset() { return mSplashAssetRef.assetPtr; }
|
||||
|
||||
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ void SplashData::initPersistFields()
|
|||
addFieldV("times", TypeRangedF32, Offset(times, SplashData), &CommonValidators::NormalizedFloat, NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" );
|
||||
addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, SplashData))
|
||||
.elements(NUM_TEX)
|
||||
.doc("Image asset to use as the texture for the splash effect.\n");
|
||||
|
||||
addFieldV("texWrap", TypeRangedF32, Offset(texWrap, SplashData), &CommonValidators::NormalizedFloat, "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n");
|
||||
addFieldV("texFactor", TypeRangedF32, Offset(texFactor, SplashData), &CommonValidators::NormalizedFloat, "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n");
|
||||
|
|
@ -195,7 +197,8 @@ void SplashData::packData(BitStream* stream)
|
|||
stream->writeRangedU32(explosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
for (U32 i = 0; i < NUM_TEX; i++)
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef[i].assetId);
|
||||
|
||||
S32 i;
|
||||
for( i=0; i<NUM_EMITTERS; i++ )
|
||||
|
|
@ -248,7 +251,8 @@ void SplashData::unpackData(BitStream* stream)
|
|||
explosionId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||
}
|
||||
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
for (U32 i = 0; i < NUM_TEX; i++)
|
||||
mTextureAssetRef[i] = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
U32 i;
|
||||
for( i=0; i<NUM_EMITTERS; i++ )
|
||||
|
|
@ -301,9 +305,9 @@ bool SplashData::preload(bool server, String &errorStr)
|
|||
|
||||
for( i=0; i<NUM_TEX; i++ )
|
||||
{
|
||||
if (mTextureAsset[i].isNull())
|
||||
if (!mTextureAssetRef[i].isNull())
|
||||
{
|
||||
_setTexture(_getTexture(i), i);
|
||||
mTextureAssetRef[i].assetPtr->load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public:
|
|||
F32 times[ NUM_TIME_KEYS ];
|
||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, GFXStaticTextureSRGBProfile, NUM_TEX)
|
||||
AssetRef<ImageAsset> mTextureAssetRef[NUM_TEX];
|
||||
|
||||
ExplosionData* explosion;
|
||||
S32 explosionId;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void GameMode::initPersistFields()
|
|||
addField("gameModeName", TypeString, Offset(mGameModeName, GameMode), "Human-readable name of the gamemode");
|
||||
addField("description", TypeString, Offset(mGameModeDesc, GameMode), "Description of the gamemode");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(PreviewImage, GameMode, "Preview Image");
|
||||
addField("previewImageAsset", TypeImageAssetRef, Offset(mPreviewImageAssetRef, GameMode), "Preview Image asset");
|
||||
|
||||
addField("active", TypeBool, Offset(mIsActive, GameMode), "Is the gamemode active");
|
||||
addField("alwaysActive", TypeBool, Offset(mIsAlwaysActive, GameMode), "Is the gamemode always active");
|
||||
|
|
@ -160,7 +160,7 @@ DefineEngineFunction(getGameModesList, ArrayObject*, (), , "")
|
|||
GameMode* gm = dynamic_cast<GameMode*>(*itr);
|
||||
if (gm)
|
||||
{
|
||||
dSprintf(activeValBuffer, 16, "%d", (gm->mIsActive || gm->mIsAlwaysActive));
|
||||
dSprintf(activeValBuffer, 16, "%d", (gm->isActive() || gm->isAlwaysActive()));
|
||||
dictionary->push_back(gm->getName(), activeValBuffer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ private:
|
|||
StringTableEntry mGameModeName;
|
||||
StringTableEntry mGameModeDesc;
|
||||
|
||||
DECLARE_IMAGEASSET(GameMode, PreviewImage, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mPreviewImageAssetRef;
|
||||
|
||||
bool mIsActive;
|
||||
bool mIsAlwaysActive;
|
||||
|
|
@ -40,6 +40,8 @@ public:
|
|||
bool isAlwaysActive() { return mIsAlwaysActive; }
|
||||
void setAlwaysActive(const bool& alwaysActive);
|
||||
|
||||
GFXTexHandle getPreviewImage() { return mPreviewImageAssetRef.notNull() ? mPreviewImageAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
DECLARE_CONOBJECT(GameMode);
|
||||
|
||||
static void findGameModes(const char* gameModeList, Vector<GameMode*>* outGameModes);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ LevelInfo::LevelInfo()
|
|||
LevelInfo::~LevelInfo()
|
||||
{
|
||||
LightManager::smActivateSignal.remove(this, &LevelInfo::_onLMActivate);
|
||||
if (!mAccuTextureAsset.isNull())
|
||||
if (!mAccuTextureAssetRef.isNull())
|
||||
{
|
||||
gLevelAccuMap.free();
|
||||
}
|
||||
|
|
@ -169,7 +169,8 @@ void LevelInfo::initPersistFields()
|
|||
//addField( "advancedLightmapSupport", TypeBool, Offset( mAdvancedLightmapSupport, LevelInfo ),
|
||||
// "Enable expanded support for mixing static and dynamic lighting (more costly)" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(AccuTexture, LevelInfo, "Accumulation texture.");
|
||||
ADD_FIELD("AccuTextureAsset", TypeImageAssetRef, Offset(mAccuTextureAssetRef, LevelInfo))
|
||||
.doc("Accumulation texture asset");
|
||||
|
||||
endGroup( "Lighting" );
|
||||
|
||||
|
|
@ -219,7 +220,7 @@ U32 LevelInfo::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
|
|||
sfxWrite( stream, mSoundAmbience );
|
||||
stream->writeInt( mSoundDistanceModel, 4 );
|
||||
|
||||
PACK_ASSET_REFACTOR(conn, AccuTexture);
|
||||
AssetDatabase.packUpdateAsset(conn, mask, stream, mAccuTextureAssetRef.assetId);
|
||||
|
||||
return retMask;
|
||||
}
|
||||
|
|
@ -268,7 +269,7 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream)
|
|||
SFX->setDistanceModel( mSoundDistanceModel );
|
||||
}
|
||||
|
||||
UNPACK_ASSET_REFACTOR(conn, AccuTexture);
|
||||
mAccuTextureAssetRef = AssetDatabase.unpackUpdateAsset(conn, stream);
|
||||
setLevelAccuTexture();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class LevelInfo : public NetObject
|
|||
void _onLMActivate(const char *lm, bool enable);
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(LevelInfo, AccuTexture, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mAccuTextureAssetRef;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -144,6 +144,8 @@ class LevelInfo : public NetObject
|
|||
U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream ) override;
|
||||
void unpackUpdate( NetConnection *conn, BitStream *stream ) override;
|
||||
void setLevelAccuTexture();
|
||||
|
||||
GFXTexHandle getAccuTexture() { return mAccuTextureAssetRef.notNull() ? mAccuTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ void LightFlareData::initPersistFields()
|
|||
addField( "flareEnabled", TypeBool, Offset( mFlareEnabled, LightFlareData ),
|
||||
"Allows the user to disable this flare globally for any lights referencing it." );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(FlareTexture, LightFlareData, "The texture / sprite sheet for this flare.");
|
||||
ADD_FIELD("flareTextureAsset", TypeImageAssetRef, Offset(mFlareTextureAssetRef, LightFlareData))
|
||||
.doc("The texture / sprite sheet asset for this flare.");
|
||||
|
||||
addArray( "Elements", MAX_ELEMENTS );
|
||||
|
||||
|
|
@ -218,7 +219,7 @@ void LightFlareData::packData( BitStream *stream )
|
|||
|
||||
stream->writeFlag( mFlareEnabled );
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(FlareTexture);
|
||||
AssetDatabase.packDataAsset(stream, mFlareTextureAssetRef.assetId);
|
||||
|
||||
stream->write( mScale );
|
||||
stream->write( mOcclusionRadius );
|
||||
|
|
@ -243,7 +244,7 @@ void LightFlareData::unpackData( BitStream *stream )
|
|||
|
||||
mFlareEnabled = stream->readFlag();
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(FlareTexture);
|
||||
mFlareTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
stream->read( &mScale );
|
||||
stream->read( &mOcclusionRadius );
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ public:
|
|||
void packData( BitStream *stream ) override;
|
||||
void unpackData( BitStream *stream ) override;
|
||||
|
||||
GFXTexHandle getFlareTexture() { return mFlareTextureAssetRef.notNull() ? mFlareTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
/// Submits render instances for corona and flare effects.
|
||||
void prepRender( SceneRenderState *state, LightFlareState *flareState );
|
||||
|
||||
|
|
@ -118,7 +120,7 @@ protected:
|
|||
F32 mScale;
|
||||
bool mFlareEnabled;
|
||||
|
||||
DECLARE_IMAGEASSET(LightFlareData, FlareTexture, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mFlareTextureAssetRef;
|
||||
|
||||
F32 mOcclusionRadius;
|
||||
bool mRenderReflectPass;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
|
|||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
color = other.color;
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
dimensions = other.dimensions;
|
||||
texCoords[0] = other.texCoords[0];
|
||||
texCoords[1] = other.texCoords[1];
|
||||
|
|
@ -95,7 +95,7 @@ void afxBillboardData::initPersistFields()
|
|||
"The color assigned to the quadrangle geometry. The way it combines with the given "
|
||||
"texture varies according to the setting of the textureFunction field.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxBillboardData, "An image to use as the billboard's texture.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxBillboardData), "An image asset to use as the billboard's texture.");
|
||||
|
||||
addField("dimensions", TypePoint2F, myOffset(dimensions),
|
||||
"A value-pair that specifies the horizontal and vertical dimensions of the billboard "
|
||||
|
|
@ -123,7 +123,7 @@ void afxBillboardData::packData(BitStream* stream)
|
|||
Parent::packData(stream);
|
||||
|
||||
stream->write(color);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
|
||||
mathWrite(*stream, dimensions);
|
||||
mathWrite(*stream, texCoords[0]);
|
||||
|
|
@ -140,7 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
|
|||
Parent::unpackData(stream);
|
||||
|
||||
stream->read(&color);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
mathRead(*stream, &dimensions);
|
||||
mathRead(*stream, &texCoords[0]);
|
||||
mathRead(*stream, &texCoords[1]);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#define _AFX_BILLBOARD_H_
|
||||
|
||||
#include "afx/afxEffectDefs.h"
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
#define BLEND_UNDEFINED GFXBlend_COUNT
|
||||
|
||||
|
|
@ -47,7 +48,9 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxBillboardData, Texture, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
|
||||
LinearColorF color;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ afxZodiacData::afxZodiacData()
|
|||
|
||||
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
vert_range = other.vert_range;
|
||||
|
|
@ -155,7 +155,7 @@ EndImplementEnumType;
|
|||
void afxZodiacData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxZodiacData), "An image asset to use as the zodiac's texture.");
|
||||
addField("radius", TypeF32, Offset(radius_xy, afxZodiacData),
|
||||
"The zodiac's radius in scene units.");
|
||||
addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData),
|
||||
|
|
@ -268,7 +268,7 @@ void afxZodiacData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
stream->write(radius_xy);
|
||||
stream->write(vert_range.x);
|
||||
stream->write(vert_range.y);
|
||||
|
|
@ -293,7 +293,7 @@ void afxZodiacData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&vert_range.x);
|
||||
stream->read(&vert_range.y);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#endif
|
||||
|
||||
#include "console/typeValidators.h"
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile);
|
||||
|
||||
|
|
@ -57,7 +58,9 @@ public:
|
|||
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&AFX_GFXZodiacTextureProfile) : NULL; }
|
||||
|
||||
F32 radius_xy;
|
||||
Point2F vert_range;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ afxZodiacPlaneData::afxZodiacPlaneData()
|
|||
afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone)
|
||||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
start_ang = other.start_ang;
|
||||
|
|
@ -110,7 +110,7 @@ EndImplementEnumType;
|
|||
void afxZodiacPlaneData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxZodiacPlaneData), "An image asset to use as the zodiac's texture.");
|
||||
|
||||
addFieldV("radius", TypeRangedF32, myOffset(radius_xy), &CommonValidators::PositiveFloat,
|
||||
"The zodiac's radius in scene units.");
|
||||
|
|
@ -164,7 +164,7 @@ void afxZodiacPlaneData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
|
||||
stream->write(radius_xy);
|
||||
stream->write(start_ang);
|
||||
|
|
@ -183,7 +183,7 @@ void afxZodiacPlaneData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&start_ang);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&AFX_GFXZodiacTextureProfile) : NULL; }
|
||||
|
||||
F32 radius_xy;
|
||||
F32 start_ang;
|
||||
|
|
|
|||
|
|
@ -181,7 +181,9 @@ void VolumetricFog::initPersistFields()
|
|||
endGroup("VolumetricFogData");
|
||||
|
||||
addGroup("VolumetricFogModulation");
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, VolumetricFog, "A texture which contains Fogdensity modulator in the red channel and color with 1-green channel. No texture disables modulation.");
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, VolumetricFog))
|
||||
.network(FogModulationMask)
|
||||
.doc("A texture which contains Fogdensity modulator in the red channel and color with 1-green channel. No texture disables modulation.");
|
||||
|
||||
addFieldV("tiles", TypeRangedF32, Offset(mTexTiles, VolumetricFog), &CommonValidators::PositiveFloat,
|
||||
"How many times the texture is mapped to the object.");
|
||||
|
|
@ -329,8 +331,8 @@ void VolumetricFog::handleResize(VolumetricFogRTManager *RTM, bool resize)
|
|||
|
||||
// load texture.
|
||||
getTexture();
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAsset->getTextureBitmapWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAsset->getTextureBitmapHeight() / height);
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAssetRef.assetPtr->getTextureBitmapWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAssetRef.assetPtr->getTextureBitmapHeight() / height);
|
||||
}
|
||||
|
||||
UpdateBuffers(0,true);
|
||||
|
|
@ -545,7 +547,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->write(mFogDensity);
|
||||
if (stream->writeFlag(mask & FogModulationMask))
|
||||
{
|
||||
PACK_ASSET_REFACTOR(con, Texture);
|
||||
AssetDatabase.packUpdateAsset(con, mask, stream, mTextureAssetRef.assetId);
|
||||
mTexTiles = mFabs(mTexTiles);
|
||||
stream->write(mTexTiles);
|
||||
stream->write(mStrength);
|
||||
|
|
@ -600,7 +602,7 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
MatrixF mat;
|
||||
VectorF scale;
|
||||
VectorF mOldScale = getScale();
|
||||
StringTableEntry oldTextureName = mTextureAsset.getAssetId();
|
||||
StringTableEntry oldTextureName = mTextureAssetRef.getAssetId();
|
||||
StringTableEntry oldShapeAsset = mShapeAssetRef.assetId;
|
||||
StringTableEntry oldShape = mShapeAssetRef.notNull() ? mShapeAssetRef.assetPtr->getShapeFile() : StringTable->EmptyString();
|
||||
|
||||
|
|
@ -618,7 +620,7 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
}
|
||||
if (stream->readFlag())// Fog Modulation
|
||||
{
|
||||
UNPACK_ASSET_REFACTOR(con, Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackUpdateAsset(con, stream);
|
||||
stream->read(&mTexTiles);
|
||||
mTexTiles = mFabs(mTexTiles);
|
||||
stream->read(&mStrength);
|
||||
|
|
@ -628,9 +630,9 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
if (isProperlyAdded())
|
||||
{
|
||||
if (oldTextureName != mTextureAsset.getAssetId())
|
||||
if (oldTextureName != mTextureAssetRef.getAssetId())
|
||||
InitTexture();
|
||||
if (oldTextureName != StringTable->EmptyString() && mTextureAsset.isNull())
|
||||
if (oldTextureName != StringTable->EmptyString() && mTextureAssetRef.isNull())
|
||||
{
|
||||
mIsTextured = false;
|
||||
}
|
||||
|
|
@ -1219,21 +1221,24 @@ void VolumetricFog::InitTexture()
|
|||
{
|
||||
mIsTextured = false;
|
||||
|
||||
U32 assetStatus = ImageAsset::getAssetErrCode(mTextureAsset);
|
||||
if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!mTextureAsset.isNull())
|
||||
if (!mTextureAssetRef.isNull())
|
||||
{
|
||||
mTextureAssetRef.assetPtr->load();
|
||||
|
||||
U32 assetStatus = ImageAsset::getAssetErrCode(mTextureAssetRef.assetPtr);
|
||||
if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mIsTextured = true;
|
||||
// load asset.
|
||||
getTexture();
|
||||
F32 width = (F32)mPlatformWindow->getClientExtent().x;
|
||||
F32 height = (F32)mPlatformWindow->getClientExtent().y;
|
||||
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAsset->getTextureBitmapWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAsset->getTextureBitmapHeight() / height);
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAssetRef.assetPtr->getTextureBitmapWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAssetRef.assetPtr->getTextureBitmapHeight() / height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@
|
|||
#endif
|
||||
#ifndef SHAPEASSET_H
|
||||
#include "T3D/assets/ShapeAsset.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
class VolumetricFogRTManager;
|
||||
|
||||
|
|
@ -161,7 +162,9 @@ class VolumetricFog : public SceneObject
|
|||
F32 mInvScale;
|
||||
|
||||
// Fog Modulation data
|
||||
DECLARE_IMAGEASSET_NET(VolumetricFog, Texture, GFXStaticTextureSRGBProfile, FogModulationMask)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
bool mIsTextured;
|
||||
F32 mTexTiles;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ void BasicClouds::initPersistFields()
|
|||
addField( "layerEnabled", TypeBool, Offset( mLayerEnabled, BasicClouds ), TEX_COUNT,
|
||||
"Enable or disable rendering of this layer." );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, TEX_COUNT, BasicClouds, "Texture for this layer.");
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, BasicClouds))
|
||||
.elements(TEX_COUNT)
|
||||
.doc("Texture asset for this layer.");
|
||||
|
||||
addFieldV( "texScale", TypeRangedF32, Offset( mTexScale, BasicClouds ), &CommonValidators::PositiveFloat, TEX_COUNT,
|
||||
"Texture repeat for this layer." );
|
||||
|
|
@ -212,10 +214,10 @@ U32 BasicClouds::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
|
|||
{
|
||||
U32 retMask = Parent::packUpdate( conn, mask, stream );
|
||||
|
||||
PACK_ASSET_ARRAY_REFACTOR(conn, Texture, TEX_COUNT)
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
AssetDatabase.packUpdateAsset( conn, mask, stream, mTextureAssetRef[i].assetId );
|
||||
|
||||
stream->writeFlag( mLayerEnabled[i] );
|
||||
stream->write( mTexScale[i] );
|
||||
mathWrite( *stream, mTexDirection[i] );
|
||||
|
|
@ -232,10 +234,10 @@ void BasicClouds::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
{
|
||||
Parent::unpackUpdate( conn, stream );
|
||||
|
||||
UNPACK_ASSET_ARRAY_REFACTOR(conn, Texture, TEX_COUNT)
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
mTextureAssetRef[i] = AssetDatabase.unpackUpdateAsset( conn, stream );
|
||||
|
||||
mLayerEnabled[i] = stream->readFlag();
|
||||
stream->read( &mTexScale[i] );
|
||||
mathRead( *stream, &mTexDirection[i] );
|
||||
|
|
@ -310,14 +312,14 @@ void BasicClouds::renderObject( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
if ( !mLayerEnabled[i] || mTextureAsset[i].isNull())
|
||||
if ( !mLayerEnabled[i] || mTextureAssetRef[i].isNull())
|
||||
continue;
|
||||
|
||||
mShaderConsts->setSafe( mTexScaleSC, mTexScale[i] );
|
||||
mShaderConsts->setSafe( mTexDirectionSC, mTexDirection[i] * mTexSpeed[i] );
|
||||
mShaderConsts->setSafe( mTexOffsetSC, mTexOffset[i] );
|
||||
mShaderConsts->setSafe( mTexOffsetSC, mTexOffset[i] );
|
||||
|
||||
GFX->setTexture( mDiffuseMapSC->getSamplerRegister(), getTexture(i) );
|
||||
GFX->setTexture( mDiffuseMapSC->getSamplerRegister(), getTexture(i) );
|
||||
GFX->setVertexBuffer( mVB[i] );
|
||||
|
||||
GFX->drawIndexedPrimitive( GFXTriangleList, 0, 0, smVertCount, 0, smTriangleCount );
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ protected:
|
|||
static U32 smVertCount;
|
||||
static U32 smTriangleCount;
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY_NET(BasicClouds, Texture, GFXStaticTextureSRGBProfile, TEX_COUNT, -1)
|
||||
AssetRef<ImageAsset> mTextureAssetRef[TEX_COUNT];
|
||||
GFXTexHandle getTexture(const U32& index) { return mTextureAssetRef[index].notNull() ? mTextureAssetRef[index].assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : GFXTexHandle(); }
|
||||
|
||||
GFXStateBlockRef mStateblock;
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,9 @@ void CloudLayer::initPersistFields()
|
|||
docsURL;
|
||||
addGroup( "CloudLayer" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, CloudLayer, "An RGBA texture which should contain normals and opacity (density).")
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, CloudLayer))
|
||||
.network(CloudLayerMask)
|
||||
.doc("An RGBA texture asset which should contain normals and opacity (density).");
|
||||
|
||||
addArray( "Textures", TEX_COUNT );
|
||||
|
||||
|
|
@ -239,10 +241,8 @@ U32 CloudLayer::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
|
|||
{
|
||||
U32 retMask = Parent::packUpdate( conn, mask, stream );
|
||||
|
||||
if (stream->writeFlag(getTexture())) {
|
||||
NetStringHandle assetIdStr = mTextureAsset.getAssetId(); conn->packNetStringHandleU(stream, assetIdStr);
|
||||
}
|
||||
|
||||
AssetDatabase.packUpdateAsset(conn, mask, stream, mTextureAssetRef.assetId);
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
stream->write( mTexScale[i] );
|
||||
|
|
@ -263,9 +263,7 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
{
|
||||
Parent::unpackUpdate( conn, stream );
|
||||
|
||||
if (stream->readFlag()) {
|
||||
mTextureAsset.setAssetId(_getStringTable()->insert(conn->unpackNetStringHandleU(stream).getString()));
|
||||
}
|
||||
mTextureAssetRef = AssetDatabase.unpackUpdateAsset(conn, stream);
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
|
|
@ -331,7 +329,7 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
{
|
||||
GFXTransformSaver saver;
|
||||
|
||||
if (!mTextureAsset)
|
||||
if (mTextureAssetRef.isNull())
|
||||
return;
|
||||
|
||||
const Point3F &camPos = state->getCameraPosition();
|
||||
|
|
@ -382,7 +380,7 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
|
||||
mShaderConsts->setSafe( mExposureSC, mExposure );
|
||||
|
||||
GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), mTextureAsset->getTexture(&GFXStaticTextureSRGBProfile));
|
||||
GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile));
|
||||
GFX->setVertexBuffer( mVB );
|
||||
GFX->setPrimitiveBuffer( mPB );
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
DECLARE_IMAGEASSET_NET(CloudLayer,Texture, GFXStaticTextureSRGBProfile, CloudLayerMask)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
GFXShaderRef mShader;
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,9 @@ void WaterObject::initPersistFields()
|
|||
addFieldV( "overallWaveMagnitude", TypeRangedF32, Offset( mOverallWaveMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire body"
|
||||
" of water's undulation" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(RippleTex, WaterObject, "Normal map used to simulate small surface ripples");
|
||||
ADD_FIELD("rippleTexAsset", TypeImageAssetRef, Offset(mRippleTexAssetRef, WaterObject))
|
||||
.network(TextureMask)
|
||||
.doc("Normal map asset used to simulate small surface ripples");
|
||||
|
||||
addArray( "Ripples (texture animation)", MAX_WAVES );
|
||||
|
||||
|
|
@ -311,7 +313,9 @@ void WaterObject::initPersistFields()
|
|||
|
||||
addFieldV( "overallRippleMagnitude", TypeRangedF32, Offset( mOverallRippleMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire surface");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(FoamTex, WaterObject, "Diffuse texture for foam in shallow water (advanced lighting only)");
|
||||
ADD_FIELD("foamTexAsset", TypeImageAssetRef, Offset(mFoamTexAssetRef, WaterObject))
|
||||
.network(TextureMask)
|
||||
.doc("Diffuse texture asset for foam in shallow water");
|
||||
|
||||
addArray( "Foam", MAX_FOAM );
|
||||
|
||||
|
|
@ -363,7 +367,9 @@ void WaterObject::initPersistFields()
|
|||
|
||||
addGroup( "Misc" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(DepthGradientTex, WaterObject, "1D texture defining the base water color by depth");
|
||||
ADD_FIELD("depthGradientTexAsset", TypeImageAssetRef, Offset(mDepthGradientTexAssetRef, WaterObject))
|
||||
.network(TextureMask)
|
||||
.doc("1D texture asset defining the base water color by depth");
|
||||
|
||||
addFieldV( "depthGradientMax", TypeRangedF32, Offset( mDepthGradientMax, WaterObject ), &CommonValidators::PositiveFloat, "Depth in world units, the max range of the color gradient texture." );
|
||||
|
||||
|
|
@ -544,9 +550,9 @@ U32 WaterObject::packUpdate( NetConnection * conn, U32 mask, BitStream *stream )
|
|||
|
||||
if ( stream->writeFlag( mask & TextureMask ) )
|
||||
{
|
||||
PACK_ASSET_REFACTOR(conn, RippleTex);
|
||||
PACK_ASSET_REFACTOR(conn, DepthGradientTex);
|
||||
PACK_ASSET_REFACTOR(conn, FoamTex);
|
||||
AssetDatabase.packUpdateAsset(conn, mask, stream, mRippleTexAssetRef.assetId);
|
||||
AssetDatabase.packUpdateAsset(conn, mask, stream, mDepthGradientTexAssetRef.assetId);
|
||||
AssetDatabase.packUpdateAsset(conn, mask, stream, mFoamTexAssetRef.assetId);
|
||||
|
||||
stream->writeString( mCubemapName );
|
||||
}
|
||||
|
|
@ -666,9 +672,9 @@ void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream )
|
|||
// TextureMask
|
||||
if ( stream->readFlag() )
|
||||
{
|
||||
UNPACK_ASSET_REFACTOR(conn, RippleTex);
|
||||
UNPACK_ASSET_REFACTOR(conn, DepthGradientTex);
|
||||
UNPACK_ASSET_REFACTOR(conn, FoamTex);
|
||||
mRippleTexAssetRef = AssetDatabase.unpackUpdateAsset(conn, stream);
|
||||
mDepthGradientTexAssetRef = AssetDatabase.unpackUpdateAsset(conn, stream);
|
||||
mFoamTexAssetRef = AssetDatabase.unpackUpdateAsset(conn, stream);
|
||||
|
||||
mCubemapName = stream->readSTString();
|
||||
|
||||
|
|
|
|||
|
|
@ -269,9 +269,14 @@ protected:
|
|||
F32 mDepthGradientMax;
|
||||
|
||||
// Other textures
|
||||
DECLARE_IMAGEASSET_NET(WaterObject, RippleTex, GFXStaticTextureProfile, TextureMask)
|
||||
DECLARE_IMAGEASSET_NET(WaterObject, FoamTex, GFXStaticTextureSRGBProfile, TextureMask)
|
||||
DECLARE_IMAGEASSET_NET(WaterObject, DepthGradientTex, GFXStaticTextureSRGBProfile, TextureMask)
|
||||
AssetRef<ImageAsset> mRippleTexAssetRef;
|
||||
GFXTexHandle getRippleTex() { return mRippleTexAssetRef.notNull() ? mRippleTexAssetRef.assetPtr->getTexture(&GFXStaticTextureProfile) : NULL; }
|
||||
|
||||
AssetRef<ImageAsset> mFoamTexAssetRef;
|
||||
GFXTexHandle getFoamTex() { return mFoamTexAssetRef.notNull() ? mFoamTexAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
AssetRef<ImageAsset> mDepthGradientTexAssetRef;
|
||||
GFXTexHandle getDepthGradientTex() { return mDepthGradientTexAssetRef.notNull() ? mDepthGradientTexAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
StringTableEntry mCubemapName;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ CubemapData::CubemapData()
|
|||
|
||||
CubemapData::~CubemapData()
|
||||
{
|
||||
if (mCubeMapAsset.notNull())
|
||||
if (mCubeMapAssetRef.notNull())
|
||||
{
|
||||
mCubeMapAsset.clear();
|
||||
mCubeMapAssetRef.assetPtr.clear();
|
||||
}
|
||||
|
||||
if (mCubemap)
|
||||
|
|
@ -78,7 +78,9 @@ ConsoleDocClass( CubemapData,
|
|||
void CubemapData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(CubeMapFace, 6, CubemapData, "@brief The 6 cubemap face textures for a static cubemap.\n\n"
|
||||
ADD_FIELD("cubeMapFaceAsset", TypeImageAssetRef, Offset(mCubeMapFaceAssetRef, CubemapData))
|
||||
.elements(6)
|
||||
.doc("@brief The 6 cubemap face textures for a static cubemap.\n\n"
|
||||
"They are in the following order:\n"
|
||||
" - cubeFace[0] is -X\n"
|
||||
" - cubeFace[1] is +X\n"
|
||||
|
|
@ -87,7 +89,8 @@ void CubemapData::initPersistFields()
|
|||
" - cubeFace[4] is -Y\n"
|
||||
" - cubeFace[5] is +Y\n");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(CubeMap, CubemapData, "@brief Cubemap dds Image Asset.\n\n");
|
||||
ADD_FIELD("cubeMapAsset", TypeImageAssetRef, Offset(mCubeMapAssetRef, CubemapData))
|
||||
.doc("@brief Cubemap dds Image Asset.\n\n");
|
||||
}
|
||||
|
||||
bool CubemapData::onAdd()
|
||||
|
|
@ -107,20 +110,20 @@ void CubemapData::createMap()
|
|||
{
|
||||
bool initSuccess = true;
|
||||
//check mCubeMapFile first
|
||||
if (mCubeMapAsset.notNull())
|
||||
if (mCubeMapAssetRef.notNull())
|
||||
{
|
||||
mCubemap = mCubeMapAsset->getTexture(&GFXCubemapStaticTextureProfile);
|
||||
mCubemap = mCubeMapAssetRef.assetPtr->getTexture(&GFXCubemapStaticTextureProfile);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (U32 i = 0; i < 6; i++)
|
||||
{
|
||||
if (mCubeMapFaceAsset[i].notNull())
|
||||
if (mCubeMapFaceAssetRef[i].notNull())
|
||||
{
|
||||
if (!getCubeMapFace(i))
|
||||
{
|
||||
Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeMapFaceAsset[i]->getImageFile());
|
||||
Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeMapFaceAssetRef[i].assetPtr->getImageFile());
|
||||
initSuccess = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -133,7 +136,7 @@ void CubemapData::createMap()
|
|||
|
||||
if( initSuccess )
|
||||
{
|
||||
if (mCubeMapFaceAsset->isNull())
|
||||
if (mCubeMapFaceAssetRef[0].isNull())
|
||||
return;
|
||||
|
||||
mCubemap.set(mCubeMapFaceTex->getWidth(), mCubeMapFaceTex->getHeight(), mCubeMapFaceTex->getFormat(), &GFXCubemapStaticTextureProfile, "CubemapData-InitTexture", mCubeMapFaceTex->getPointer()->getMipLevels());
|
||||
|
|
@ -150,20 +153,20 @@ void CubemapData::updateFaces()
|
|||
bool initSuccess = true;
|
||||
|
||||
//check mCubeMapFile first
|
||||
if (mCubeMapAsset.notNull())
|
||||
if (mCubeMapAssetRef.notNull())
|
||||
{
|
||||
mCubemap = mCubeMapAsset->getTexture(&GFXCubemapStaticTextureProfile);
|
||||
mCubemap = mCubeMapAssetRef.assetPtr->getTexture(&GFXCubemapStaticTextureProfile);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (U32 i = 0; i < 6; i++)
|
||||
{
|
||||
if (mCubeMapFaceAsset[i].notNull())
|
||||
if (mCubeMapFaceAssetRef[i].notNull())
|
||||
{
|
||||
if (!getCubeMapFace(i))
|
||||
{
|
||||
Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeMapFaceAsset[i]->getImageFile());
|
||||
Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeMapFaceAssetRef[i].assetPtr->getImageFile());
|
||||
initSuccess = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -177,7 +180,7 @@ void CubemapData::updateFaces()
|
|||
if( initSuccess )
|
||||
{
|
||||
mCubemap = NULL;
|
||||
if (mCubeMapFaceAsset->isNull())
|
||||
if (mCubeMapFaceAssetRef[0].isNull())
|
||||
return;
|
||||
|
||||
mCubemap.set(mCubeMapFaceTex->getWidth(), mCubeMapFaceTex->getHeight(), GFXFormatR16G16B16A16F, &GFXCubemapStaticTextureProfile, "CubemapData-InitTexture", mCubeMapFaceTex->getFormat());
|
||||
|
|
@ -190,7 +193,32 @@ void CubemapData::updateFaces()
|
|||
|
||||
void CubemapData::setCubemapFile(FileName newCubemapFile)
|
||||
{
|
||||
_setCubeMap(newCubemapFile);
|
||||
StringTableEntry _in = StringTable->insert(newCubemapFile.c_str());
|
||||
|
||||
if (_in == StringTable->EmptyString())
|
||||
{
|
||||
mCubeMapAssetRef = StringTable->EmptyString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AssetDatabase.isDeclaredAsset(_in))
|
||||
{
|
||||
mCubeMapAssetRef = _in;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetQuery query;
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in);
|
||||
if (foundAssetcount != 0)
|
||||
{
|
||||
mCubeMapAssetRef = query.mAssetList[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
mCubeMapAssetRef.assetId = _in;
|
||||
mCubeMapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in); \
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CubemapData::setCubeFaceFile(U32 index, FileName newFaceFile)
|
||||
|
|
@ -198,7 +226,32 @@ void CubemapData::setCubeFaceFile(U32 index, FileName newFaceFile)
|
|||
if (index >= 6)
|
||||
return;
|
||||
|
||||
_setCubeMapFace(newFaceFile, index);
|
||||
StringTableEntry _in = StringTable->insert(newFaceFile.c_str());
|
||||
|
||||
if (_in == StringTable->EmptyString())
|
||||
{
|
||||
mCubeMapFaceAssetRef[index] = StringTable->EmptyString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AssetDatabase.isDeclaredAsset(_in))
|
||||
{
|
||||
mCubeMapFaceAssetRef[index] = _in;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetQuery query;
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in);
|
||||
if (foundAssetcount != 0)
|
||||
{
|
||||
mCubeMapFaceAssetRef[index] = query.mAssetList[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
mCubeMapFaceAssetRef[index].assetId = _in;
|
||||
mCubeMapFaceAssetRef[index].assetPtr = ImageAsset::getNamedTargetAssetPtr(_in); \
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CubemapData::setCubeFaceTexture(U32 index, GFXTexHandle newFaceTexture)
|
||||
|
|
|
|||
|
|
@ -73,9 +73,12 @@ public:
|
|||
GFXTexHandle* getCubeFaceTexture(U32 faceIdx) { return &mCubeMapFaceTex[faceIdx]; }
|
||||
|
||||
protected:
|
||||
DECLARE_IMAGEASSET(CubemapData, CubeMap, GFXStaticTextureSRGBProfile);
|
||||
AssetRef<ImageAsset> mCubeMapAssetRef;
|
||||
GFXTexHandle getCubeMap() { return mCubeMapAssetRef.notNull() ? mCubeMapAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, GFXStaticTextureSRGBProfile, 6);
|
||||
AssetRef<ImageAsset> mCubeMapFaceAssetRef[6];
|
||||
GFXTexHandle getCubeMapFace(const U32& index) { return mCubeMapFaceAssetRef[index].notNull() ? mCubeMapFaceAssetRef[index].assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : GFXTexHandle(); }
|
||||
AssetPtr<ImageAsset> getCubeMapFaceAsset(const U32& index) { return mCubeMapFaceAssetRef[index].assetPtr; }
|
||||
|
||||
GFXTexHandle mCubeMapFaceTex[6];
|
||||
GFXTexHandle mDepthBuff;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,22 @@ IMPLEMENT_CALLBACK( GuiBitmapButtonCtrl, onShiftClick, void, (), (),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiBitmapButtonCtrl::_setBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mBitmapAssetRef.assetId = _in;
|
||||
mBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
mBitmapAssetRef = _in;
|
||||
}
|
||||
}
|
||||
|
||||
GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
|
||||
{
|
||||
mBitmapMode = BitmapStretched;
|
||||
|
|
@ -129,10 +145,7 @@ GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
|
|||
setExtent( 140, 30 );
|
||||
mMasked = false;
|
||||
mColor = ColorI::WHITE;
|
||||
mBitmapName = StringTable->EmptyString();
|
||||
mBitmap = NULL;
|
||||
mBitmapAsset.registerRefreshNotify(this);
|
||||
mBitmapFile = String::EmptyString;
|
||||
mBitmapAssetRef.assetPtr.registerRefreshNotify(this);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -142,10 +155,11 @@ void GuiBitmapButtonCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addGroup( "Bitmap" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiBitmapButtonCtrl,"Texture file to display on this button.\n"
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiBitmapButtonCtrl))
|
||||
.doc("Texture asset to display on this button.\n"
|
||||
"If useStates is false, this will be the file that renders on the control. Otherwise, this will "
|
||||
"specify the default texture name to which the various state and modifier suffixes are appended "
|
||||
"to find the per-state and per-modifier (if enabled) textures.")
|
||||
"to find the per-state and per-modifier (if enabled) textures.");
|
||||
|
||||
addField("color", TypeColorI, Offset(mColor, GuiBitmapButtonCtrl), "color mul");
|
||||
|
||||
|
|
@ -183,7 +197,7 @@ bool GuiBitmapButtonCtrl::onWake()
|
|||
return false;
|
||||
|
||||
setActive( true );
|
||||
setBitmap( mBitmapName );
|
||||
setBitmap(mBitmapAssetRef.assetId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -192,17 +206,13 @@ bool GuiBitmapButtonCtrl::onWake()
|
|||
|
||||
void GuiBitmapButtonCtrl::onSleep()
|
||||
{
|
||||
if( dStricmp(mBitmapName, "texhandle") != 0 )
|
||||
for( U32 i = 0; i < NumModifiers; ++ i )
|
||||
{
|
||||
mTextures[ i ].mTextureNormal = NULL;
|
||||
mTextures[ i ].mTextureHilight = NULL;
|
||||
mTextures[ i ].mTextureDepressed = NULL;
|
||||
mTextures[ i ].mTextureInactive = NULL;
|
||||
}
|
||||
|
||||
if (mBitmapAsset.notNull())
|
||||
mBitmap = NULL;
|
||||
for( U32 i = 0; i < NumModifiers; ++ i )
|
||||
{
|
||||
mTextures[ i ].mTextureNormal = NULL;
|
||||
mTextures[ i ].mTextureHilight = NULL;
|
||||
mTextures[ i ].mTextureDepressed = NULL;
|
||||
mTextures[ i ].mTextureInactive = NULL;
|
||||
}
|
||||
|
||||
Parent::onSleep();
|
||||
}
|
||||
|
|
@ -241,7 +251,7 @@ void GuiBitmapButtonCtrl::inspectPostApply()
|
|||
{
|
||||
Parent::inspectPostApply();
|
||||
|
||||
setBitmap(mBitmapName);
|
||||
setBitmap(mBitmapAssetRef.assetId);
|
||||
|
||||
// if the extent is set to (0,0) in the gui editor and appy hit, this control will
|
||||
// set it's extent to be exactly the size of the normal bitmap (if present)
|
||||
|
|
@ -258,7 +268,7 @@ void GuiBitmapButtonCtrl::setAutoFitExtents( bool state )
|
|||
{
|
||||
mAutoFitExtents = state;
|
||||
if( mAutoFitExtents )
|
||||
setBitmap( mBitmapName );
|
||||
setBitmap(mBitmapAssetRef.assetId);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -271,143 +281,140 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
|||
if( !isAwake() )
|
||||
return;
|
||||
|
||||
if( mBitmapAsset.notNull())
|
||||
if( mBitmapAssetRef.notNull())
|
||||
{
|
||||
if( dStricmp( mBitmapName, "texhandle" ) != 0 )
|
||||
const U32 count = mUseModifiers ? NumModifiers : 1;
|
||||
for( U32 i = 0; i < count; ++ i )
|
||||
{
|
||||
const U32 count = mUseModifiers ? NumModifiers : 1;
|
||||
for( U32 i = 0; i < count; ++ i )
|
||||
static String modifiers[] =
|
||||
{
|
||||
static String modifiers[] =
|
||||
"",
|
||||
"_ctrl",
|
||||
"_alt",
|
||||
"_shift"
|
||||
};
|
||||
|
||||
static String s_n[2] = { "_n", "_n_image" };
|
||||
static String s_d[2] = { "_d", "_d_image" };
|
||||
static String s_h[2] = { "_h", "_h_image" };
|
||||
static String s_i[2] = { "_i", "_i_image" };
|
||||
|
||||
String baseName = mBitmapAssetRef.getAssetId();
|
||||
|
||||
//strip any pre-assigned suffix, just in case
|
||||
baseName = baseName.replace("_n_image", "");
|
||||
baseName = baseName.replace("_n", "");
|
||||
|
||||
if( mUseModifiers )
|
||||
baseName += modifiers[ i ];
|
||||
|
||||
mTextures[i].mTextureNormal = getBitmap();
|
||||
|
||||
if( mUseStates )
|
||||
{
|
||||
//normal lookup
|
||||
StringTableEntry lookupName;
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
"",
|
||||
"_ctrl",
|
||||
"_alt",
|
||||
"_shift"
|
||||
};
|
||||
|
||||
static String s_n[2] = { "_n", "_n_image" };
|
||||
static String s_d[2] = { "_d", "_d_image" };
|
||||
static String s_h[2] = { "_h", "_h_image" };
|
||||
static String s_i[2] = { "_i", "_i_image" };
|
||||
|
||||
String baseName = mBitmapAsset.getAssetId();
|
||||
|
||||
//strip any pre-assigned suffix, just in case
|
||||
baseName = baseName.replace("_n_image", "");
|
||||
baseName = baseName.replace("_n", "");
|
||||
|
||||
if( mUseModifiers )
|
||||
baseName += modifiers[ i ];
|
||||
|
||||
mTextures[i].mTextureNormal = getBitmap();
|
||||
|
||||
if( mUseStates )
|
||||
{
|
||||
//normal lookup
|
||||
StringTableEntry lookupName;
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
if (!mTextures[i].mTextureNormal)
|
||||
{
|
||||
if (!mTextures[i].mTextureNormal)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_n[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureNormalAssetId = lookupName;
|
||||
mTextures[i].mTextureNormalAsset = mTextures[i].mTextureNormalAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureNormalAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureNormalAsset->load();
|
||||
if (mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureNormal = mTextures[i].mTextureNormalAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Hilight lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_h[s]).c_str());
|
||||
lookupName = StringTable->insert(String(baseName + s_n[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureHilightAssetId = lookupName;
|
||||
mTextures[i].mTextureHilightAsset = mTextures[i].mTextureHilightAssetId;
|
||||
mTextures[i].mTextureNormalAssetId = lookupName;
|
||||
mTextures[i].mTextureNormalAsset = mTextures[i].mTextureNormalAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureHilightAsset.notNull())
|
||||
if (mTextures[i].mTextureNormalAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureHilightAsset->load();
|
||||
if (mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok)
|
||||
mTextures[i].mTextureNormalAsset->load();
|
||||
if (mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureHilight = mTextures[i].mTextureHilightAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
mTextures[i].mTextureNormal = mTextures[i].mTextureNormalAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureHilight )
|
||||
mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
|
||||
|
||||
//Depressed lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_d[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureDepressedAssetId = lookupName;
|
||||
mTextures[i].mTextureDepressedAsset = mTextures[i].mTextureDepressedAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureDepressedAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureDepressedAsset->load();
|
||||
if (mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureDepressed = mTextures[i].mTextureDepressedAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureDepressed )
|
||||
mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
|
||||
|
||||
//Depressed lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_i[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureInactiveAssetId = lookupName;
|
||||
mTextures[i].mTextureInactiveAsset = mTextures[i].mTextureInactiveAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureInactiveAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureInactiveAsset->load();
|
||||
if (mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureInactive = mTextures[i].mTextureInactiveAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureInactive )
|
||||
mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
|
||||
}
|
||||
|
||||
if( i == 0 && mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull() )
|
||||
//Hilight lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
Con::warnf( "GuiBitmapButtonCtrl::setBitmap - Unable to load texture: %s", mBitmapName );
|
||||
this->setBitmap( StringTable->insert(GFXTextureManager::getUnavailableTexturePath().c_str()) );
|
||||
return;
|
||||
lookupName = StringTable->insert(String(baseName + s_h[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureHilightAssetId = lookupName;
|
||||
mTextures[i].mTextureHilightAsset = mTextures[i].mTextureHilightAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureHilightAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureHilightAsset->load();
|
||||
if (mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureHilight = mTextures[i].mTextureHilightAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureHilight )
|
||||
mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
|
||||
|
||||
//Depressed lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_d[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureDepressedAssetId = lookupName;
|
||||
mTextures[i].mTextureDepressedAsset = mTextures[i].mTextureDepressedAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureDepressedAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureDepressedAsset->load();
|
||||
if (mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureDepressed = mTextures[i].mTextureDepressedAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureDepressed )
|
||||
mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
|
||||
|
||||
//Depressed lookup
|
||||
for (U32 s = 0; s < 2; s++)
|
||||
{
|
||||
lookupName = StringTable->insert(String(baseName + s_i[s]).c_str());
|
||||
if (AssetDatabase.isDeclaredAsset(lookupName))
|
||||
{
|
||||
mTextures[i].mTextureInactiveAssetId = lookupName;
|
||||
mTextures[i].mTextureInactiveAsset = mTextures[i].mTextureInactiveAssetId;
|
||||
}
|
||||
|
||||
if (mTextures[i].mTextureInactiveAsset.notNull())
|
||||
{
|
||||
mTextures[i].mTextureInactiveAsset->load();
|
||||
if (mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok)
|
||||
{
|
||||
mTextures[i].mTextureInactive = mTextures[i].mTextureInactiveAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !mTextures[ i ].mTextureInactive )
|
||||
mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
|
||||
}
|
||||
|
||||
if( i == 0 && mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull() )
|
||||
{
|
||||
Con::warnf( "GuiBitmapButtonCtrl::setBitmap - Unable to load texture: %s", mBitmapAssetRef.assetId);
|
||||
this->setBitmap( StringTable->insert(GFXTextureManager::getUnavailableTexturePath().c_str()) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -428,37 +435,6 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name )
|
|||
setUpdate();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiBitmapButtonCtrl::setBitmapHandles(GFXTexHandle normal, GFXTexHandle highlighted, GFXTexHandle depressed, GFXTexHandle inactive)
|
||||
{
|
||||
const U32 count = mUseModifiers ? NumModifiers : 1;
|
||||
for( U32 i = 0; i < count; ++ i )
|
||||
{
|
||||
mTextures[ i ].mTextureNormal = normal;
|
||||
mTextures[ i ].mTextureHilight = highlighted;
|
||||
mTextures[ i ].mTextureDepressed = depressed;
|
||||
mTextures[ i ].mTextureInactive = inactive;
|
||||
|
||||
if (!mTextures[ i ].mTextureHilight)
|
||||
mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal;
|
||||
if (!mTextures[ i ].mTextureDepressed)
|
||||
mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight;
|
||||
if (!mTextures[ i ].mTextureInactive)
|
||||
mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal;
|
||||
|
||||
if (mTextures[ i ].mTextureNormal.isNull() && mTextures[ i ].mTextureHilight.isNull() && mTextures[ i ].mTextureDepressed.isNull() && mTextures[ i ].mTextureInactive.isNull())
|
||||
{
|
||||
Con::warnf("GuiBitmapButtonCtrl::setBitmapHandles() - Invalid texture handles");
|
||||
setBitmap( StringTable->insert(GFXTextureManager::getUnavailableTexturePath().c_str()) );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mBitmapName = "texhandle";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
GuiBitmapButtonCtrl::Modifier GuiBitmapButtonCtrl::getCurrentModifier()
|
||||
|
|
@ -644,7 +620,7 @@ bool GuiBitmapButtonCtrl::pointInControl(const Point2I& parentCoordPoint)
|
|||
bmp = getTextureForCurrentState().getBitmap();
|
||||
if (!bmp)
|
||||
{
|
||||
setBitmap(mBitmapName);
|
||||
setBitmap(mBitmapAssetRef.assetId);
|
||||
bmp = getTextureForCurrentState().getBitmap();
|
||||
}
|
||||
|
||||
|
|
@ -669,10 +645,12 @@ bool GuiBitmapButtonCtrl::pointInControl(const Point2I& parentCoordPoint)
|
|||
return Parent::pointInControl(parentCoordPoint);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiBitmapButtonCtrl, getBitmap, StringTableEntry, (), , "get name") {
|
||||
return object->getBitmapFile();
|
||||
}DefineEngineMethod(GuiBitmapButtonCtrl, getBitmapAsset, StringTableEntry, (), , assetText(Bitmap, asset reference)) {
|
||||
return object->_getBitmap();
|
||||
}DefineEngineMethod(GuiBitmapButtonCtrl, setBitmap, void, (const char* assetName), , assetText(Bitmap, assignment.first tries asset then flat file.)) {
|
||||
DefineEngineMethod(GuiBitmapButtonCtrl, getBitmapAsset, StringTableEntry, (), , "Get the Bitmap asset reference.")
|
||||
{
|
||||
return object->getBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiBitmapButtonCtrl, setBitmap, void, (const char* assetName), , "Bitmap assignment. First tries asset then flat file.")
|
||||
{
|
||||
object->setBitmap(StringTable->insert(assetName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,46 +119,19 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl, protected AssetPtrCallback
|
|||
BitmapMode mBitmapMode;
|
||||
|
||||
private:
|
||||
AssetPtr<ImageAsset> mBitmapAsset;
|
||||
String mBitmapFile;
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
public:
|
||||
void _setBitmap(StringTableEntry _in) {
|
||||
if (_in == NULL || _in == StringTable->EmptyString() || _in[0] == '\0')
|
||||
{
|
||||
mBitmapAsset = NULL;
|
||||
mBitmapFile = "";
|
||||
return;
|
||||
}
|
||||
if (mBitmapAsset.getAssetId() == _in) return; if (!AssetDatabase.isDeclaredAsset(_in)) {
|
||||
StringTableEntry imageAssetId = ImageAsset::smNoImageAssetFallback; AssetQuery query; S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); if (foundAssetcount != 0) {
|
||||
imageAssetId = query.mAssetList[0];
|
||||
} mBitmapAsset = imageAssetId;
|
||||
}
|
||||
else {
|
||||
mBitmapAsset = _in;
|
||||
mBitmapName = _in;
|
||||
mBitmap = getBitmap();
|
||||
}
|
||||
}; inline StringTableEntry _getBitmap(void) const {
|
||||
return mBitmapAsset.getAssetId();
|
||||
} GFXTexHandle getBitmap() {
|
||||
return mBitmapAsset.notNull() ? mBitmapAsset->getTexture(&GFXDefaultGUIProfile) : 0;
|
||||
} AssetPtr<ImageAsset> getBitmapAsset(void) {
|
||||
return mBitmapAsset;
|
||||
} static bool _setBitmapData(void* obj, const char* index, const char* data) {
|
||||
static_cast<GuiBitmapButtonCtrl*>(obj)->_setBitmap(_getStringTable()->insert(data)); return false;
|
||||
}
|
||||
StringTableEntry getBitmapFile() { return mBitmapAsset.notNull() ? mBitmapAsset->getImageFile() : ""; }
|
||||
void _setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
protected:
|
||||
|
||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||
{
|
||||
setBitmap(mBitmapName);
|
||||
setBitmap(mBitmapAssetRef.assetId);
|
||||
}
|
||||
|
||||
GFXTexHandle mBitmap;
|
||||
StringTableEntry mBitmapName;
|
||||
/// alpha masking
|
||||
bool mMasked;
|
||||
|
||||
|
|
@ -202,7 +175,6 @@ protected:
|
|||
|
||||
void setAutoFitExtents( bool state );
|
||||
void setBitmap( StringTableEntry name );
|
||||
void setBitmapHandles( GFXTexHandle normal, GFXTexHandle highlighted, GFXTexHandle depressed, GFXTexHandle inactive );
|
||||
|
||||
//Parent methods
|
||||
bool onWake() override;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ void GuiIconButtonCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around the button.\n");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiIconButtonCtrl))
|
||||
.doc("Bitmap asset for the icon to display on the button.");
|
||||
|
||||
addField( "iconLocation", TYPEID< IconLocation >(), Offset( mIconLocation, GuiIconButtonCtrl ),"Where to place the icon on the control. Options are 0 (None), 1 (Left), 2 (Right), 3 (Center).\n");
|
||||
addField( "sizeIconToButton", TypeBool, Offset( mFitBitmapToButton, GuiIconButtonCtrl ),"If true, the icon will be scaled to be the same size as the button.\n");
|
||||
|
|
@ -200,6 +201,21 @@ bool GuiIconButtonCtrl::resize(const Point2I &newPosition, const Point2I &newExt
|
|||
return Parent::resize( newPosition, autoExtent );
|
||||
}
|
||||
|
||||
void GuiIconButtonCtrl::_setBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mBitmapAssetRef.assetId = _in;
|
||||
mBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiIconButtonCtrl::setBitmap(const char *name)
|
||||
{
|
||||
_setBitmap(name);
|
||||
|
|
@ -463,10 +479,12 @@ void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state)
|
|||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiIconButtonCtrl, getBitmap, StringTableEntry, (), , "get name") {
|
||||
return object->getBitmapFile();
|
||||
}DefineEngineMethod(GuiIconButtonCtrl, getBitmapAsset, StringTableEntry, (), , assetText(Bitmap, asset reference)) {
|
||||
return object->_getBitmap();
|
||||
}DefineEngineMethod(GuiIconButtonCtrl, setBitmap, void, (const char* assetName), , assetText(Bitmap, assignment.first tries asset then flat file.)) {
|
||||
DefineEngineMethod(GuiIconButtonCtrl, getBitmapAsset, StringTableEntry, (), , "Get the Bitmap asset reference.")
|
||||
{
|
||||
return object->getBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiIconButtonCtrl, setBitmap, void, (const char* assetName), , "Bitmap assignment. First tries asset then flat file.")
|
||||
{
|
||||
object->setBitmap(StringTable->insert(assetName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ private:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
S32 mIconLocation;
|
||||
S32 mTextLocation;
|
||||
|
|
@ -113,9 +113,27 @@ public:
|
|||
// Used to set the optional error bitmap
|
||||
void setErrorBitmap(const char *name);
|
||||
|
||||
void _setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void onRender(Point2I offset, const RectI &updateRect) override;
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
void setFitBitmapToButton(const bool& state) {
|
||||
mFitBitmapToButton = state;
|
||||
}
|
||||
bool getFitBitmapToButton() const {
|
||||
return mFitBitmapToButton;
|
||||
}
|
||||
|
||||
void setMakeIconSquare(const bool& state) {
|
||||
mMakeIconSquare = state;
|
||||
}
|
||||
bool getMakeIconSquare() const {
|
||||
return mMakeIconSquare;
|
||||
}
|
||||
};
|
||||
|
||||
typedef GuiIconButtonCtrl::TextLocation GuiIconButtonTextLocation;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,12 @@ GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
|
|||
void GuiToolboxButtonCtrl::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(NormalBitmap, GuiToolboxButtonCtrl, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(LoweredBitmap, GuiToolboxButtonCtrl, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(HoverBitmap, GuiToolboxButtonCtrl, "");
|
||||
ADD_FIELD("normalBitmapAsset", TypeImageAssetRef, Offset(mNormalBitmapAssetRef, GuiToolboxButtonCtrl))
|
||||
.doc("Bitmap asset to display when the button is in its normal state.");
|
||||
ADD_FIELD("loweredBitmapAsset", TypeImageAssetRef, Offset(mLoweredBitmapAssetRef, GuiToolboxButtonCtrl))
|
||||
.doc("Bitmap asset to display when the button is pressed.");
|
||||
ADD_FIELD("hoverBitmapAsset", TypeImageAssetRef, Offset(mHoverBitmapAssetRef, GuiToolboxButtonCtrl))
|
||||
.doc("Bitmap asset to display when the button is hovered.");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
|
@ -95,6 +98,52 @@ void GuiToolboxButtonCtrl::inspectPostApply()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::_setNormalBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mNormalBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mNormalBitmapAssetRef.assetId = _in;
|
||||
mNormalBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mNormalBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiToolboxButtonCtrl::_setLoweredBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mLoweredBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mLoweredBitmapAssetRef.assetId = _in;
|
||||
mLoweredBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mLoweredBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiToolboxButtonCtrl::_setHoverBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mHoverBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mHoverBitmapAssetRef.assetId = _in;
|
||||
mHoverBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mHoverBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
void GuiToolboxButtonCtrl::setNormalBitmap( StringTableEntry bitmapName )
|
||||
{
|
||||
|
|
@ -186,6 +235,32 @@ void GuiToolboxButtonCtrl::renderButton(GFXTexHandle texture, Point2I &offset, c
|
|||
}
|
||||
}
|
||||
|
||||
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, NormalBitmap)
|
||||
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, LoweredBitmap)
|
||||
DEF_ASSET_BINDS_REFACTOR(GuiToolboxButtonCtrl, HoverBitmap)
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, getNormalBitmapAsset, StringTableEntry, (), , "Get the Normal Bitmap asset reference.")
|
||||
{
|
||||
return object->getNormalBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, setNormalBitmap, void, (const char* assetName), , "Normal Bitmap assignment. First tries asset then flat file.")
|
||||
{
|
||||
object->setNormalBitmap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, getLoweredBitmapAsset, StringTableEntry, (), , "Get the Lowered Bitmap asset reference.")
|
||||
{
|
||||
return object->getLoweredBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, setLoweredBitmap, void, (const char* assetName), , "Lowered Bitmap assignment. First tries asset then flat file.")
|
||||
{
|
||||
object->setLoweredBitmap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, getHoverBitmapAsset, StringTableEntry, (), , "Get the Hover Bitmap asset reference.")
|
||||
{
|
||||
return object->getHoverBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiToolboxButtonCtrl, setHoverBitmap, void, (const char* assetName), , "Hover Bitmap assignment. First tries asset then flat file.")
|
||||
{
|
||||
object->setHoverBitmap(StringTable->insert(assetName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ private:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, GFXDefaultGUIProfile)
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, GFXDefaultGUIProfile)
|
||||
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mNormalBitmapAssetRef;
|
||||
AssetRef<ImageAsset> mLoweredBitmapAssetRef;
|
||||
AssetRef<ImageAsset> mHoverBitmapAssetRef;
|
||||
|
||||
void renderButton(GFXTexHandle texture, Point2I &offset, const RectI& updateRect);
|
||||
void renderStateRect( GFXTexHandle texture, const RectI& rect );
|
||||
|
|
@ -60,7 +60,19 @@ public:
|
|||
void setNormalBitmap( StringTableEntry bitmapName );
|
||||
void setLoweredBitmap( StringTableEntry bitmapName );
|
||||
void setHoverBitmap( StringTableEntry bitmapName );
|
||||
|
||||
|
||||
void _setNormalBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getNormalBitmapAssetId() const { return mNormalBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getNormalBitmap() { return mNormalBitmapAssetRef.notNull() ? mNormalBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void _setLoweredBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getLoweredBitmapAssetId() const { return mLoweredBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getLoweredBitmap() { return mLoweredBitmapAssetRef.notNull() ? mLoweredBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void _setHoverBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getHoverBitmapAssetId() const { return mHoverBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getHoverBitmap() { return mHoverBitmapAssetRef.notNull() ? mHoverBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
|
||||
void onRender(Point2I offset, const RectI &updateRect) override;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ void GuiBitmapCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addGroup("Bitmap");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiBitmapCtrl, "The bitmap to render in this BitmapCtrl.")
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiBitmapCtrl))
|
||||
.doc("The bitmap asset to render in this BitmapCtrl.");
|
||||
|
||||
addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl), "color mul");
|
||||
addField("wrap", TypeBool, Offset(mWrap, GuiBitmapCtrl), "If true, the bitmap is tiled inside the control rather than stretched to fit.");
|
||||
|
|
@ -127,6 +128,21 @@ void GuiBitmapCtrl::inspectPostApply()
|
|||
}
|
||||
}
|
||||
|
||||
void GuiBitmapCtrl::_setBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mBitmapAssetRef.assetId = _in;
|
||||
mBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiBitmapCtrl::setBitmap(const char* name, bool resize)
|
||||
{
|
||||
// coming in here we are probably getting a filename.
|
||||
|
|
@ -144,9 +160,9 @@ void GuiBitmapCtrl::setBitmap(const char* name, bool resize)
|
|||
_setBitmap(StringTable->EmptyString());
|
||||
}
|
||||
|
||||
if (mBitmapAsset.notNull())
|
||||
if (mBitmapAssetRef.notNull())
|
||||
{
|
||||
mBitmap = mBitmapAsset->getTexture(&GFXDefaultGUIProfile);
|
||||
mBitmap = mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile);
|
||||
|
||||
if (getBitmap() && resize)
|
||||
{
|
||||
|
|
@ -184,7 +200,7 @@ void GuiBitmapCtrl::updateSizing()
|
|||
|
||||
void GuiBitmapCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||
{
|
||||
if (mBitmap.isNull() && mBitmapAsset.notNull())
|
||||
if (mBitmap.isNull() && mBitmapAssetRef.notNull())
|
||||
mBitmap = getBitmap();
|
||||
|
||||
if (mBitmap)
|
||||
|
|
@ -309,8 +325,8 @@ void GuiBitmapCtrl::setValue(S32 x, S32 y)
|
|||
{
|
||||
if (getBitmap())
|
||||
{
|
||||
x += mBitmapAsset->getTextureBitmapWidth() / 2;
|
||||
y += mBitmapAsset->getTextureBitmapHeight() / 2;
|
||||
x += mBitmapAssetRef.assetPtr->getTextureBitmapWidth() / 2;
|
||||
y += mBitmapAssetRef.assetPtr->getTextureBitmapHeight() / 2;
|
||||
}
|
||||
while (x < 0)
|
||||
x += 256;
|
||||
|
|
@ -359,11 +375,11 @@ DefineEngineMethod(GuiBitmapCtrl, setBitmap, void, (const char* fileRoot, bool r
|
|||
object->setBitmap(filename, resize);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiBitmapCtrl, getBitmap, const char*, (), ,
|
||||
"Gets the current bitmap set for this control.\n\n"
|
||||
DefineEngineMethod(GuiBitmapCtrl, getBitmapAsset, const char*, (), ,
|
||||
"Gets the current asset Id of the bitmap set for this control.\n\n"
|
||||
"@hide")
|
||||
{
|
||||
return object->_getBitmap();
|
||||
return object->getBitmapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiBitmapCtrl, setNamedTexture, bool, (String namedtexture), ,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ protected:
|
|||
|
||||
/// Name of the bitmap file. If this is 'texhandle' the bitmap is not loaded
|
||||
/// from a file but rather set explicitly on the control.
|
||||
DECLARE_IMAGEASSET(GuiBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
Point2I mStartPoint;
|
||||
ColorI mColor;
|
||||
|
|
@ -74,6 +74,11 @@ public:
|
|||
void setBitmap(const char* name, bool resize = true);
|
||||
void setBitmapHandle(GFXTexHandle handle, bool resize = false);
|
||||
|
||||
void _setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getBitmapAsset() { return mBitmapAssetRef.assetPtr; }
|
||||
|
||||
void updateSizing();
|
||||
|
||||
void onRender(Point2I offset, const RectI& updateRect) override;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,51 @@ GuiGameSettingsCtrl::GuiGameSettingsCtrl() :
|
|||
mCallbackOnY = mCallbackOnA;
|
||||
}
|
||||
|
||||
void GuiGameSettingsCtrl::setKeybindBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mKeybindBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mKeybindBitmapAssetRef.assetId = _in;
|
||||
mKeybindBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mKeybindBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiGameSettingsCtrl::setPreviousBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mPreviousBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mPreviousBitmapAssetRef.assetId = _in;
|
||||
mPreviousBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mPreviousBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiGameSettingsCtrl::setNextBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mNextBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mNextBitmapAssetRef.assetId = _in;
|
||||
mNextBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mNextBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
GuiGameSettingsCtrl::~GuiGameSettingsCtrl()
|
||||
{
|
||||
mOptions.clear();
|
||||
|
|
@ -430,7 +475,7 @@ void GuiGameSettingsCtrl::setKeybindSetting(const char* label, const char* bitma
|
|||
{
|
||||
static StringTableEntry DELIM = StringTable->insert("\t", true);
|
||||
|
||||
_setKeybindBitmap(StringTable->insert(bitmapName));
|
||||
setKeybindBitmap(StringTable->insert(bitmapName));
|
||||
|
||||
//if(mBitmap != StringTable->EmptyString())
|
||||
// mBitmapTex.set(mBitmap, &GFXDefaultGUIProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
|
||||
|
|
@ -828,9 +873,12 @@ IMPLEMENT_CALLBACK(GuiGameSettingsCtrl, onAxisEvent, void, (const char* device,
|
|||
void GuiGameSettingsCtrl::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(KeybindBitmap, GuiGameSettingsCtrl, "Bitmap used to display the bound key for this keybind option.");
|
||||
INITPERSISTFIELD_IMAGEASSET(PreviousBitmap, GuiGameSettingsCtrl, "Bitmap used for the previous button when in list mode.");
|
||||
INITPERSISTFIELD_IMAGEASSET(NextBitmap, GuiGameSettingsCtrl, "Bitmap used for the next button when in list mode.");
|
||||
ADD_FIELD("keybindBitmapAsset", TypeImageAssetRef, Offset(mKeybindBitmapAssetRef, GuiGameSettingsCtrl))
|
||||
.doc("Bitmap asset used to display the bound key for this keybind option.");
|
||||
ADD_FIELD("previousBitmapAsset", TypeImageAssetRef, Offset(mPreviousBitmapAssetRef, GuiGameSettingsCtrl))
|
||||
.doc("Bitmap asset used for the previous button when in list mode.");
|
||||
ADD_FIELD("nextBitmapAsset", TypeImageAssetRef, Offset(mNextBitmapAssetRef, GuiGameSettingsCtrl))
|
||||
.doc("Bitmap asset used for the next button when in list mode.");
|
||||
|
||||
addFieldV("arrowSize", TypeRangedS32, Offset(mArrowSize, GuiGameSettingsCtrl), &CommonValidators::PositiveInt,
|
||||
"Size of the arrow buttons' extents");
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ protected:
|
|||
Point2F mRange; ///< When working as a slider, this sets our min/max range
|
||||
|
||||
//Keybind option
|
||||
DECLARE_IMAGEASSET(GuiGameSettingsCtrl, KeybindBitmap, GFXDefaultGUIProfile)
|
||||
DECLARE_IMAGEASSET(GuiGameSettingsCtrl, PreviousBitmap, GFXDefaultGUIProfile)
|
||||
DECLARE_IMAGEASSET(GuiGameSettingsCtrl, NextBitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mKeybindBitmapAssetRef;
|
||||
AssetRef<ImageAsset> mPreviousBitmapAssetRef;
|
||||
AssetRef<ImageAsset> mNextBitmapAssetRef;
|
||||
|
||||
S32 mArrowSize;
|
||||
S32 mColumnSplit; //Padding between the leftmost edge of the control, and the left side of the 'option'.
|
||||
|
|
@ -84,7 +84,19 @@ protected:
|
|||
bool mSelected;
|
||||
|
||||
public:
|
||||
/// Sets the control as selected . Only controls that are enabled can be selected.
|
||||
void setKeybindBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getKeybindBitmapAssetId() const { return mKeybindBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getKeybindBitmap() { return mKeybindBitmapAssetRef.notNull() ? mKeybindBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void setPreviousBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getPreviousBitmapAssetId() const { return mPreviousBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getPreviousBitmap() { return mPreviousBitmapAssetRef.notNull() ? mPreviousBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void setNextBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getNextBitmapAssetId() const { return mNextBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getNextBitmap() { return mNextBitmapAssetRef.notNull() ? mNextBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
/// Sets the control as selected . Only controls that are enabled can be selected.
|
||||
virtual void setSelected();
|
||||
|
||||
/// Determines if the specified control is enabled or disabled.
|
||||
|
|
|
|||
|
|
@ -299,7 +299,10 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
|
|||
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrl));
|
||||
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrl));
|
||||
|
||||
addProtectedField("BitmapAsset", TypeImageAssetPtr, Offset(mBitmapAsset, GuiPopUpMenuCtrl), _setBitmaps, &defaultProtectedGetFn, "@brief ""Bitmap"" ""asset \"\".");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiPopUpMenuCtrl))
|
||||
.elements(NumBitmapModes)
|
||||
.onSet(_setBitmaps)
|
||||
.doc("@brief ""Bitmap"" ""asset \"\".");
|
||||
|
||||
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrl));
|
||||
|
||||
|
|
@ -580,18 +583,18 @@ void GuiPopUpMenuCtrl::setBitmap( const char *name )
|
|||
|
||||
dStrcpy(p, "_n", pLen);
|
||||
|
||||
_setBitmap((StringTableEntry)buffer, Normal);
|
||||
setBitmap((StringTableEntry)buffer, Normal);
|
||||
|
||||
dStrcpy(p, "_d", pLen);
|
||||
_setBitmap((StringTableEntry)buffer, Depressed);
|
||||
setBitmap((StringTableEntry)buffer, Depressed);
|
||||
|
||||
if ( mBitmapAsset[Depressed].isNull() )
|
||||
mBitmapAsset[Depressed] = mBitmapAsset[Normal];
|
||||
if ( mBitmapAssetRef[Depressed].isNull() )
|
||||
mBitmapAssetRef[Depressed] = mBitmapAssetRef[Normal];
|
||||
}
|
||||
else
|
||||
{
|
||||
_setBitmap(StringTable->EmptyString(), Normal);
|
||||
_setBitmap(StringTable->EmptyString(), Depressed);
|
||||
setBitmap(StringTable->EmptyString(), Normal);
|
||||
setBitmap(StringTable->EmptyString(), Depressed);
|
||||
}
|
||||
setUpdate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,9 @@ protected:
|
|||
NumBitmapModes = 2
|
||||
};
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, GFXDefaultGUIProfile, NumBitmapModes)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef[NumBitmapModes];
|
||||
GFXTexHandle getBitmap(const U32& index) { return mBitmapAssetRef[index].notNull() ? mBitmapAssetRef[index].assetPtr->getTexture(&GFXDefaultGUIProfile) : GFXTexHandle(); }
|
||||
void setBitmap(StringTableEntry assetId, const U32& index) { mBitmapAssetRef[index] = assetId; }
|
||||
|
||||
Point2I mBitmapBounds; // Added
|
||||
S32 mIdMax;
|
||||
|
|
|
|||
|
|
@ -354,7 +354,10 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
|
|||
addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal");
|
||||
addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down");
|
||||
|
||||
addProtectedField("BitmapAsset", TypeImageAssetPtr, Offset(mBitmapAsset, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "@brief ""Bitmap"" ""asset \"Name of bitmap asset to use\".");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiPopUpMenuCtrlEx))
|
||||
.elements(NumBitmapModes)
|
||||
.onSet(_setBitmaps)
|
||||
.doc("@brief ""Bitmap"" ""asset \"Name of bitmap asset to use\".");
|
||||
|
||||
addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed");
|
||||
addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx),
|
||||
|
|
@ -807,18 +810,18 @@ void GuiPopUpMenuCtrlEx::setBitmap(const char *name)
|
|||
|
||||
dStrcpy(p, "_n", pLen);
|
||||
|
||||
_setBitmap((StringTableEntry)buffer, Normal);
|
||||
setBitmap((StringTableEntry)buffer, Normal);
|
||||
|
||||
dStrcpy(p, "_d", pLen);
|
||||
_setBitmap((StringTableEntry)buffer, Depressed);
|
||||
setBitmap((StringTableEntry)buffer, Depressed);
|
||||
|
||||
if (mBitmapAsset[Depressed].isNull())
|
||||
mBitmapAsset[Depressed] = mBitmapAsset[Normal];
|
||||
if (mBitmapAssetRef[Depressed].isNull())
|
||||
mBitmapAssetRef[Depressed] = mBitmapAssetRef[Normal];
|
||||
}
|
||||
else
|
||||
{
|
||||
_setBitmap(StringTable->EmptyString(), Normal);
|
||||
_setBitmap(StringTable->EmptyString(), Depressed);
|
||||
setBitmap(StringTable->EmptyString(), Normal);
|
||||
setBitmap(StringTable->EmptyString(), Depressed);
|
||||
}
|
||||
setUpdate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
|||
NumBitmapModes = 2
|
||||
};
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, GFXDefaultGUIProfile, NumBitmapModes)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef[NumBitmapModes];
|
||||
GFXTexHandle getBitmap(const U32& index) { return mBitmapAssetRef[index].notNull() ? mBitmapAssetRef[index].assetPtr->getTexture(&GFXDefaultGUIProfile) : GFXTexHandle(); }
|
||||
void setBitmap(StringTableEntry assetId, const U32& index) { mBitmapAssetRef[index] = assetId; }
|
||||
|
||||
Point2I mBitmapBounds; // Added
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ void GuiCursor::initPersistFields()
|
|||
addField("hotSpot", TypePoint2I, Offset(mHotSpot, GuiCursor), "The location of the cursor's hot spot (which pixel carries the click).");
|
||||
addField("renderOffset",TypePoint2F, Offset(mRenderOffset, GuiCursor), "Offset of the bitmap, where 0 signifies left edge of the bitmap, 1, the right. Similarly for the Y-component.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiCursor, "name of the bitmap for the cursor.");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiCursor))
|
||||
.doc("Bitmap asset for the cursor.");
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
@ -187,39 +188,44 @@ void GuiControlProfile::setBitmapHandle(GFXTexHandle handle)
|
|||
mBitmapName = "texhandle";
|
||||
}
|
||||
|
||||
bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, const char *data )
|
||||
bool GuiControlProfile::_setBitmap( void *object, const char *index, const char *data )
|
||||
{
|
||||
GuiControlProfile *profile = static_cast<GuiControlProfile*>( object );
|
||||
|
||||
profile->_setBitmap(StringTable->insert(data));
|
||||
profile->setBitmap(StringTable->insert(data));
|
||||
|
||||
if ( !profile->isProperlyAdded() )
|
||||
return true;
|
||||
|
||||
if( profile->mLoadCount > 0 )
|
||||
{
|
||||
profile->mBitmapArrayRects.clear();
|
||||
profile->mBitmap = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profile->mBitmapName != StringTable->EmptyString())
|
||||
void GuiControlProfile::setBitmap(StringTableEntry _in)
|
||||
{
|
||||
mBitmapAssetRef = _in;
|
||||
|
||||
if( mLoadCount > 0 )
|
||||
{
|
||||
mBitmapArrayRects.clear();
|
||||
mBitmap = NULL;
|
||||
|
||||
if (mBitmapName != StringTable->EmptyString())
|
||||
{
|
||||
if (profile->mBitmapAsset.notNull() && profile->mBitmapName != StringTable->insert("texHandle"))
|
||||
if (mBitmapAssetRef.notNull() && mBitmapName != StringTable->insert("texHandle"))
|
||||
{
|
||||
profile->mBitmap = profile->getBitmap();
|
||||
profile->mBitmapName = profile->mBitmapAsset->getImageFile();
|
||||
mBitmap = getBitmap();
|
||||
mBitmapName = mBitmapAssetRef.assetPtr->getImageFile();
|
||||
}
|
||||
|
||||
//verify the bitmap
|
||||
if (!profile->mBitmap)
|
||||
Con::errorf("(%s) - Failed to load profile bitmap (%s)", profile->getName(), profile->getBitmapAsset().getAssetId());
|
||||
if (!mBitmap)
|
||||
Con::errorf("(%s) - Failed to load profile bitmap (%s)", getName(), getBitmapAsset().getAssetId());
|
||||
|
||||
// If we've got a special border, make sure it's usable.
|
||||
//if( profile->mBorder == -1 || profile->mBorder == -2 )
|
||||
profile->constructBitmapArray();
|
||||
//if( mBorder == -1 || mBorder == -2 )
|
||||
constructBitmapArray();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GuiControlProfile::GuiControlProfile(void) :
|
||||
|
|
@ -436,19 +442,10 @@ void GuiControlProfile::initPersistFields()
|
|||
endGroup( "Text" );
|
||||
|
||||
addGroup( "Misc" );
|
||||
#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS
|
||||
addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiControlProfile),
|
||||
&GuiControlProfile::protectedSetBitmap, &defaultProtectedGetFn,
|
||||
"Texture to use for rendering control.");
|
||||
#else
|
||||
addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiControlProfile),
|
||||
&GuiControlProfile::protectedSetBitmap, &defaultProtectedGetFn,
|
||||
"Texture to use for rendering control.", AbstractClassRep::FIELD_HideInInspectors);
|
||||
#endif
|
||||
|
||||
addProtectedField("bitmapAsset", TypeImageAssetPtr, Offset(mBitmapAsset, GuiControlProfile),
|
||||
&GuiControlProfile::protectedSetBitmap, &defaultProtectedGetFn,
|
||||
"Texture to use for rendering control.");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiControlProfile))
|
||||
.onSet(_setBitmap)
|
||||
.doc("Texture to use for rendering control.");
|
||||
|
||||
addField("hasBitmapArray", TypeBool, Offset(mUseBitmapArray, GuiControlProfile),
|
||||
"If true, 'bitmap' is an array of images." );
|
||||
|
|
@ -554,12 +551,12 @@ S32 GuiControlProfile::constructBitmapArray()
|
|||
|
||||
if( mBitmap.isNull() )
|
||||
{
|
||||
if (mBitmapAsset.notNull() && mBitmapName != StringTable->insert("texhandle"))
|
||||
if (mBitmapAssetRef.notNull() && mBitmapName != StringTable->insert("texhandle"))
|
||||
{
|
||||
mBitmap = getBitmap();
|
||||
}
|
||||
|
||||
if (mBitmapAsset.isNull() || mBitmap.isNull())
|
||||
if (mBitmapAssetRef.isNull() || mBitmap.isNull())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -645,7 +642,7 @@ void GuiControlProfile::incLoadCount()
|
|||
if( mFont == NULL )
|
||||
loadFont();
|
||||
|
||||
if (mBitmapAsset.notNull() && mBitmapName != StringTable->insert("texHandle"))
|
||||
if (mBitmapAssetRef.notNull() && mBitmapName != StringTable->insert("texHandle"))
|
||||
{
|
||||
mBitmap = getBitmap();
|
||||
|
||||
|
|
@ -713,7 +710,7 @@ DefineEngineMethod(GuiControlProfile, getBitmapAsset, const char*, (), , "")
|
|||
}
|
||||
DefineEngineMethod(GuiControlProfile, setBitmap, void, (const char* map), , "")
|
||||
{
|
||||
object->_setBitmap(StringTable->insert(map));
|
||||
object->setBitmap(StringTable->insert(map));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ class GuiCursor : public SimObject
|
|||
private:
|
||||
typedef SimObject Parent;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiCursor, Bitmap, GFXGuiCursorProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
Point2I mHotSpot;
|
||||
Point2F mRenderOffset;
|
||||
|
|
@ -358,6 +358,10 @@ public:
|
|||
Point2I getHotSpot() { return mHotSpot; }
|
||||
Point2I getExtent() { return mExtent; }
|
||||
|
||||
void setBitmap(StringTableEntry _in) { mBitmapAssetRef = _in; }
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXGuiCursorProfile) : NULL; }
|
||||
|
||||
DECLARE_CONOBJECT(GuiCursor);
|
||||
GuiCursor(void);
|
||||
~GuiCursor(void);
|
||||
|
|
@ -458,7 +462,13 @@ public:
|
|||
///
|
||||
public:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiControlProfile, Bitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
void setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getBitmapAsset() { return mBitmapAssetRef.assetPtr; }
|
||||
StringTableEntry getBitmapFile() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getImageFile() : ""; }
|
||||
|
||||
GFXTexHandle mBitmap;
|
||||
StringTableEntry mBitmapName;
|
||||
|
|
@ -488,7 +498,7 @@ public:
|
|||
protected:
|
||||
GuiControlProfile* mChildrenProfile; ///< Profile used with children controls (such as the scroll bar on a popup menu) when defined.
|
||||
|
||||
static bool protectedSetBitmap( void *object, const char *index, const char *data );
|
||||
static bool _setBitmap( void *object, const char *index, const char *data );
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(GuiControlProfile);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ void GuiChunkedBitmapCtrl::initPersistFields()
|
|||
{
|
||||
docsURL;
|
||||
addGroup("GuiChunkedBitmapCtrl");
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiChunkedBitmapCtrl, "This is the bitmap to render to the control.");
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiChunkedBitmapCtrl))
|
||||
.doc("This is the bitmap asset to render to the control.");
|
||||
|
||||
addField( "useVariable", TypeBool, Offset( mUseVariable, GuiChunkedBitmapCtrl ), "This decides whether to use the \"bitmap\" file "
|
||||
"or a bitmap stored in \"variable\"");
|
||||
|
|
@ -92,6 +93,21 @@ GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl()
|
|||
mTile = false;
|
||||
}
|
||||
|
||||
void GuiChunkedBitmapCtrl::_setBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mBitmapAssetRef.assetId = _in;
|
||||
mBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiChunkedBitmapCtrl::setBitmap(const char *name)
|
||||
{
|
||||
bool awake = mAwake;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ private:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiChunkedBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
|
|
@ -36,5 +36,9 @@ public:
|
|||
|
||||
void setBitmap(const char *name);
|
||||
|
||||
void _setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
void onRender(Point2I offset, const RectI &updateRect) override;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -131,15 +131,31 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
|
|||
void GuiProgressBitmapCtrl::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiProgressBitmapCtrl, "Bitmap file to use for rendering the progress bar.\n\n"
|
||||
ADD_FIELD("bitmapAsset", TypeImageAssetRef, Offset(mBitmapAssetRef, GuiProgressBitmapCtrl))
|
||||
.doc("Bitmap asset to use for rendering the progress bar.\n\n"
|
||||
"If the profile assigned to the control already has a bitmap assigned, this property need not be "
|
||||
"set in which case the bitmap from the profile is used.");
|
||||
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiProgressBitmapCtrl::_setBitmap(StringTableEntry _in)
|
||||
{
|
||||
if (mBitmapAssetRef.assetId == _in)
|
||||
return;
|
||||
|
||||
if (ImageAsset::isNamedTarget(_in))
|
||||
{
|
||||
mBitmapAssetRef.assetId = _in;
|
||||
mBitmapAssetRef.assetPtr = ImageAsset::getNamedTargetAssetPtr(_in);
|
||||
return;
|
||||
}
|
||||
|
||||
mBitmapAssetRef = _in;
|
||||
}
|
||||
|
||||
void GuiProgressBitmapCtrl::setBitmap( const char* name )
|
||||
{
|
||||
bool awake = mAwake;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class GuiProgressBitmapCtrl : public GuiTextCtrl
|
|||
|
||||
F32 mProgress;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiProgressBitmapCtrl, Bitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mBitmapAssetRef;
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
|
|
@ -59,6 +59,10 @@ class GuiProgressBitmapCtrl : public GuiTextCtrl
|
|||
GuiProgressBitmapCtrl();
|
||||
|
||||
void setBitmap( const char* name );
|
||||
|
||||
void _setBitmap(StringTableEntry _in);
|
||||
inline StringTableEntry getBitmapAssetId() const { return mBitmapAssetRef.getAssetId(); }
|
||||
GFXTexHandle getBitmap() { return mBitmapAssetRef.notNull() ? mBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
|
||||
//console related methods
|
||||
const char *getScriptValue() override;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ void GuiMissionAreaCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addField( "squareBitmap", TypeBool, Offset(mSquareBitmap, GuiMissionAreaCtrl));
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
|
||||
ADD_FIELD("handleBitmapAsset", TypeImageAssetRef, Offset(mHandleBitmapAssetRef, GuiMissionAreaCtrl))
|
||||
.doc("Bitmap asset for the mission area handles.\n");
|
||||
|
||||
addField( "missionBoundsColor", TypeColorI, Offset(mMissionBoundsColor, GuiMissionAreaCtrl));
|
||||
addField( "cameraColor", TypeColorI, Offset(mCameraColor, GuiMissionAreaCtrl));
|
||||
|
|
@ -122,7 +123,7 @@ bool GuiMissionAreaCtrl::onAdd()
|
|||
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
||||
mBlendStateBlock = GFX->createStateBlock( desc );
|
||||
|
||||
if (!mHandleBitmapAsset.isNull())
|
||||
if (mHandleBitmapAssetRef.notNull())
|
||||
{
|
||||
mHandleTextureSize = Point2I(getHandleBitmap()->getWidth(), getHandleBitmap()->getHeight());
|
||||
mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ protected:
|
|||
GFXTextureTargetRef mLevelTexture;
|
||||
Box3F mLevelBounds;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, GFXDefaultGUIProfile)
|
||||
AssetRef<ImageAsset> mHandleBitmapAssetRef;
|
||||
|
||||
Point2I mHandleTextureSize;
|
||||
Point2F mHandleTextureHalfSize;
|
||||
|
|
@ -112,6 +112,9 @@ public:
|
|||
|
||||
DECLARE_CONOBJECT(GuiMissionAreaCtrl);
|
||||
|
||||
GFXTexHandle getHandleBitmap() { return mHandleBitmapAssetRef.notNull() ? mHandleBitmapAssetRef.assetPtr->getTexture(&GFXDefaultGUIProfile) : NULL; }
|
||||
StringTableEntry getHandleBitmapFile() { return mHandleBitmapAssetRef.notNull() ? mHandleBitmapAssetRef.assetPtr->getImageFile() : ""; }
|
||||
|
||||
// SimObject
|
||||
bool onAdd() override;
|
||||
static void initPersistFields();
|
||||
|
|
|
|||
|
|
@ -1817,9 +1817,9 @@ WorldEditor::WorldEditor()
|
|||
mPopupBackgroundColor.set(100,100,100);
|
||||
mPopupTextColor.set(255,255,0);
|
||||
|
||||
mSelectHandleAsset = StringTable->insert("ToolsModule:SelectHandle_image");
|
||||
mDefaultHandleAsset = StringTable->insert("ToolsModule:DefaultHandle_image");
|
||||
mLockedHandleAsset = StringTable->insert("ToolsModule:LockedHandle_image");
|
||||
mSelectHandleAssetRef = StringTable->insert("ToolsModule:SelectHandle_image");
|
||||
mDefaultHandleAssetRef = StringTable->insert("ToolsModule:DefaultHandle_image");
|
||||
mLockedHandleAssetRef = StringTable->insert("ToolsModule:LockedHandle_image");
|
||||
|
||||
mObjectTextColor.set(255,255,255);
|
||||
mObjectsUseBoxCenter = true;
|
||||
|
|
@ -2839,9 +2839,12 @@ void WorldEditor::initPersistFields()
|
|||
addField( "renderObjHandle", TypeBool, Offset(mRenderObjHandle, WorldEditor) );
|
||||
addField( "renderSelectionBox", TypeBool, Offset(mRenderSelectionBox, WorldEditor) );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(SelectHandle, WorldEditor, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(DefaultHandle, WorldEditor, "");
|
||||
INITPERSISTFIELD_IMAGEASSET(LockedHandle, WorldEditor, "");
|
||||
ADD_FIELD("selectHandleAsset", TypeImageAssetRef, Offset(mSelectHandleAssetRef, WorldEditor))
|
||||
.doc("Bitmap asset used for the selection handle.");
|
||||
ADD_FIELD("defaultHandleAsset", TypeImageAssetRef, Offset(mDefaultHandleAssetRef, WorldEditor))
|
||||
.doc("Bitmap asset used for the default handle.");
|
||||
ADD_FIELD("lockedHandleAsset", TypeImageAssetRef, Offset(mLockedHandleAssetRef, WorldEditor))
|
||||
.doc("Bitmap asset used for the locked handle.");
|
||||
|
||||
endGroup( "Rendering" );
|
||||
|
||||
|
|
|
|||
|
|
@ -328,9 +328,14 @@ class WorldEditor : public EditTSCtrl
|
|||
ColorI mPopupBackgroundColor;
|
||||
ColorI mPopupTextColor;
|
||||
|
||||
DECLARE_IMAGEASSET(WorldEditor, SelectHandle, GFXStaticTextureSRGBProfile)
|
||||
DECLARE_IMAGEASSET(WorldEditor, DefaultHandle, GFXStaticTextureSRGBProfile)
|
||||
DECLARE_IMAGEASSET(WorldEditor, LockedHandle, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mSelectHandleAssetRef;
|
||||
GFXTexHandle getSelectHandle() { return mSelectHandleAssetRef.notNull() ? mSelectHandleAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
AssetRef<ImageAsset> mDefaultHandleAssetRef;
|
||||
GFXTexHandle getDefaultHandle() { return mDefaultHandleAssetRef.notNull() ? mDefaultHandleAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
AssetRef<ImageAsset> mLockedHandleAssetRef;
|
||||
GFXTexHandle getLockedHandle() { return mLockedHandleAssetRef.notNull() ? mLockedHandleAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
ColorI mObjectTextColor;
|
||||
bool mObjectsUseBoxCenter;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -556,8 +556,15 @@ void PostEffect::initPersistFields()
|
|||
addField( "targetViewport", TYPEID< PFXTargetViewport >(), Offset( mTargetViewport, PostEffect ),
|
||||
"Specifies how the viewport should be set up for a target texture." );
|
||||
|
||||
addProtectedField("Texture", TypeImageFilename, Offset(mTextureAsset, PostEffect), _setTextureData, &defaultProtectedGetFn, NumTextures, "Input textures to this effect(samplers).\n", AbstractClassRep::FIELD_HideInInspectors);
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NumTextures, PostEffect, "Input textures to this effect ( samplers ).\n"
|
||||
ADD_FIELD("texture", TypeImageAssetRef, Offset(mTextureAssetRef, PostEffect))
|
||||
.elements(NumTextures)
|
||||
.withFlags(AbstractClassRep::FIELD_HideInInspectors | AbstractClassRep::FIELD_DontWriteToFile)
|
||||
.doc("Input textures to this effect ( samplers ).\n"
|
||||
"@see PFXTextureIdentifiers");
|
||||
|
||||
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, PostEffect))
|
||||
.elements(NumTextures)
|
||||
.doc("Input textures to this effect ( samplers ).\n"
|
||||
"@see PFXTextureIdentifiers");
|
||||
|
||||
addField("textureSRGB", TypeBool, Offset(mTexSRGB, PostEffect), NumTextures,
|
||||
|
|
@ -609,18 +616,16 @@ bool PostEffect::onAdd()
|
|||
for (S32 i = 0; i < NumTextures; i++)
|
||||
{
|
||||
mTextureType[i] = NormalTextureType;
|
||||
if (mTextureAsset[i].notNull()) {
|
||||
String texFilename = mTextureAsset[i]->getImageFile();
|
||||
|
||||
// Skip empty stages or ones with variable or target names.
|
||||
if (texFilename.isEmpty() ||
|
||||
texFilename[0] == '$' ||
|
||||
texFilename[0] == '#')
|
||||
continue;
|
||||
StringTableEntry texAssetId = mTextureAssetRef[i].assetId;
|
||||
|
||||
mTextureProfile[i] = (mTexSRGB[i]) ? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
|
||||
_setTexture(texFilename, i);
|
||||
}
|
||||
// Skip empty stages or ones with variable or target names.
|
||||
if (dStrIsEmpty(texAssetId) ||
|
||||
texAssetId[0] == '$' ||
|
||||
texAssetId[0] == '#')
|
||||
continue;
|
||||
|
||||
mTextureProfile[i] = (mTexSRGB[i]) ? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
|
||||
}
|
||||
|
||||
// Is the target a named target?
|
||||
|
|
@ -1149,7 +1154,7 @@ void PostEffect::_setupConstants( const SceneRenderState *state )
|
|||
|
||||
void PostEffect::_setupTexture( U32 stage, GFXTexHandle &inputTex, const RectI *inTexViewport )
|
||||
{
|
||||
const String &texFilename = mTextureAsset[stage].notNull() ? mTextureAsset[stage]->getImageFile() : "";
|
||||
const String texFilename = mTextureAssetRef[stage].assetId;
|
||||
|
||||
GFXTexHandle theTex;
|
||||
NamedTexTarget *namedTarget = NULL;
|
||||
|
|
@ -1188,8 +1193,8 @@ void PostEffect::_setupTexture( U32 stage, GFXTexHandle &inputTex, const RectI *
|
|||
{
|
||||
theTex = mTexture[stage];
|
||||
|
||||
if (!theTex && mTextureAsset[stage].notNull())
|
||||
theTex = mTextureAsset[stage]->getTexture(mTextureProfile[stage]);
|
||||
if (!theTex)
|
||||
theTex = getTexture(stage, mTextureProfile[stage]);
|
||||
|
||||
if ( theTex )
|
||||
viewport.set( 0, 0, theTex->getWidth(), theTex->getHeight() );
|
||||
|
|
@ -1670,8 +1675,8 @@ void PostEffect::setTexture( U32 index, const String &texFilePath )
|
|||
return;
|
||||
|
||||
mTextureProfile[index] = (mTexSRGB[index])? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
|
||||
_setTexture(texFilePath, index);
|
||||
mTexture[index] = mTextureAsset[index]->getTexture(mTextureProfile[index]);
|
||||
mTextureAssetRef[index] = texFilePath.c_str();
|
||||
mTexture[index] = getTexture(index, mTextureProfile[index]);
|
||||
mTextureType[index] = NormalTextureType;
|
||||
}
|
||||
|
||||
|
|
@ -1866,21 +1871,18 @@ void PostEffect::_checkRequirements()
|
|||
{
|
||||
if (mTextureType[i] == NormalTextureType)
|
||||
{
|
||||
if (mTextureAsset[i].notNull())
|
||||
StringTableEntry texAssetId = mTextureAssetRef[i].assetId;
|
||||
|
||||
if (!dStrIsEmpty(texAssetId) && texAssetId[0] == '#')
|
||||
{
|
||||
const String& texFilename = mTextureAsset[i]->getImageFile();
|
||||
|
||||
if (texFilename.isNotEmpty() && texFilename[0] == '#')
|
||||
NamedTexTarget* namedTarget = NamedTexTarget::find(texAssetId + 1);
|
||||
if (!namedTarget)
|
||||
{
|
||||
NamedTexTarget* namedTarget = NamedTexTarget::find(texFilename.c_str() + 1);
|
||||
if (!namedTarget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab the macros for shader initialization.
|
||||
namedTarget->getShaderMacros(¯os);
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab the macros for shader initialization.
|
||||
namedTarget->getShaderMacros(¯os);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, GFXStaticTextureSRGBProfile, NumTextures);
|
||||
AssetRef<ImageAsset> mTextureAssetRef[NumTextures];
|
||||
GFXTexHandle getTexture(const U32& index, GFXTextureProfile* profile) { return mTextureAssetRef[index].notNull() ? mTextureAssetRef[index].assetPtr->getTexture(profile) : GFXTexHandle(); }
|
||||
GFXTextureProfile* mTextureProfile[NumTextures];
|
||||
GFXTexHandle mTexture[NumTextures];
|
||||
|
||||
|
|
@ -440,6 +441,8 @@ public:
|
|||
|
||||
F32 getPriority() const { return mRenderPriority; }
|
||||
|
||||
StringTableEntry getTextureAssetId(const U32& index) const { return mTextureAssetRef[index].assetId; }
|
||||
|
||||
void setTexture( U32 index, const String &filePath );
|
||||
void setTexture(U32 index, const GFXTexHandle& texHandle);
|
||||
void setCubemapTexture(U32 index, const GFXCubemapHandle &cubemapHandle);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void PostEffectVis::open( PostEffect *pfx )
|
|||
// Only allocate window/bitmaps for input textures that are actually used.
|
||||
if ( i > Target )
|
||||
{
|
||||
if ( pfx->mTextureAsset[i-1].notNull() && pfx->mTextureAsset[i - 1]->getImageFile() == StringTable->EmptyString())
|
||||
if ( pfx->getTextureAssetId(i - 1) == StringTable->EmptyString())
|
||||
{
|
||||
window.window[i] = NULL;
|
||||
window.bmp[i] = NULL;
|
||||
|
|
@ -275,9 +275,9 @@ void PostEffectVis::onPFXProcessed( PostEffect *pfx )
|
|||
|
||||
|
||||
if ( tex )
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s [ %ix%i ]", name, pfx->getId(), i-1, pfx->mTextureAsset[i - 1].notNull() ? pfx->mTextureAsset[i - 1]->getImageFile() : "", tex->getWidth(), tex->getHeight());
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s [ %ix%i ]", name, pfx->getId(), i-1, pfx->getTextureAssetId(i - 1), tex->getWidth(), tex->getHeight());
|
||||
else
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s", name, pfx->getId(), i-1, pfx->mTextureAsset[i - 1].notNull() ? pfx->mTextureAsset[i - 1]->getImageFile() : "");
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s", name, pfx->getId(), i-1, pfx->getTextureAssetId(i - 1));
|
||||
|
||||
pWinCtrl->setDataField( StringTable->insert("text"), NULL, caption );
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ void PostEffectVis::_setDefaultCaption( VisWindow &vis, U32 texIndex )
|
|||
else
|
||||
dSprintf( name, 256, "%s", pfx->getName() );
|
||||
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s [NOT ENABLED]", name, pfx->getId(), texIndex-1, pfx->mTextureAsset[texIndex - 1].notNull() ? pfx->mTextureAsset[texIndex - 1]->getImageFile() : "");
|
||||
dSprintf( caption, 256, "%s[%i] input%i - %s [NOT ENABLED]", name, pfx->getId(), texIndex-1, pfx->getTextureAssetId(texIndex - 1));
|
||||
|
||||
winCtrl->setDataField( StringTable->insert("text"), NULL, caption );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,10 +92,12 @@ FRangeValidator hardnessValidator(0.0f, 0.999f);
|
|||
void TerrainMaterial::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map");
|
||||
ADD_FIELD("diffuseMapAsset", TypeImageAssetRef, Offset(mDiffuseMapAssetRef, TerrainMaterial))
|
||||
.doc("Base Albedo asset stretched over the whole map");
|
||||
addFieldV( "diffuseSize", TypeRangedF32, Offset( mDiffuseSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the diffuse map to the material square" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(NormalMap, TerrainMaterial,"NormalMap");
|
||||
ADD_FIELD("normalMapAsset", TypeImageAssetRef, Offset(mNormalMapAssetRef, TerrainMaterial))
|
||||
.doc("NormalMap asset");
|
||||
addFieldV( "parallaxScale", TypeRangedF32, Offset( mParallaxScale, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the height from the normal map to give some self "
|
||||
|
||||
"occlusion effect (aka parallax) to the terrain material" );
|
||||
|
|
@ -109,20 +111,23 @@ void TerrainMaterial::initPersistFields()
|
|||
addFieldV("blendHeightHardness", TypeRangedF32, Offset(mBlendHardness, TerrainMaterial), &hardnessValidator, "How sharply this layer blends with other textures."
|
||||
"0->1, soft->hard.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close.");
|
||||
ADD_FIELD("detailMapAsset", TypeImageAssetRef, Offset(mDetailMapAssetRef, TerrainMaterial))
|
||||
.doc("Raises and lowers the RGB result of the Base Albedo up close.");
|
||||
addFieldV( "detailSize", TypeRangedF32, Offset( mDetailSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the detail map to the material square" );
|
||||
addFieldV( "detailStrength", TypeRangedF32, Offset( mDetailStrength, TerrainMaterial ), &CommonValidators::PositiveFloat, "Exponentially sharpens or lightens the detail map rendering on the material" );
|
||||
addFieldV( "detailDistance", TypeRangedF32, Offset( mDetailDistance, TerrainMaterial ), &CommonValidators::PositiveFloat, "Changes how far camera can see the detail map rendering on the material" );
|
||||
addField( "useSideProjection", TypeBool, Offset( mSideProjection, TerrainMaterial ),"Makes that terrain material project along the sides of steep "
|
||||
"slopes instead of projected downwards");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(ORMConfigMap, TerrainMaterial, "AO|Roughness|metalness map (uses DetailMap UV Coords)");
|
||||
ADD_FIELD("ORMConfigMapAsset", TypeImageAssetRef, Offset(mORMConfigMapAssetRef, TerrainMaterial))
|
||||
.doc("AO|Roughness|metalness map asset (uses DetailMap UV Coords)");
|
||||
|
||||
addField("isSRGB", TypeBool, Offset(mIsSRGB, TerrainMaterial), "Is the PBR Config map's image in sRGB format?");
|
||||
addField("invertRoughness", TypeBool, Offset(mInvertRoughness, TerrainMaterial), "Should the roughness channel of the PBR Config map be inverted?");
|
||||
|
||||
//Macro maps additions
|
||||
INITPERSISTFIELD_IMAGEASSET(MacroMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo at a distance.");
|
||||
ADD_FIELD("macroMapAsset", TypeImageAssetRef, Offset(mMacroMapAssetRef, TerrainMaterial))
|
||||
.doc("Raises and lowers the RGB result of the Base Albedo at a distance.");
|
||||
addFieldV( "macroSize", TypeRangedF32, Offset( mMacroSize, TerrainMaterial ), &CommonValidators::PositiveFloat, "Used to scale the Macro map to the material square" );
|
||||
addFieldV( "macroStrength", TypeRangedF32, Offset( mMacroStrength, TerrainMaterial ), &CommonValidators::PositiveFloat, "Exponentially sharpens or lightens the Macro map rendering on the material" );
|
||||
addFieldV( "macroDistance", TypeRangedF32, Offset( mMacroDistance, TerrainMaterial ), &CommonValidators::PositiveFloat, "Changes how far camera can see the Macro map rendering on the material" );
|
||||
|
|
@ -197,7 +202,7 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
|
|||
{
|
||||
mat = new TerrainMaterial();
|
||||
mat->setInternalName( nameOrPath );
|
||||
mat->_setDiffuseMap(nameOrPath);
|
||||
mat->mDiffuseMapAssetRef = ImageAsset::getAssetIdFromFilePath(StringTable->insert(nameOrPath));
|
||||
mat->registerObject();
|
||||
Sim::getRootGroup()->addObject( mat );
|
||||
return mat;
|
||||
|
|
@ -206,11 +211,9 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
|
|||
// Ok... return a placeholder material then.
|
||||
mat = new TerrainMaterial();
|
||||
mat->setInternalName(nameOrPath);
|
||||
mat->_setDiffuseMap(GFXTextureManager::getWarningTexturePath());
|
||||
mat->mDiffuseMapAssetRef = ImageAsset::getAssetIdFromFilePath(StringTable->insert(GFXTextureManager::getWarningTexturePath()));
|
||||
mat->mDiffuseSize = 500;
|
||||
mat->_setDetailMap(StringTable->EmptyString());
|
||||
mat->mDetailSize = 5;
|
||||
mat->_setMacroMap(StringTable->EmptyString());
|
||||
mat->mMacroSize = 200;
|
||||
mat->registerObject();
|
||||
|
||||
|
|
@ -219,14 +222,53 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
|
|||
return mat;
|
||||
}
|
||||
|
||||
//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(); //returns the raw file referenced
|
||||
//material.getDiffuseMapAsset(); //returns the asset id
|
||||
//material.setDiffuseMap(%texture); //tries to set the asset and failing that attempts a flat file reference
|
||||
DEF_ASSET_BINDS_REFACTOR(TerrainMaterial, DiffuseMap)
|
||||
DEF_ASSET_BINDS_REFACTOR(TerrainMaterial, NormalMap)
|
||||
DEF_ASSET_BINDS_REFACTOR(TerrainMaterial, DetailMap)
|
||||
DEF_ASSET_BINDS_REFACTOR(TerrainMaterial, ORMConfigMap)
|
||||
DEF_ASSET_BINDS_REFACTOR(TerrainMaterial, MacroMap)
|
||||
DefineEngineMethod(TerrainMaterial, getDiffuseMapAsset, StringTableEntry, (), , "DiffuseMap asset reference")
|
||||
{
|
||||
return object->getDiffuseMapAssetId();
|
||||
}
|
||||
DefineEngineMethod(TerrainMaterial, setDiffuseMap, void, (const char* assetName), , "DiffuseMap assignment.")
|
||||
{
|
||||
object->setDiffuseMap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainMaterial, getNormalMapAsset, StringTableEntry, (), , "NormalMap asset reference")
|
||||
{
|
||||
return object->getNormalMapAssetId();
|
||||
}
|
||||
DefineEngineMethod(TerrainMaterial, setNormalMap, void, (const char* assetName), , "NormalMap assignment.")
|
||||
{
|
||||
object->setNormalMap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainMaterial, getDetailMapAsset, StringTableEntry, (), , "DetailMap asset reference")
|
||||
{
|
||||
return object->getDetailMapAssetId();
|
||||
}
|
||||
DefineEngineMethod(TerrainMaterial, setDetailMap, void, (const char* assetName), , "DetailMap assignment.")
|
||||
{
|
||||
object->setDetailMap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainMaterial, getORMConfigMapAsset, StringTableEntry, (), , "ORMConfigMap asset reference")
|
||||
{
|
||||
return object->getORMConfigMapAssetId();
|
||||
}
|
||||
DefineEngineMethod(TerrainMaterial, setORMConfigMap, void, (const char* assetName), , "ORMConfigMap assignment.")
|
||||
{
|
||||
object->setORMConfigMap(StringTable->insert(assetName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainMaterial, getMacroMapAsset, StringTableEntry, (), , "MacroMap asset reference")
|
||||
{
|
||||
return object->getMacroMapAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainMaterial, setMacroMap, void, (const char* assetName), , "MacroMap assignment.")
|
||||
{
|
||||
object->setMacroMap(StringTable->insert(assetName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,17 +38,17 @@ class TerrainMaterial : public SimObject
|
|||
protected:
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, DiffuseMap, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mDiffuseMapAssetRef;
|
||||
|
||||
/// The size of the diffuse base map in meters
|
||||
/// used to generate its texture coordinates.
|
||||
F32 mDiffuseSize;
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, NormalMap, GFXNormalMapProfile)
|
||||
AssetRef<ImageAsset> mNormalMapAssetRef;
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, DetailMap, GFXStaticTextureProfile)
|
||||
AssetRef<ImageAsset> mDetailMapAssetRef;
|
||||
|
||||
/// The size of the detail map in meters used
|
||||
/// to generate the texture coordinates for the
|
||||
|
|
@ -62,7 +62,7 @@ protected:
|
|||
F32 mDetailDistance;
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, ORMConfigMap, GFXStaticTextureProfile)
|
||||
AssetRef<ImageAsset> mORMConfigMapAssetRef;
|
||||
|
||||
bool mIsSRGB;
|
||||
bool mInvertRoughness;
|
||||
|
|
@ -73,7 +73,7 @@ protected:
|
|||
/// planes.
|
||||
bool mSideProjection;
|
||||
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, MacroMap, GFXStaticTextureProfile)
|
||||
AssetRef<ImageAsset> mMacroMapAssetRef;
|
||||
|
||||
F32 mMacroSize;
|
||||
F32 mMacroStrength;
|
||||
|
|
@ -110,6 +110,27 @@ public:
|
|||
/// a material is not found or defined.
|
||||
static TerrainMaterial* getWarningMaterial();
|
||||
|
||||
GFXTexHandle getDiffuseMap() { return mDiffuseMapAssetRef.notNull() ? mDiffuseMapAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
StringTableEntry getDiffuseMapAssetId() const { return mDiffuseMapAssetRef.getAssetId(); }
|
||||
void setDiffuseMap(StringTableEntry assetId) { mDiffuseMapAssetRef = assetId; }
|
||||
|
||||
GFXTexHandle getNormalMap() { return mNormalMapAssetRef.notNull() ? mNormalMapAssetRef.assetPtr->getTexture(&GFXNormalMapProfile) : NULL; }
|
||||
StringTableEntry getNormalMapAssetId() const { return mNormalMapAssetRef.getAssetId(); }
|
||||
void setNormalMap(StringTableEntry assetId) { mNormalMapAssetRef = assetId; }
|
||||
|
||||
GFXTexHandle getDetailMap() { return mDetailMapAssetRef.notNull() ? mDetailMapAssetRef.assetPtr->getTexture(&GFXStaticTextureProfile) : NULL; }
|
||||
StringTableEntry getDetailMapAssetId() const { return mDetailMapAssetRef.getAssetId(); }
|
||||
void setDetailMap(StringTableEntry assetId) { mDetailMapAssetRef = assetId; }
|
||||
|
||||
GFXTexHandle getORMConfigMap() { return mORMConfigMapAssetRef.notNull() ? mORMConfigMapAssetRef.assetPtr->getTexture(&GFXStaticTextureProfile) : NULL; }
|
||||
AssetPtr<ImageAsset> getORMConfigMapAsset() { return mORMConfigMapAssetRef.assetPtr; }
|
||||
StringTableEntry getORMConfigMapAssetId() const { return mORMConfigMapAssetRef.getAssetId(); }
|
||||
void setORMConfigMap(StringTableEntry assetId) { mORMConfigMapAssetRef = assetId; }
|
||||
|
||||
GFXTexHandle getMacroMap() { return mMacroMapAssetRef.notNull() ? mMacroMapAssetRef.assetPtr->getTexture(&GFXStaticTextureProfile) : NULL; }
|
||||
StringTableEntry getMacroMapAssetId() const { return mMacroMapAssetRef.getAssetId(); }
|
||||
void setMacroMap(StringTableEntry assetId) { mMacroMapAssetRef = assetId; }
|
||||
|
||||
F32 getDiffuseSize() const { return mDiffuseSize; }
|
||||
|
||||
F32 getDetailSize() const { return mDetailSize; }
|
||||
|
|
|
|||
|
|
@ -181,14 +181,14 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
|||
{
|
||||
torquePath = texName.C_Str();
|
||||
if (!torquePath.isEmpty())
|
||||
mat->_setDiffuseMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
|
||||
mat->setDiffuseMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
|
||||
}
|
||||
|
||||
if (AI_SUCCESS == mAIMat->Get(AI_MATKEY_TEXTURE(aiTextureType_NORMALS, 0), texName))
|
||||
{
|
||||
torquePath = texName.C_Str();
|
||||
if (!torquePath.isEmpty())
|
||||
mat->_setNormalMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
|
||||
mat->setNormalMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
|
||||
}
|
||||
|
||||
#ifdef TORQUE_PBR_MATERIALS
|
||||
|
|
@ -205,20 +205,20 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
|||
{ // If we have either map, fill all three slots
|
||||
if (rmName.isNotEmpty())
|
||||
{
|
||||
mat->_setRoughMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Roughness
|
||||
mat->setRoughMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Roughness
|
||||
mat->mRoughnessChan[0] = 1;
|
||||
mat->mInvertRoughness[0] = false;
|
||||
mat->_setMetalMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Metallic
|
||||
mat->setMetalMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Metallic
|
||||
mat->mMetalChan[0] = 2;
|
||||
}
|
||||
if (aoName.isNotEmpty())
|
||||
{
|
||||
mat->_setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||
mat->setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||
mat->mAOChan[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mat->_setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||
mat->setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||
mat->mAOChan[0] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,8 +208,8 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const
|
|||
Material *newMat = MATMGR->allocateAndRegister( cleanName, getName() );
|
||||
Con::setVariable("$Con::File", oldScriptFile); // restore script path
|
||||
|
||||
newMat->_setDiffuseMap(diffuseMap, 0);
|
||||
newMat->_setNormalMap(normalMap, 0);
|
||||
newMat->setDiffuseMap(diffuseMap, 0);
|
||||
newMat->setNormalMap(normalMap, 0);
|
||||
|
||||
newMat->mDiffuse[0] = diffuseColor;
|
||||
newMat->mRoughness[0] = roughness;
|
||||
|
|
|
|||
|
|
@ -1030,7 +1030,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
|
|||
{
|
||||
Torque::Path diffusePath;
|
||||
|
||||
if (mat->getDiffuseMap(0))
|
||||
if (mat->getDiffuseMapAsset(0).notNull())
|
||||
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
|
||||
else
|
||||
diffusePath = String("warningMat");
|
||||
|
|
@ -1040,7 +1040,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mat->getDiffuseMap(0))
|
||||
if (mat->getDiffuseMapAsset(0).notNull())
|
||||
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
|
||||
else
|
||||
diffuseMap += "warningMat";
|
||||
|
|
@ -1316,7 +1316,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
|
|||
{
|
||||
Torque::Path diffusePath;
|
||||
|
||||
if (mat->getDiffuseMap(0))
|
||||
if (mat->getDiffuseMapAsset(0).notNull())
|
||||
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
|
||||
else
|
||||
diffusePath = String("warningMat");
|
||||
|
|
@ -1326,7 +1326,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mat->getDiffuseMap(0))
|
||||
if (mat->getDiffuseMapAsset(0).notNull())
|
||||
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
|
||||
else
|
||||
diffuseMap += "warningMat";
|
||||
|
|
|
|||
|
|
@ -188,6 +188,11 @@ void TSLastDetail::render( const TSRenderState &rdata, F32 alpha )
|
|||
renderPass->addInst( ri );
|
||||
}
|
||||
|
||||
StringTableEntry TSLastDetail::_getImposterAssetId( const String &filePath )
|
||||
{
|
||||
return ImageAsset::getAssetIdFromFilePath( StringTable->insert( filePath.c_str() ) );
|
||||
}
|
||||
|
||||
void TSLastDetail::update( bool forceUpdate )
|
||||
{
|
||||
// This should never be called on a dedicated server or
|
||||
|
|
@ -252,8 +257,8 @@ void TSLastDetail::update( bool forceUpdate )
|
|||
// Setup the material for this imposter.
|
||||
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
|
||||
mMaterial->mAutoGenerated = true;
|
||||
mMaterial->_setDiffuseMap(diffuseMapPath, 0);
|
||||
mMaterial->_setNormalMap(_getNormalMapPath(), 0);
|
||||
mMaterial->setDiffuseMap(_getImposterAssetId(diffuseMapPath), 0);
|
||||
mMaterial->setNormalMap(_getImposterAssetId(_getNormalMapPath()), 0);
|
||||
|
||||
mMaterial->mImposterLimits.set( (mNumPolarSteps * 2) + 1, mNumEquatorSteps, mPolarAngle, mIncludePoles );
|
||||
mMaterial->mTranslucent = true;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,10 @@ protected:
|
|||
/// Helper which returns the imposter normal map path.
|
||||
String _getNormalMapPath() const { return mNormalPath; }
|
||||
|
||||
/// Helper which returns the assetId associated to the imposter file,
|
||||
/// generating a private one if required for generated imposters
|
||||
static StringTableEntry _getImposterAssetId( const String &filePath );
|
||||
|
||||
public:
|
||||
|
||||
TSLastDetail( TSShape *shape,
|
||||
|
|
|
|||
|
|
@ -129,7 +129,15 @@ function MaterialAsset::generatePreviewImage(%this, %previewButton, %forceRegene
|
|||
{
|
||||
if(isObject(%this.materialDefinitionName))
|
||||
{
|
||||
if(compareFileTimes(%this.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 ||
|
||||
%diffuseMapFile = "";
|
||||
%diffuseMapAssetId = %this.materialDefinitionName.getDiffuseMapAsset(0);
|
||||
if(AssetDatabase.isDeclaredAsset(%diffuseMapAssetId))
|
||||
{
|
||||
%diffuseMapFile = AssetDatabase.acquireAsset(%diffuseMapAssetId).getImagePath();
|
||||
AssetDatabase.releaseAsset(%diffuseMapAssetId);
|
||||
}
|
||||
|
||||
if(compareFileTimes(%diffuseMapFile, %previewFilePath) == 1 ||
|
||||
compareFileTimes(%this.materialDefinitionName.getFilename(), %previewFilePath) == 1)
|
||||
%generatePreview = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,15 @@ function TerrainAssetMaterial::generatePreviewImage(%this, %previewButton, %forc
|
|||
{
|
||||
if(isObject(%this.materialDefinitionName))
|
||||
{
|
||||
if(compareFileTimes(%this.materialDefinitionName.getDiffuseMap(), %previewFilePath) == 1 ||
|
||||
%diffuseMapFile = "";
|
||||
%diffuseMapAssetId = %this.materialDefinitionName.getDiffuseMapAsset();
|
||||
if(AssetDatabase.isDeclaredAsset(%diffuseMapAssetId))
|
||||
{
|
||||
%diffuseMapFile = AssetDatabase.acquireAsset(%diffuseMapAssetId).getImagePath();
|
||||
AssetDatabase.releaseAsset(%diffuseMapAssetId);
|
||||
}
|
||||
|
||||
if(compareFileTimes(%diffuseMapFile, %previewFilePath) == 1 ||
|
||||
compareFileTimes(%this.materialDefinitionName.getFilename(), %previewFilePath) == 1)
|
||||
%generatePreview = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function ConvexEditorGui::onWake( %this )
|
|||
{
|
||||
convexEditorToolbar-->gridSnapSizeEdit.setText(%this.getGridSnapSize());
|
||||
|
||||
if(ConvexEditorOptionsWindow-->matPreviewBtn.getBitmap() $= "")
|
||||
if(ConvexEditorOptionsWindow-->matPreviewBtn.getBitmapAsset() $= "")
|
||||
{
|
||||
//no active material, so set one
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.setText("");
|
||||
|
|
@ -38,7 +38,7 @@ function ConvexEditorGui::onWake( %this )
|
|||
%mat = %matName;
|
||||
}
|
||||
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.bitmapAsset = getAssetPreviewImage(%mat.getDiffuseMap(0));
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(getAssetPreviewImage(%mat.getDiffuseMapAsset(0)));
|
||||
|
||||
ConvexEditorOptionsWindow.activeMaterial = %mat;
|
||||
}
|
||||
|
|
@ -82,8 +82,6 @@ function ConvexEditorGui::createConvexBox( %this )
|
|||
|
||||
function ConvexEditorGui::onSelectionChanged( %this, %shape, %face )
|
||||
{
|
||||
//echo( "onSelectionChanged: " @ %shape SPC %face );
|
||||
|
||||
ConvexEditorSplitFaceBtn.setActive( false );
|
||||
ConvexEditorSplitFaceBtn.ToolTip = "Split selected face [Disabled]" NL "Use Ctrl + Rotate instead for more control";
|
||||
ConvexEditorDeleteFaceBtn.setActive( false );
|
||||
|
|
@ -100,7 +98,7 @@ function ConvexEditorGui::onSelectionChanged( %this, %shape, %face )
|
|||
|
||||
ConvexEditorOptionsWindow-->defMatPreviewBtn.setText("");
|
||||
%shapeMat = %shape.getMaterial();
|
||||
ConvexEditorOptionsWindow-->defMatPreviewBtn.bitmapAsset = getAssetPreviewImage(%shapeMat.getDiffuseMap(0));
|
||||
ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(getAssetPreviewImage(%shapeMat.getDiffuseMapAsset(0)));
|
||||
|
||||
ConvexEditorOptionsWindow.activeShape = %shape;
|
||||
|
||||
|
|
@ -205,7 +203,7 @@ function ConvexEditorMaterialLiftBtn::onClick(%this)
|
|||
{
|
||||
%mat = ConvexEditorGui.getSelectedFaceMaterial();
|
||||
ConvexEditorOptionsWindow.activeMaterial = %mat;
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(getAssetPreviewImage(%mat.getDiffuseMap(0)));
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(getAssetPreviewImage(%mat.getDiffuseMapAsset(0)));
|
||||
}
|
||||
|
||||
function ConvexEditorMaterialResetBtn::onClick(%this)
|
||||
|
|
@ -248,18 +246,9 @@ function ConvexEditorDefaultMaterialBtn::gotMaterialName(%this, %name)
|
|||
//eval(%this.object @ "." @ %this.targetField @ " = " @ %name @ ";");
|
||||
//%this.object.changeMaterial(getTrailingNumber(%this.targetField), %name);
|
||||
//%this.object.inspectorApply();
|
||||
%diffusemap = %materialAsset.materialDefinitionName.getDiffuseMap(0);
|
||||
if(%diffusemap $= "")
|
||||
{
|
||||
%diffuseAsset = %materialAsset.materialDefinitionName.getDiffuseMapAsset(0);
|
||||
if(%diffuseAsset !$= "")
|
||||
{
|
||||
%diffuseAssetDef = AssetDatabase.acquireAsset(%diffuseAsset);
|
||||
%diffusemap = %diffuseAssetDef.getImagePath();
|
||||
}
|
||||
}
|
||||
%diffuseAsset = %materialAsset.materialDefinitionName.getDiffuseMapAsset(0);
|
||||
|
||||
ConvexEditorOptionsWindow-->defMatPreviewBtn.bitmapAsset = getAssetPreviewImage(%diffusemap);
|
||||
ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(getAssetPreviewImage(%diffuseAsset));
|
||||
|
||||
ConvexEditorOptionsWindow.activeShape.setMaterial(%name);
|
||||
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ function DecalEditorGui::updateDecalPreview( %this, %material )
|
|||
{
|
||||
%matAsset = AssetDatabase.acquireAsset(%material);
|
||||
|
||||
%previewImage = %matAsset.materialDefinitionName.getDiffuseMap(0);
|
||||
%previewImage = %matAsset.materialDefinitionName.getDiffuseMapAsset(0);
|
||||
//AssetDatabase.releaseAsset(%material);
|
||||
}
|
||||
else if(AssetDatabase.getAssetType(%material) $= "ImageAsset")
|
||||
|
|
@ -644,7 +644,7 @@ function DecalEditorGui::updateInstancePreview( %this, %material )
|
|||
{
|
||||
%matAsset = AssetDatabase.acquireAsset(%material);
|
||||
|
||||
%previewImage = %matAsset.materialDefinitionName.getDiffuseMap(0);
|
||||
%previewImage = %matAsset.materialDefinitionName.getDiffuseMapAsset(0);
|
||||
}
|
||||
else if(AssetDatabase.getAssetType(%material) $= "ImageAsset")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ function MaterialEditorGui::establishMaterials(%this)
|
|||
singleton CustomMaterial( materialEd_justAlphaMaterial )
|
||||
{
|
||||
mapTo = "matEd_mappedMatB";
|
||||
texture[0] = materialEd_previewMaterial.getdiffuseMap(0);
|
||||
texture[0] = materialEd_previewMaterial.getDiffuseMapAsset(0);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -650,9 +650,6 @@ function MaterialEditorGui::setActiveMaterial( %this, %material )
|
|||
};
|
||||
}
|
||||
|
||||
// Converts the texture files into absolute paths.
|
||||
MaterialEditorGui.convertTextureFields();
|
||||
|
||||
// If we're allowing for name changes, make sure to save the name seperately
|
||||
%this.originalName = MaterialEditorGui.currentMaterial.name;
|
||||
|
||||
|
|
@ -733,50 +730,6 @@ function MaterialEditorGui::setMaterialDirty(%this)
|
|||
matEd_PersistMan.setDirty(MaterialEditorGui.currentMaterial, MaterialEditorGui.defaultMaterialFile);
|
||||
}
|
||||
|
||||
function MaterialEditorGui::convertTextureFields(%this)
|
||||
{
|
||||
// Find the absolute paths for the texture filenames so that
|
||||
// we can properly wire up the preview materials and controls.
|
||||
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "DiffuseMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "NormalMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "OverlayMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "DetailMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "LightMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "ToneMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "ORMConfigMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "RoughMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "AOMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "MetalMap");
|
||||
%this.convertMaterialTextureField(MaterialEditorGui.currentMaterial, "GlowMap");
|
||||
}
|
||||
|
||||
function MaterialEditorGui::convertMaterialTextureField(%this, %material, %mapName)
|
||||
{
|
||||
for(%index = 0; %index < 4; %index++)
|
||||
{
|
||||
%mapFile = %material.call("get" @ %mapName, %index);
|
||||
if(%mapFile !$= "")
|
||||
{
|
||||
if(isFile(%mapFile))
|
||||
{
|
||||
//see if we can't go finding it
|
||||
%mapFile = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %mapFile);
|
||||
MaterialEditorGui.currentMaterial.call("set" @ %mapName, %mapFile, %index);
|
||||
}
|
||||
else
|
||||
{
|
||||
%firstChar = getSubStr( %mapFile, 0, 1 );
|
||||
if(%firstChar $= "#" || %firstChar $= "$" ) // we are a named target
|
||||
{
|
||||
%assetPtr = %material.call("get" @ %mapName @ "Asset", %index);
|
||||
MaterialEditorGui.currentMaterial.call("set" @ %mapName, %assetPtr, %index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// still needs to be optimized further
|
||||
function MaterialEditorGui::searchForTexture(%this,%material, %texture)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ function PE_ParticleEditor::loadNewParticle( %this, %particle )
|
|||
%this.currParticle = %current;
|
||||
|
||||
error("PE_ParticleEditor::loadNewParticle() - Loading particle: " @ %current.getName());
|
||||
error("Particle TextureName: " @ %current.getTexture());
|
||||
error("Particle TextureName: " @ %current.getTextureAsset());
|
||||
|
||||
error("ReloadingParticle...");
|
||||
%current.reload();
|
||||
|
|
@ -116,8 +116,8 @@ function PE_ParticleEditor::loadNewParticle( %this, %particle )
|
|||
PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom( %current );
|
||||
PE_ParticleEditor_NotDirtyParticle.originalName = %current.getName();
|
||||
|
||||
error("Post duplicate Particle TextureName: " @ %current.getTexture());
|
||||
error("Post duplicate PE_ParticleEditor_NotDirtyParticle TextureName: " @ PE_ParticleEditor_NotDirtyParticle.getTexture());
|
||||
error("Post duplicate Particle TextureName: " @ %current.getTextureAsset());
|
||||
error("Post duplicate PE_ParticleEditor_NotDirtyParticle TextureName: " @ PE_ParticleEditor_NotDirtyParticle.getTextureAsset());
|
||||
|
||||
%this.guiSync();
|
||||
%this.setNotDirty();
|
||||
|
|
|
|||
|
|
@ -784,8 +784,8 @@ T3Dpre4ProjectImporter::genProcessor("Sun", "coronaMaterial coronaMaterialAsset"
|
|||
T3Dpre4ProjectImporter::genProcessor("VolumetricFog", "shape ShapeAsset texture textureAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("WaterObject", "rippleTex rippleTexAsset foamTex foamTexAsset depthGradientTex depthGradientTexAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("ConvexShape", "material materialAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("RenderMesh", "material materialAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("RenderShape", "shape shapeAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("RenderMeshExample", "material materialAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("RenderShapeExample", "shape shapeAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("GroundCover", "material materialAsset shape shapeAsset shapeFilename shapeAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("GroundPlane", "material materialAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset");
|
||||
|
|
@ -856,6 +856,7 @@ T3Dpre4ProjectImporter::genProcessor("GuiMissionArea", "handleBitmap handleBitma
|
|||
T3Dpre4ProjectImporter::genProcessor("WorldEditor", "selectHandle selectHandleAsset defaultHandle defaultHandleAsset lockedHandle lockedHandleAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("GuiControlProfile", "bitmap bitmapAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("GuiMLTextCtrl", "deniedSound deniedSoundAsset");
|
||||
T3Dpre4ProjectImporter::genProcessor("GuiObjectView", "shapeName shapeAsset shapeFile shapeAsset model modelAsset mountedShapeName mountedShapeAsset mountedModelName mountedModelAsset");
|
||||
|
||||
function T3Dpre4ProjectImporter::processGuiBitmapButtonCtrlLine(%this, %line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function TerrainEditor::setPaintMaterial( %this, %matIndex, %terrainMat )
|
|||
ETerrainMaterialSelected.selectedMatIndex = %matIndex;
|
||||
ETerrainMaterialSelected.selectedMat = %terrainMat;
|
||||
|
||||
ETerrainMaterialSelected.setBitmap(getAssetPreviewImage(%terrainMat.getDiffuseMap()));
|
||||
ETerrainMaterialSelected.setBitmap(getAssetPreviewImage(%terrainMat.getDiffuseMapAsset()));
|
||||
|
||||
ETerrainMaterialSelectedEdit.Visible = isObject(%terrainMat);
|
||||
TerrainTextureText.text = %terrainMat.getInternalName();
|
||||
|
|
@ -178,7 +178,7 @@ function EPainter::updateLayers( %this, %matIndex )
|
|||
*/
|
||||
|
||||
%ctrl.setText( %matInternalName );
|
||||
%ctrl.setBitmap( getAssetPreviewImage(%mat.getDiffuseMap()) );
|
||||
%ctrl.setBitmap( getAssetPreviewImage(%mat.getDiffuseMapAsset()) );
|
||||
|
||||
%tooltip = %matInternalName;
|
||||
if(%i < 9)
|
||||
|
|
|
|||
|
|
@ -381,8 +381,8 @@ function TerrainMaterialDlg::activateMaterialCtrls( %this, %active )
|
|||
%parent.getObject( %i ).setActive( %active );
|
||||
}
|
||||
|
||||
%detailz = %this-->texDetailMap.getBitmap();
|
||||
if(%this-->texDetailMap.getBitmap() $= "" || %this-->texDetailMap.getBitmap() $= $TerrainMaterialEditor::emptyMaterialImage)
|
||||
%detailz = %this-->texDetailMap.getBitmapAsset();
|
||||
if(%detailz $= "" || %detailz $= $TerrainMaterialEditor::emptyMaterialImage)
|
||||
{
|
||||
NormalMapContainer.callOnChildren("setActive", false);
|
||||
ORMConfigMapContainer.callOnChildren("setActive", false);
|
||||
|
|
@ -432,34 +432,34 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
|
|||
%this-->matNameCtrl.setText( %mat.internalName );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getDiffuseMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getDiffuseMapAsset() : "None";
|
||||
%imgAssetId = %mat.getDiffuseMapAsset();
|
||||
%imgPathText = %imgAssetId !$= "" && %imgAssetId !$= $TerrainMaterialEditor::emptyMaterialImage ? %imgAssetId : "None";
|
||||
%this-->diffuseMapAssetId.setText( %imgPathText );
|
||||
%this-->texDiffuseMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
%this-->texDiffuseMap.setBitmap( getAssetPreviewImage(%imgAssetId) );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getNormalMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getNormalMapAsset() : "None";
|
||||
%imgAssetId = %mat.getNormalMapAsset();
|
||||
%imgPathText = %imgAssetId !$= "" && %imgAssetId !$= $TerrainMaterialEditor::emptyMaterialImage ? %imgAssetId : "None";
|
||||
%this-->normalMapAssetId.setText( %imgPathText );
|
||||
%this-->texNormalMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
%this-->texNormalMap.setBitmap( getAssetPreviewImage(%imgAssetId) );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getORMConfigMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getORMConfigMapAsset() : "None";
|
||||
%imgAssetId = %mat.getORMConfigMapAsset();
|
||||
%imgPathText = %imgAssetId !$= "" && %imgAssetId !$= $TerrainMaterialEditor::emptyMaterialImage ? %imgAssetId : "None";
|
||||
%this-->ORMConfigMapAssetId.setText( %imgPathText );
|
||||
%this-->texORMConfigMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
|
||||
%this-->texORMConfigMap.setBitmap( getAssetPreviewImage(%imgAssetId) );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getDetailMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getDetailMapAsset() : "None";
|
||||
%imgAssetId = %mat.getDetailMapAsset();
|
||||
%imgPathText = %imgAssetId !$= "" && %imgAssetId !$= $TerrainMaterialEditor::emptyMaterialImage ? %imgAssetId : "None";
|
||||
%this-->detailMapAssetId.setText( %imgPathText );
|
||||
%this-->texDetailMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
|
||||
%this-->texDetailMap.setBitmap( getAssetPreviewImage(%imgAssetId) );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getMacroMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getMacroMapAsset() : "None";
|
||||
%imgAssetId = %mat.getMacroMapAsset();
|
||||
%imgPathText = %imgAssetId !$= "" && %imgAssetId !$= $TerrainMaterialEditor::emptyMaterialImage ? %imgAssetId : "None";
|
||||
%this-->macroMapAssetId.setText( %imgPathText );
|
||||
%this-->texMacroMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
%this-->texMacroMap.setBitmap( getAssetPreviewImage(%imgAssetId) );
|
||||
|
||||
//
|
||||
%this-->detSizeCtrl.setText( %mat.detailSize );
|
||||
|
|
@ -714,11 +714,11 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %materialAssetId )
|
|||
// return.
|
||||
|
||||
if ( %mat.internalName $= %newName &&
|
||||
%mat.getDiffuseMap() $= %newDiffuse &&
|
||||
%mat.getNormalMap() $= %newNormal &&
|
||||
%mat.getDetailMap() $= %newDetail &&
|
||||
%mat.getORMConfigMap() $= %newormConfig &&
|
||||
%mat.getMacroMap() $= %newMacro &&
|
||||
%mat.getDiffuseMapAsset() $= %newDiffuse &&
|
||||
%mat.getNormalMapAsset() $= %newNormal &&
|
||||
%mat.getDetailMapAsset() $= %newDetail &&
|
||||
%mat.getORMConfigMapAsset() $= %newormConfig &&
|
||||
%mat.getMacroMapAsset() $= %newMacro &&
|
||||
%mat.detailSize == %detailSize &&
|
||||
%mat.diffuseSize == %diffuseSize &&
|
||||
%mat.detailStrength == %detailStrength &&
|
||||
|
|
@ -852,11 +852,11 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
|
|||
parentGroup = %group;
|
||||
material = %mat;
|
||||
internalName = %mat.internalName;
|
||||
diffuseMap = %mat.getDiffuseMap();
|
||||
normalMap = %mat.getNormalMap();
|
||||
ormConfigMap = %mat.getORMConfigMap();
|
||||
detailMap = %mat.getDetailMap();
|
||||
macroMap = %mat.getMacroMap();
|
||||
diffuseMap = %mat.getDiffuseMapAsset();
|
||||
normalMap = %mat.getNormalMapAsset();
|
||||
ormConfigMap = %mat.getORMConfigMapAsset();
|
||||
detailMap = %mat.getDetailMapAsset();
|
||||
macroMap = %mat.getMacroMapAsset();
|
||||
detailSize = %mat.detailSize;
|
||||
diffuseSize = %mat.diffuseSize;
|
||||
detailStrength = %mat.detailStrength;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue