all DECLARE_IMAGEASSET refactored

This commit is contained in:
marauder2k7 2024-12-21 17:34:16 +00:00
parent 24b374f545
commit fa8110ce8f
44 changed files with 248 additions and 306 deletions

View file

@ -83,24 +83,17 @@ AccumulationVolume::AccumulationVolume()
mObjToWorld.identity();
mWorldToObj.identity();
// Accumulation Texture.
INIT_ASSET(Texture);
resetWorldBox();
}
AccumulationVolume::~AccumulationVolume()
{
mTexture = nullptr;
}
void AccumulationVolume::initPersistFields()
{
docsURL;
addProtectedField("textureAsset", TypeImageAssetId, Offset(mTextureAssetId, AccumulationVolume),
&_setTexture, &defaultProtectedGetFn, "Accumulation texture.");
addProtectedField( "texture", TypeStringFilename, Offset( mTextureName, AccumulationVolume ),
&_setTexture, &defaultProtectedGetFn, "Accumulation texture." );
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, AccumulationVolume, "Accumulation texture.")
Parent::initPersistFields();
}
@ -236,7 +229,7 @@ U32 AccumulationVolume::packUpdate( NetConnection *connection, U32 mask, BitStre
if (stream->writeFlag(mask & InitialUpdateMask))
{
PACK_ASSET(connection, Texture);
PACK_ASSET_REFACTOR(connection, Texture);
}
return retMask;
@ -248,7 +241,7 @@ void AccumulationVolume::unpackUpdate( NetConnection *connection, BitStream *str
if (stream->readFlag())
{
UNPACK_ASSET(connection, Texture);
UNPACK_ASSET_REFACTOR(connection, Texture);
//setTexture(mTextureName);
}
}
@ -307,7 +300,7 @@ void AccumulationVolume::refreshVolumes()
if ( object.isNull() ) continue;
if ( volume->containsPoint(object->getPosition()) )
object->mAccuTex = volume->getTextureResource();
object->mAccuTex = volume->getTexture();
}
}
}
@ -341,6 +334,6 @@ void AccumulationVolume::updateObject(SceneObject* object)
if ( volume.isNull() ) continue;
if ( volume->containsPoint(object->getPosition()) )
object->mAccuTex = volume->getTextureResource();
object->mAccuTex = volume->getTexture();
}
}

View file

@ -61,10 +61,7 @@ class AccumulationVolume : public ScenePolyhedralSpace
// SceneSpace.
void _renderObject( ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* overrideMat ) override;
DECLARE_IMAGEASSET(AccumulationVolume, Texture, onTextureChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_NET_SETGET(AccumulationVolume, Texture, -1);
void onTextureChanged() {}
DECLARE_IMAGEASSET_NET_REFACTOR(AccumulationVolume, Texture, GFXStaticTextureSRGBProfile, -1)
public:

View file

@ -591,7 +591,7 @@ const char* ImageAsset::getImageInfo()
return "";
}
DefineEngineMethod(ImageAsset, getImageFile, const char*, (), ,
DefineEngineMethod(ImageAsset, getImagePath, const char*, (), ,
"Gets the image filepath of this asset.\n"
"@return File path of the image file.")
{

View file

@ -612,6 +612,38 @@ public:
m##name##Asset = _in; \
} \
}; \
\
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;}
#define DECLARE_IMAGEASSET_NET_REFACTOR(className, name, profile, mask) \
private: \
AssetPtr<ImageAsset> m##name##Asset; \
public: \
void _set##name(StringTableEntry _in){ \
if(m##name##Asset.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]; \
} \
m##name##Asset = imageAssetId; \
} \
else \
{ \
m##name##Asset = _in; \
} \
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; } \

View file

@ -53,6 +53,52 @@ if (m##name##AssetId != StringTable->EmptyString())\
m##name##Asset = other.m##name##Asset;\
m##name = other.m##name
// copy constructor refactor
#define CLONE_ASSET_REFACTOR(name) \
m##name##Asset = other.m##name##Asset;\
//network send - datablock refactor
#define PACKDATA_ASSET_REFACTOR(name)\
if (stream->writeFlag(m##name##Asset.notNull()))\
{\
stream->writeString(m##name##Asset.getAssetId());\
}
//network recieve - datablock
#define UNPACKDATA_ASSET_REFACTOR(name)\
if (stream->readFlag())\
{\
_set##name(stream->readSTString());\
}
//network send - object-instance
#define PACK_ASSET_REFACTOR(netconn, name)\
if (stream->writeFlag(m##name##Asset.notNull()))\
{\
NetStringHandle assetIdStr = m##name##Asset.getAssetId();\
netconn->packNetStringHandleU(stream, assetIdStr);\
}
//network recieve - object-instance
#define UNPACK_ASSET_REFACTOR(netconn, name)\
if (stream->readFlag())\
{\
_set##name(netconn->unpackNetStringHandleU(stream).getString());\
}
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
{\
return object->get##name##Asset()->getImageFile(); \
}\
DefineEngineMethod(className, get##name##Asset, StringTableEntry, (), , assetText(name, asset reference))\
{\
return object->_get##name(); \
}\
DefineEngineMethod(className, set##name, void, (const char* assetName), , assetText(name,assignment. first tries asset then flat file.))\
{\
object->_set##name(StringTable->insert(assetName));\
}
// addProtectedField acessors
#define DECLARE_ASSET_SETGET(className, name)\
static bool _set##name##Data(void* obj, const char* index, const char* data)\

View file

@ -122,9 +122,6 @@ ParticleData::ParticleData()
animTexFramesString = NULL; // string of animation frame indices
animTexUVs = NULL; // array of tile vertex UVs
INIT_ASSET(Texture);
INIT_ASSET(TextureExt);
constrain_pos = false;
start_angle = 0.0f;
angle_variance = 0.0f;
@ -149,12 +146,7 @@ void ParticleData::initPersistFields()
{
docsURL;
addGroup("Basic");
addProtectedField("textureName", TYPEID< StringTableEntry >(), Offset(mTextureName, ParticleData), _setTextureData, defaultProtectedGetFn,
"Texture file to use for this particle.", AbstractClassRep::FIELD_HideInInspectors);
addField("animTexName", TYPEID< StringTableEntry >(), Offset(mTextureName, ParticleData),
"@brief Texture file to use for this particle if animateTexture is true.\n\n"
"Deprecated. Use textureName instead.", AbstractClassRep::FIELD_HideInInspectors);
INITPERSISTFIELD_IMAGEASSET(Texture, ParticleData, "Texture to use for this particle.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, ParticleData, "Texture 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, "
@ -239,8 +231,7 @@ void ParticleData::initPersistFields()
endGroup("Over Time");
addGroup("AFX");
addProtectedField("textureExtName", TypeFilename, Offset(mTextureExtName, ParticleData), _setTextureExtData, &defaultProtectedGetFn, "", AbstractClassRep::FIELD_HideInInspectors);
INITPERSISTFIELD_IMAGEASSET(TextureExt, ParticleData, "");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(TextureExt, ParticleData, "");
addField("constrainPos", TypeBool, Offset(constrain_pos, ParticleData));
addField("angle", TypeF32, Offset(start_angle, ParticleData));
addField("angleVariance", TypeF32, Offset(angle_variance, ParticleData));
@ -305,7 +296,7 @@ void ParticleData::packData(BitStream* stream)
stream->writeFloat( times[i], 8);
}
PACKDATA_ASSET(Texture);
PACKDATA_ASSET_REFACTOR(Texture);
for (i = 0; i < 4; i++)
mathWrite(*stream, texCoords[i]);
@ -319,7 +310,7 @@ void ParticleData::packData(BitStream* stream)
stream->writeInt(framesPerSec, 8);
}
PACKDATA_ASSET(TextureExt);
PACKDATA_ASSET_REFACTOR(TextureExt);
stream->writeFlag(constrain_pos);
stream->writeFloat(start_angle/360.0f, 11);
@ -390,7 +381,7 @@ void ParticleData::unpackData(BitStream* stream)
times[i] = stream->readFloat(8);
}
UNPACKDATA_ASSET(Texture);
UNPACKDATA_ASSET_REFACTOR(Texture);
for (i = 0; i < 4; i++)
mathRead(*stream, &texCoords[i]);
@ -403,7 +394,7 @@ void ParticleData::unpackData(BitStream* stream)
framesPerSec = stream->readInt(8);
}
UNPACKDATA_ASSET(TextureExt);
UNPACKDATA_ASSET_REFACTOR(TextureExt);
constrain_pos = stream->readFlag();
start_angle = 360.0f*stream->readFloat(11);
@ -698,13 +689,6 @@ bool ParticleData::reload(char errorBuffer[256])
{
bool error = false;
StringTableEntry particleTex = getTexture();
if (!_setTexture(particleTex))
{
dSprintf(errorBuffer, 256, "Missing particle texture: %s", particleTex);
}
/*
numFrames = 0;
for( S32 i=0; i<PDC_MAX_TEX; i++ )
@ -775,12 +759,12 @@ ParticleData::ParticleData(const ParticleData& other, bool temp_clone) : SimData
animTexFramesString = other.animTexFramesString;
animTexFrames = other.animTexFrames; // -- parsed from animTexFramesString
CLONE_ASSET(Texture);
CLONE_ASSET_REFACTOR(Texture);
spinBias = other.spinBias;
randomizeSpinDir = other.randomizeSpinDir;
CLONE_ASSET(TextureExt);
CLONE_ASSET_REFACTOR(TextureExt);
constrain_pos = other.constrain_pos;
start_angle = other.start_angle;
@ -816,4 +800,4 @@ void ParticleData::onPerformSubstitutions()
reload(errorBuffer);
}
DEF_ASSET_BINDS(ParticleData, Texture);
DEF_ASSET_BINDS_REFACTOR(ParticleData, Texture);

View file

@ -86,14 +86,11 @@ class ParticleData : public SimDataBlock
StringTableEntry animTexFramesString;
Vector<U8> animTexFrames;
DECLARE_IMAGEASSET(ParticleData, Texture, onImageChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(ParticleData, Texture);
DECLARE_IMAGEASSET_REFACTOR(ParticleData, Texture, GFXStaticTextureSRGBProfile)
static bool protectedSetSizes(void* object, const char* index, const char* data);
static bool protectedSetTimes(void* object, const char* index, const char* data);
void onImageChanged() {}
public:
ParticleData();
~ParticleData();
@ -117,8 +114,7 @@ public:
F32 spinBias;
bool randomizeSpinDir;
public:
DECLARE_IMAGEASSET(ParticleData, TextureExt, onImageChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(ParticleData, TextureExt);
DECLARE_IMAGEASSET_REFACTOR(ParticleData, TextureExt,GFXStaticTextureSRGBProfile)
bool constrain_pos;
F32 start_angle;

View file

@ -742,11 +742,11 @@ bool ParticleEmitterData::preload(bool server, String &errorStr)
// otherwise, check that all particles refer to the same texture
else if (particleDataBlocks.size() > 1)
{
StringTableEntry txr_name = particleDataBlocks[0]->getTexture();
StringTableEntry txr_name = particleDataBlocks[0]->getTextureAsset()->getImageFile();
for (S32 i = 1; i < particleDataBlocks.size(); i++)
{
// warn if particle textures are inconsistent
if (particleDataBlocks[i]->getTexture() != txr_name)
if (particleDataBlocks[i]->getTextureAsset()->getImageFile() != txr_name)
{
Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) particles reference different textures.", getName());
break;
@ -1227,7 +1227,7 @@ void ParticleEmitter::prepRenderImage(SceneRenderState* state)
if (mDataBlock->textureHandle)
ri->diffuseTex = &*(mDataBlock->textureHandle);
else
ri->diffuseTex = &*(part_list_head.next->dataBlock->getTextureResource());
ri->diffuseTex = &*(part_list_head.next->dataBlock->getTexture());
ri->softnessDistance = mDataBlock->softnessDistance;

View file

@ -129,12 +129,8 @@ PrecipitationData::PrecipitationData()
{
INIT_ASSET(Sound);
INIT_ASSET(Drop);
mDropShaderName = StringTable->EmptyString();
INIT_ASSET(Splash);
mSplashShaderName = StringTable->EmptyString();
mDropsPerSide = 4;
@ -145,14 +141,8 @@ void PrecipitationData::initPersistFields()
{
docsURL;
INITPERSISTFIELD_SOUNDASSET(Sound, PrecipitationData, "Looping SFXProfile effect to play while Precipitation is active.");
addProtectedField( "dropTexture", TypeFilename, Offset(mDropName, PrecipitationData), &_setDropData, &defaultProtectedGetFn,
"@brief Texture filename 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.", AbstractClassRep::FIELD_HideInInspectors );
INITPERSISTFIELD_IMAGEASSET(Drop, PrecipitationData, "@brief Texture for drop particles.\n\n"
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Drop, PrecipitationData, "@brief Texture 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.");
@ -160,13 +150,7 @@ void PrecipitationData::initPersistFields()
addField( "dropShader", TypeString, Offset(mDropShaderName, PrecipitationData),
"The name of the shader used for raindrops." );
addProtectedField("splashTexture", TypeFilename, Offset(mSplashName, PrecipitationData), &_setSplashData, &defaultProtectedGetFn,
"@brief Texture filename 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.", AbstractClassRep::FIELD_HideInInspectors);
INITPERSISTFIELD_IMAGEASSET(Splash, PrecipitationData, "@brief Texture for splash particles.\n\n"
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Splash, PrecipitationData, "@brief Texture 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.");
@ -206,11 +190,11 @@ void PrecipitationData::packData(BitStream* stream)
PACKDATA_ASSET(Sound);
PACKDATA_ASSET(Drop);
PACKDATA_ASSET_REFACTOR(Drop);
stream->writeString(mDropShaderName);
PACKDATA_ASSET(Splash);
PACKDATA_ASSET_REFACTOR(Splash);
stream->writeString(mSplashShaderName);
stream->write(mDropsPerSide);
@ -223,11 +207,11 @@ void PrecipitationData::unpackData(BitStream* stream)
UNPACKDATA_ASSET(Sound);
UNPACKDATA_ASSET(Drop);
UNPACKDATA_ASSET_REFACTOR(Drop);
mDropShaderName = stream->readSTString();
UNPACKDATA_ASSET(Splash);
UNPACKDATA_ASSET_REFACTOR(Splash);
mSplashShaderName = stream->readSTString();
stream->read(&mDropsPerSide);
@ -632,10 +616,10 @@ void Precipitation::initMaterials()
mDropShader = NULL;
mSplashShader = NULL;
if(pd->mDrop.isNull())
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->getDrop());
if(pd->getDropAsset().isNull())
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->getDropAsset().getAssetId());
else
mDropHandle = pd->mDrop;
mDropHandle = pd->getDrop();
if ( dStrlen(pd->mDropShaderName) > 0 )
{
@ -655,10 +639,10 @@ void Precipitation::initMaterials()
}
}
if (pd->mSplash.isNull())
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->getSplash());
if (pd->getSplashAsset().isNull())
Con::warnf("Precipitation::initMaterials - failed to locate texture '%s'!", pd->getSplashAsset().getAssetId());
else
mSplashHandle = pd->mSplash;
mSplashHandle = pd->getSplash();
if ( dStrlen(pd->mSplashShaderName) > 0 )
{

View file

@ -49,13 +49,11 @@ class PrecipitationData : public GameBaseData
DECLARE_SOUNDASSET(PrecipitationData, Sound);
DECLARE_ASSET_SETGET(PrecipitationData, Sound);
DECLARE_IMAGEASSET(PrecipitationData, Drop, onDropChanged, GFXStaticTextureSRGBProfile); ///< Texture for drop particles
DECLARE_ASSET_SETGET(PrecipitationData, Drop);
DECLARE_IMAGEASSET_REFACTOR(PrecipitationData, Drop, GFXStaticTextureSRGBProfile) ///< Texture for drop particles
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
DECLARE_IMAGEASSET(PrecipitationData, Splash, onSplashChanged, GFXStaticTextureSRGBProfile); ///< Texture for splash particles
DECLARE_ASSET_SETGET(PrecipitationData, Splash);
DECLARE_IMAGEASSET_REFACTOR(PrecipitationData, Splash, GFXStaticTextureSRGBProfile) ///< Texture for splash particles
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
@ -68,9 +66,6 @@ class PrecipitationData : public GameBaseData
static void initPersistFields();
void packData(BitStream* stream) override;
void unpackData(BitStream* stream) override;
void onDropChanged() {}
void onSplashChanged() {}
};
struct Raindrop

View file

@ -53,7 +53,6 @@ GameMode::GameMode() :
mIsActive(false),
mIsAlwaysActive(false)
{
INIT_ASSET(PreviewImage);
}
void GameMode::initPersistFields()
@ -63,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");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(PreviewImage, GameMode, "Preview Image");
addField("active", TypeBool, Offset(mIsActive, GameMode), "Is the gamemode active");
addField("alwaysActive", TypeBool, Offset(mIsAlwaysActive, GameMode), "Is the gamemode always active");

View file

@ -21,8 +21,7 @@ private:
StringTableEntry mGameModeName;
StringTableEntry mGameModeDesc;
DECLARE_IMAGEASSET(GameMode, PreviewImage, previewChange, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(GameMode, PreviewImage);
DECLARE_IMAGEASSET_REFACTOR(GameMode, PreviewImage, GFXStaticTextureSRGBProfile)
bool mIsActive;
bool mIsAlwaysActive;
@ -45,8 +44,6 @@ public:
static void findGameModes(const char* gameModeList, Vector<GameMode*>* outGameModes);
void previewChange() {}
DECLARE_CALLBACK(void, onActivated, ());
DECLARE_CALLBACK(void, onDeactivated, ());
DECLARE_CALLBACK(void, onSceneLoaded, ());

View file

@ -102,8 +102,6 @@ LevelInfo::LevelInfo()
mAdvancedLightmapSupport = true;
INIT_ASSET(AccuTexture);
// Register with the light manager activation signal, and we need to do it first
// so the advanced light bin manager can be instructed about MRT lightmaps
LightManager::smActivateSignal.notify(this, &LevelInfo::_onLMActivate, 0.01f);
@ -114,9 +112,8 @@ LevelInfo::LevelInfo()
LevelInfo::~LevelInfo()
{
LightManager::smActivateSignal.remove(this, &LevelInfo::_onLMActivate);
if (!mAccuTexture.isNull())
if (!mAccuTextureAsset.isNull())
{
mAccuTexture.free();
gLevelAccuMap.free();
}
}
@ -174,7 +171,7 @@ 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.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(AccuTexture, LevelInfo, "Accumulation texture.");
endGroup( "Lighting" );
@ -224,7 +221,7 @@ U32 LevelInfo::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
sfxWrite( stream, mSoundAmbience );
stream->writeInt( mSoundDistanceModel, 1 );
PACK_ASSET(conn, AccuTexture);
PACK_ASSET_REFACTOR(conn, AccuTexture);
return retMask;
}
@ -273,8 +270,8 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream)
SFX->setDistanceModel( mSoundDistanceModel );
}
UNPACK_ASSET(conn, AccuTexture);
setLevelAccuTexture(getAccuTexture());
UNPACK_ASSET_REFACTOR(conn, AccuTexture);
setLevelAccuTexture();
}
//-----------------------------------------------------------------------------
@ -370,24 +367,12 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable)
#endif
}
bool LevelInfo::_setLevelAccuTexture(void *object, const char *index, const char *data)
void LevelInfo::setLevelAccuTexture()
{
LevelInfo* volume = reinterpret_cast< LevelInfo* >(object);
volume->setLevelAccuTexture(StringTable->insert(data));
return false;
}
void LevelInfo::setLevelAccuTexture(StringTableEntry name)
{
_setAccuTexture(name);
if (isClientObject() && getAccuTexture() != StringTable->EmptyString())
if (isClientObject() && mAccuTextureAsset.notNull())
{
if (mAccuTexture.isNull())
Con::warnf("AccumulationVolume::setTexture - Unable to load texture: %s", getAccuTexture());
else
gLevelAccuMap = mAccuTexture;
gLevelAccuMap = getAccuTexture();
}
AccumulationVolume::refreshVolumes();
}

View file

@ -106,10 +106,7 @@ class LevelInfo : public NetObject
void _onLMActivate(const char *lm, bool enable);
protected:
DECLARE_IMAGEASSET(LevelInfo, AccuTexture, onAccuTextureChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(LevelInfo, AccuTexture);
void onAccuTextureChanged() {}
DECLARE_IMAGEASSET_REFACTOR(LevelInfo, AccuTexture, GFXStaticTextureSRGBProfile)
public:
@ -146,8 +143,7 @@ class LevelInfo : public NetObject
U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream ) override;
void unpackUpdate( NetConnection *conn, BitStream *stream ) override;
static bool _setLevelAccuTexture(void *object, const char *index, const char *data);
void setLevelAccuTexture(StringTableEntry name);
void setLevelAccuTexture();
/// @}
};

View file

@ -132,8 +132,6 @@ LightFlareData::LightFlareData()
for ( U32 i = 0; i < MAX_ELEMENTS; i++ )
mElementDist[i] = -1.0f;
INIT_ASSET(FlareTexture);
}
LightFlareData::~LightFlareData()
@ -161,7 +159,7 @@ 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.");
INITPERSISTFIELD_IMAGEASSET_REFACTOR(FlareTexture, LightFlareData, "The texture / sprite sheet for this flare.");
addArray( "Elements", MAX_ELEMENTS );
@ -220,7 +218,7 @@ void LightFlareData::packData( BitStream *stream )
stream->writeFlag( mFlareEnabled );
PACKDATA_ASSET(FlareTexture);
PACKDATA_ASSET_REFACTOR(FlareTexture);
stream->write( mScale );
stream->write( mOcclusionRadius );
@ -245,7 +243,7 @@ void LightFlareData::unpackData( BitStream *stream )
mFlareEnabled = stream->readFlag();
UNPACKDATA_ASSET(FlareTexture);
UNPACKDATA_ASSET_REFACTOR(FlareTexture);
stream->read( &mScale );
stream->read( &mOcclusionRadius );
@ -540,7 +538,7 @@ void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareS
GFXVertexPCT *vert = flareState->vertBuffer.lock();
const Point2F oneOverTexSize( 1.0f / (F32)mFlareTexture.getWidth(), 1.0f / (F32)mFlareTexture.getHeight() );
const Point2F oneOverTexSize( 1.0f / (F32)getFlareTexture().getWidth(), 1.0f / (F32)getFlareTexture().getHeight());
for ( U32 i = 0; i < mElementCount; i++ )
{
@ -614,7 +612,7 @@ void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareS
ri->bbModelViewProj = &MatrixF::Identity;
ri->count = elementCount;
ri->blendStyle = ParticleRenderInst::BlendGreyscale;
ri->diffuseTex = mFlareTexture;
ri->diffuseTex = getFlareTexture();
ri->softnessDistance = 1.0f;
ri->defaultKey = ri->diffuseTex ? (uintptr_t)ri->diffuseTex : (uintptr_t)ri->vertBuff; // Sort by texture too.

View file

@ -106,8 +106,6 @@ protected:
void _makePrimBuffer( GFXPrimitiveBufferHandle *pb, U32 count );
void _renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
void onImageChanged() {}
protected:
static const U32 LosMask;
@ -120,8 +118,7 @@ protected:
F32 mScale;
bool mFlareEnabled;
DECLARE_IMAGEASSET(LightFlareData, FlareTexture, onImageChanged, GFXStaticTextureSRGBProfile);
DECLARE_ASSET_SETGET(LightFlareData, FlareTexture);
DECLARE_IMAGEASSET_REFACTOR(LightFlareData, FlareTexture, GFXStaticTextureSRGBProfile)
F32 mOcclusionRadius;
bool mRenderReflectPass;