mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
all DECLARE_IMAGEASSET refactored
This commit is contained in:
parent
24b374f545
commit
fa8110ce8f
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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.")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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; } \
|
||||
|
|
|
|||
|
|
@ -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)\
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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, ());
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ void afxZodiacGroundPlaneRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void afxZodiacMeshRoadRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void afxZodiacPolysoupRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void afxZodiacTerrainRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ ConsoleDocClass( afxBillboardData,
|
|||
afxBillboardData::afxBillboardData()
|
||||
{
|
||||
color.set(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
INIT_ASSET(Texture);
|
||||
dimensions.set(1.0f, 1.0f);
|
||||
texCoords[0].set(0.0f, 0.0f);
|
||||
texCoords[1].set(0.0f, 1.0f);
|
||||
|
|
@ -66,7 +65,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
|
|||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
color = other.color;
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
dimensions = other.dimensions;
|
||||
texCoords[0] = other.texCoords[0];
|
||||
texCoords[1] = other.texCoords[1];
|
||||
|
|
@ -96,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.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, afxBillboardData, "An image 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 "
|
||||
|
|
@ -124,7 +123,7 @@ void afxBillboardData::packData(BitStream* stream)
|
|||
Parent::packData(stream);
|
||||
|
||||
stream->write(color);
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
mathWrite(*stream, dimensions);
|
||||
mathWrite(*stream, texCoords[0]);
|
||||
|
|
@ -141,7 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
|
|||
Parent::unpackData(stream);
|
||||
|
||||
stream->read(&color);
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mathRead(*stream, &dimensions);
|
||||
mathRead(*stream, &texCoords[0]);
|
||||
mathRead(*stream, &texCoords[1]);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxBillboardData, Texture, onChangeTexture, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_SETGET(afxBillboardData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxBillboardData, Texture, GFXStaticTextureSRGBProfile)
|
||||
|
||||
|
||||
LinearColorF color;
|
||||
|
|
@ -71,8 +70,6 @@ public:
|
|||
|
||||
static void initPersistFields();
|
||||
|
||||
void onChangeTexture() {}
|
||||
|
||||
DECLARE_CONOBJECT(afxBillboardData);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat
|
|||
GFXTransformSaver saver;
|
||||
GFX->multWorld(getRenderTransform());
|
||||
|
||||
GFX->setTexture(0, mDataBlock->mTexture);
|
||||
GFX->setTexture(0, mDataBlock->getTexture());
|
||||
|
||||
MatrixF worldmod = GFX->getWorldMatrix();
|
||||
MatrixF viewmod = GFX->getViewMatrix();
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ bool afxZodiacData::sPreferDestinationGradients = false;
|
|||
|
||||
afxZodiacData::afxZodiacData()
|
||||
{
|
||||
INIT_ASSET(Texture);
|
||||
|
||||
radius_xy = 1;
|
||||
vert_range.set(0.0f, 0.0f);
|
||||
start_ang = 0;
|
||||
|
|
@ -120,7 +118,7 @@ afxZodiacData::afxZodiacData()
|
|||
|
||||
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
vert_range = other.vert_range;
|
||||
|
|
@ -157,7 +155,7 @@ EndImplementEnumType;
|
|||
void afxZodiacData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, afxZodiacData, "An image 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),
|
||||
|
|
@ -270,7 +268,7 @@ void afxZodiacData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
stream->write(radius_xy);
|
||||
stream->write(vert_range.x);
|
||||
stream->write(vert_range.y);
|
||||
|
|
@ -295,7 +293,7 @@ void afxZodiacData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&vert_range.x);
|
||||
stream->read(&vert_range.y);
|
||||
|
|
@ -342,16 +340,9 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue)
|
|||
|
||||
void afxZodiacData::onPerformSubstitutions()
|
||||
{
|
||||
if (mTextureAssetId != StringTable->EmptyString())
|
||||
if (mTextureAsset.notNull())
|
||||
{
|
||||
mTextureAsset = mTextureAssetId;
|
||||
if (mTextureAsset.notNull())
|
||||
{
|
||||
if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle"))
|
||||
{
|
||||
mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
|
||||
}
|
||||
}
|
||||
getTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,8 @@ public:
|
|||
|
||||
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||
DECLARE_ASSET_SETGET(afxZodiacData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxZodiacData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
|
||||
F32 radius_xy;
|
||||
Point2F vert_range;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& colo
|
|||
z.color = color.toColorI();
|
||||
z.angle = mDegToRad(angle);
|
||||
z.zflags = zode->zflags;
|
||||
z.txr = &zode->mTexture;
|
||||
z.txr = zode->getTexture();
|
||||
|
||||
z.distance_max = zode->distance_max*zode->distance_max;
|
||||
z.distance_falloff = zode->distance_falloff*zode->distance_falloff;
|
||||
|
|
@ -84,7 +84,7 @@ void afxZodiacMgr::addInteriorZodiac(Point3F& pos, F32 radius, Point2F& vert_ran
|
|||
z.color = color.toColorI();
|
||||
z.angle = mDegToRad(angle);
|
||||
z.zflags = zode->zflags;
|
||||
z.txr = &zode->mTexture;
|
||||
z.txr = zode->getTexture();
|
||||
|
||||
z.distance_max = zode->distance_max*zode->distance_max;
|
||||
z.distance_falloff = zode->distance_falloff*zode->distance_falloff;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ private:
|
|||
ColorI color; // 4// color of zodiac
|
||||
F32 angle; // 4// angle in radians
|
||||
U32 zflags; // 4// 0=normal,1=additive,2=subtractive
|
||||
GFXTexHandle* txr; // 4// zodiac texture
|
||||
GFXTexHandle txr; // 4// zodiac texture
|
||||
|
||||
F32 distance_max;
|
||||
F32 distance_falloff;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ ConsoleDocClass( afxZodiacPlaneData,
|
|||
|
||||
afxZodiacPlaneData::afxZodiacPlaneData()
|
||||
{
|
||||
INIT_ASSET(Texture);
|
||||
|
||||
radius_xy = 1;
|
||||
start_ang = 0;
|
||||
ang_per_sec = 0;
|
||||
|
|
@ -71,7 +69,7 @@ afxZodiacPlaneData::afxZodiacPlaneData()
|
|||
afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone)
|
||||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
start_ang = other.start_ang;
|
||||
|
|
@ -112,7 +110,7 @@ EndImplementEnumType;
|
|||
void afxZodiacPlaneData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
|
||||
addField("radius", TypeF32, myOffset(radius_xy),
|
||||
"The zodiac's radius in scene units.");
|
||||
|
|
@ -166,7 +164,7 @@ void afxZodiacPlaneData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
stream->write(radius_xy);
|
||||
stream->write(start_ang);
|
||||
|
|
@ -185,7 +183,7 @@ void afxZodiacPlaneData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&start_ang);
|
||||
|
|
|
|||
|
|
@ -56,11 +56,8 @@ public:
|
|||
FACES_BITS = 3
|
||||
};
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||
DECLARE_ASSET_SETGET(afxZodiacPlaneData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxZodiacPlaneData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
|
||||
F32 radius_xy;
|
||||
F32 start_ang;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState*
|
|||
GFXTransformSaver saver;
|
||||
GFX->multWorld(getRenderTransform());
|
||||
|
||||
GFX->setTexture(0, mDataBlock->mTexture);
|
||||
GFX->setTexture(0, mDataBlock->getTexture());
|
||||
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void afxParticlePool::pool_renderObject_Normal(RenderPassManager *renderManager,
|
|||
if (main_emitter_data->textureHandle)
|
||||
ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTexture());
|
||||
|
||||
ri->softnessDistance = main_emitter_data->softnessDistance;
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ void afxParticlePool::pool_renderObject_TwoPass(RenderPassManager *renderManager
|
|||
//if (main_emitter_data->textureHandle)
|
||||
// ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
//else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureExtResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureExt());
|
||||
|
||||
F32 save_sort_dist = ri->sortDistSq;
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ void afxParticlePool::pool_renderObject_TwoPass(RenderPassManager *renderManager
|
|||
if (main_emitter_data->textureHandle)
|
||||
ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTexture());
|
||||
|
||||
ri->softnessDistance = main_emitter_data->softnessDistance;
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ VolumetricFog::VolumetricFog()
|
|||
mFrontBufferTarget = NULL;
|
||||
|
||||
z_buf = NULL;
|
||||
mTexture = NULL;
|
||||
|
||||
mIsVBDirty = false;
|
||||
mIsPBDirty = false;
|
||||
|
|
@ -138,7 +137,6 @@ VolumetricFog::VolumetricFog()
|
|||
mSpeed2.set(0.1f, 0.1f);
|
||||
|
||||
INIT_ASSET(Shape);
|
||||
INIT_ASSET(Texture);
|
||||
}
|
||||
|
||||
VolumetricFog::~VolumetricFog()
|
||||
|
|
@ -159,8 +157,6 @@ VolumetricFog::~VolumetricFog()
|
|||
|
||||
z_buf = NULL;
|
||||
|
||||
if (!mTexture.isNull())
|
||||
mTexture.free();
|
||||
}
|
||||
|
||||
void VolumetricFog::initPersistFields()
|
||||
|
|
@ -185,7 +181,7 @@ 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.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, VolumetricFog, "A texture which contains Fogdensity modulator in the red channel and color with 1-green channel. No texture disables modulation.");
|
||||
|
||||
addField("tiles", TypeF32, Offset(mTexTiles, VolumetricFog),
|
||||
"How many times the texture is mapped to the object.");
|
||||
|
|
@ -330,8 +326,10 @@ void VolumetricFog::handleResize(VolumetricFogRTManager *RTM, bool resize)
|
|||
F32 width = (F32)mPlatformWindow->getClientExtent().x;
|
||||
F32 height = (F32)mPlatformWindow->getClientExtent().y;
|
||||
|
||||
mTexScale.x = 2.0f - ((F32)mTexture.getWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTexture.getHeight() / height);
|
||||
// load texture.
|
||||
getTexture();
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAsset->getTextureWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAsset->getTextureHeight() / height);
|
||||
}
|
||||
|
||||
UpdateBuffers(0,true);
|
||||
|
|
@ -545,7 +543,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->write(mFogDensity);
|
||||
if (stream->writeFlag(mask & FogModulationMask))
|
||||
{
|
||||
PACK_ASSET(con, Texture);
|
||||
PACK_ASSET_REFACTOR(con, Texture);
|
||||
mTexTiles = mFabs(mTexTiles);
|
||||
stream->write(mTexTiles);
|
||||
stream->write(mStrength);
|
||||
|
|
@ -597,7 +595,7 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
MatrixF mat;
|
||||
VectorF scale;
|
||||
VectorF mOldScale = getScale();
|
||||
StringTableEntry oldTextureName = mTextureAssetId;
|
||||
StringTableEntry oldTextureName = mTextureAsset.getAssetId();
|
||||
StringTableEntry oldShapeAsset = mShapeAssetId;
|
||||
StringTableEntry oldShape = mShapeName;
|
||||
|
||||
|
|
@ -615,7 +613,7 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
}
|
||||
if (stream->readFlag())// Fog Modulation
|
||||
{
|
||||
UNPACK_ASSET(con, Texture);
|
||||
UNPACK_ASSET_REFACTOR(con, Texture);
|
||||
stream->read(&mTexTiles);
|
||||
mTexTiles = mFabs(mTexTiles);
|
||||
stream->read(&mStrength);
|
||||
|
|
@ -625,12 +623,11 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
if (isProperlyAdded())
|
||||
{
|
||||
if (oldTextureName != mTextureAssetId)
|
||||
if (oldTextureName != mTextureAsset.getAssetId())
|
||||
InitTexture();
|
||||
if (oldTextureName != StringTable->EmptyString() && mTextureAssetId == StringTable->EmptyString())
|
||||
if (oldTextureName != StringTable->EmptyString() && mTextureAsset.isNull())
|
||||
{
|
||||
mIsTextured = false;
|
||||
mTexture.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1149,7 +1146,7 @@ void VolumetricFog::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMa
|
|||
|
||||
if (mIsTextured && mStrength > 0.0f)
|
||||
{
|
||||
GFX->setTexture(3, mTexture);
|
||||
GFX->setTexture(3, getTexture());
|
||||
mShaderConsts->setSafe(mIsTexturedSC, 1.0f);
|
||||
}
|
||||
else
|
||||
|
|
@ -1222,15 +1219,16 @@ void VolumetricFog::InitTexture()
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (!mTexture.isNull())
|
||||
if (!mTextureAsset.isNull())
|
||||
{
|
||||
mIsTextured = true;
|
||||
|
||||
// load asset.
|
||||
getTexture();
|
||||
F32 width = (F32)mPlatformWindow->getClientExtent().x;
|
||||
F32 height = (F32)mPlatformWindow->getClientExtent().y;
|
||||
|
||||
mTexScale.x = 2.0f - ((F32)mTexture.getWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTexture.getHeight() / height);
|
||||
mTexScale.x = 2.0f - ((F32)mTextureAsset->getTextureWidth() / width);
|
||||
mTexScale.y = 2.0f - ((F32)mTextureAsset->getTextureHeight() / height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,8 +162,7 @@ class VolumetricFog : public SceneObject
|
|||
F32 mInvScale;
|
||||
|
||||
// Fog Modulation data
|
||||
DECLARE_IMAGEASSET(VolumetricFog, Texture, onImageChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_NET_SETGET(VolumetricFog, Texture, FogModulationMask);
|
||||
DECLARE_IMAGEASSET_NET_REFACTOR(VolumetricFog, Texture, GFXStaticTextureSRGBProfile, FogModulationMask)
|
||||
|
||||
bool mIsTextured;
|
||||
F32 mTexTiles;
|
||||
|
|
@ -221,8 +220,6 @@ class VolumetricFog : public SceneObject
|
|||
|
||||
static bool _setShapeAsset(void* obj, const char* index, const char* data);
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
// Public methods
|
||||
VolumetricFog();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
DECLARE_IMAGEASSET_REFACTOR(CloudLayer,Texture, GFXStaticTextureSRGBProfile)
|
||||
DECLARE_IMAGEASSET_NET_REFACTOR(CloudLayer,Texture, GFXStaticTextureSRGBProfile, CloudLayerMask)
|
||||
|
||||
GFXShaderRef mShader;
|
||||
|
||||
|
|
|
|||
|
|
@ -260,10 +260,6 @@ WaterObject::WaterObject()
|
|||
mMatrixSet = reinterpret_cast<MatrixSet *>(dMalloc_aligned(sizeof(MatrixSet), 16));
|
||||
constructInPlace(mMatrixSet);
|
||||
|
||||
INIT_ASSET(RippleTex);
|
||||
INIT_ASSET(FoamTex);
|
||||
INIT_ASSET(DepthGradientTex);
|
||||
|
||||
mCubemapName = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +296,7 @@ void WaterObject::initPersistFields()
|
|||
addField( "overallWaveMagnitude", TypeF32, Offset( mOverallWaveMagnitude, WaterObject ), "Master variable affecting entire body"
|
||||
" of water's undulation" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(RippleTex, WaterObject, "Normal map used to simulate small surface ripples");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(RippleTex, WaterObject, "Normal map used to simulate small surface ripples");
|
||||
|
||||
addArray( "Ripples (texture animation)", MAX_WAVES );
|
||||
|
||||
|
|
@ -314,7 +310,7 @@ void WaterObject::initPersistFields()
|
|||
|
||||
addField( "overallRippleMagnitude", TypeF32, Offset( mOverallRippleMagnitude, WaterObject ), "Master variable affecting entire surface");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(FoamTex, WaterObject, "Diffuse texture for foam in shallow water (advanced lighting only)");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(FoamTex, WaterObject, "Diffuse texture for foam in shallow water (advanced lighting only)");
|
||||
|
||||
addArray( "Foam", MAX_FOAM );
|
||||
|
||||
|
|
@ -366,7 +362,7 @@ void WaterObject::initPersistFields()
|
|||
|
||||
addGroup( "Misc" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(DepthGradientTex, WaterObject, "1D texture defining the base water color by depth");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(DepthGradientTex, WaterObject, "1D texture defining the base water color by depth");
|
||||
|
||||
addField( "depthGradientMax", TypeF32, Offset( mDepthGradientMax, WaterObject ), "Depth in world units, the max range of the color gradient texture." );
|
||||
|
||||
|
|
@ -547,9 +543,9 @@ U32 WaterObject::packUpdate( NetConnection * conn, U32 mask, BitStream *stream )
|
|||
|
||||
if ( stream->writeFlag( mask & TextureMask ) )
|
||||
{
|
||||
PACK_ASSET(conn, RippleTex);
|
||||
PACK_ASSET(conn, DepthGradientTex);
|
||||
PACK_ASSET(conn, FoamTex);
|
||||
PACK_ASSET_REFACTOR(conn, RippleTex);
|
||||
PACK_ASSET_REFACTOR(conn, DepthGradientTex);
|
||||
PACK_ASSET_REFACTOR(conn, FoamTex);
|
||||
|
||||
stream->writeString( mCubemapName );
|
||||
}
|
||||
|
|
@ -669,9 +665,9 @@ void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream )
|
|||
// TextureMask
|
||||
if ( stream->readFlag() )
|
||||
{
|
||||
UNPACK_ASSET(conn, RippleTex);
|
||||
UNPACK_ASSET(conn, DepthGradientTex);
|
||||
UNPACK_ASSET(conn, FoamTex);
|
||||
UNPACK_ASSET_REFACTOR(conn, RippleTex);
|
||||
UNPACK_ASSET_REFACTOR(conn, DepthGradientTex);
|
||||
UNPACK_ASSET_REFACTOR(conn, FoamTex);
|
||||
|
||||
mCubemapName = stream->readSTString();
|
||||
|
||||
|
|
@ -767,13 +763,13 @@ void WaterObject::renderObject( ObjectRenderInst *ri, SceneRenderState *state, B
|
|||
void WaterObject::setCustomTextures( S32 matIdx, U32 pass, const WaterMatParams ¶mHandles )
|
||||
{
|
||||
// Always use the ripple texture.
|
||||
GFX->setTexture( paramHandles.mRippleSamplerSC->getSamplerRegister(pass), mRippleTex );
|
||||
GFX->setTexture( paramHandles.mRippleSamplerSC->getSamplerRegister(pass), getRippleTex() );
|
||||
|
||||
// Only above-water in advanced-lighting uses the foam texture.
|
||||
if ( matIdx == WaterMat )
|
||||
{
|
||||
GFX->setTexture( paramHandles.mFoamSamplerSC->getSamplerRegister(pass), mFoamTex );
|
||||
GFX->setTexture( paramHandles.mDepthGradSamplerSC->getSamplerRegister(pass), mDepthGradientTex );
|
||||
GFX->setTexture( paramHandles.mFoamSamplerSC->getSamplerRegister(pass), getFoamTex() );
|
||||
GFX->setTexture( paramHandles.mDepthGradSamplerSC->getSamplerRegister(pass), getDepthGradientTex() );
|
||||
}
|
||||
|
||||
if ( ( matIdx == WaterMat || matIdx == BasicWaterMat ) && mCubemap )
|
||||
|
|
@ -1118,7 +1114,7 @@ void WaterObject::updateUnderwaterEffect( SceneRenderState *state )
|
|||
// be fetched by the effect when it renders.
|
||||
if ( !mNamedDepthGradTex.isRegistered() )
|
||||
mNamedDepthGradTex.registerWithName( "waterDepthGradMap" );
|
||||
mNamedDepthGradTex.setTexture( mDepthGradientTex );
|
||||
mNamedDepthGradTex.setTexture( getDepthGradientTex() );
|
||||
}
|
||||
else
|
||||
effect->disable();
|
||||
|
|
@ -1172,7 +1168,7 @@ bool WaterObject::initMaterial( S32 idx )
|
|||
void WaterObject::initTextures()
|
||||
{
|
||||
if ( mNamedDepthGradTex.isRegistered() )
|
||||
mNamedDepthGradTex.setTexture( mDepthGradientTex );
|
||||
mNamedDepthGradTex.setTexture( getDepthGradientTex() );
|
||||
|
||||
if ( mCubemapName != StringTable->EmptyString() )
|
||||
Sim::findObject( mCubemapName, mCubemap );
|
||||
|
|
|
|||
|
|
@ -203,10 +203,6 @@ protected:
|
|||
/// Callback used internally when smEnableTrueReflections changes.
|
||||
void _onEnableTrueReflections();
|
||||
|
||||
void onRippleTexChanged() {}
|
||||
void onFoamTexChanged() {}
|
||||
void onDepthGradientTexChanged() {}
|
||||
|
||||
protected:
|
||||
|
||||
static bool _setFullReflect( void *object, const char *index, const char *data );
|
||||
|
|
@ -273,12 +269,9 @@ protected:
|
|||
F32 mDepthGradientMax;
|
||||
|
||||
// Other textures
|
||||
DECLARE_IMAGEASSET(WaterObject, RippleTex, onRippleTexChanged, GFXStaticTextureProfile);
|
||||
DECLARE_ASSET_NET_SETGET(WaterObject, RippleTex, TextureMask);
|
||||
DECLARE_IMAGEASSET(WaterObject, FoamTex, onFoamTexChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_NET_SETGET(WaterObject, FoamTex, TextureMask);
|
||||
DECLARE_IMAGEASSET(WaterObject, DepthGradientTex, onDepthGradientTexChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_NET_SETGET(WaterObject, DepthGradientTex, TextureMask);
|
||||
DECLARE_IMAGEASSET_NET_REFACTOR(WaterObject, RippleTex, GFXStaticTextureProfile, TextureMask)
|
||||
DECLARE_IMAGEASSET_NET_REFACTOR(WaterObject, FoamTex, GFXStaticTextureSRGBProfile, TextureMask)
|
||||
DECLARE_IMAGEASSET_NET_REFACTOR(WaterObject, DepthGradientTex, GFXStaticTextureSRGBProfile, TextureMask)
|
||||
|
||||
StringTableEntry mCubemapName;
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ bool TerrainCellMaterial::_initShader(bool deferredMat,
|
|||
|
||||
// We only include materials that
|
||||
// have more than a base texture.
|
||||
if (!(mat->DetailMapValid() && mat->getDetailSize() > 0 && mat->getDetailDistance()>0))
|
||||
if (!(mat->getDetailMap() && mat->getDetailSize() > 0 && mat->getDetailDistance()>0))
|
||||
continue;
|
||||
|
||||
if (deferredMat)
|
||||
|
|
@ -382,12 +382,12 @@ bool TerrainCellMaterial::_initShader(bool deferredMat,
|
|||
features.addFeature(MFT_TerrainDetailMap, featureIndex);
|
||||
|
||||
// check for macro detail texture
|
||||
if (mat->MacroMapValid() && mat->getMacroSize() > 0 && mat->getMacroDistance() > 0)
|
||||
if (mat->getMacroMap() && mat->getMacroSize() > 0 && mat->getMacroDistance() > 0)
|
||||
{
|
||||
features.addFeature(MFT_TerrainMacroMap, featureIndex);
|
||||
}
|
||||
|
||||
if (mat->ORMConfigMapValid())
|
||||
if (mat->getORMConfigMap())
|
||||
{
|
||||
features.addFeature(MFT_TerrainORMMap, featureIndex);
|
||||
}
|
||||
|
|
@ -401,12 +401,12 @@ bool TerrainCellMaterial::_initShader(bool deferredMat,
|
|||
|
||||
|
||||
// Skip normal maps if we need to.
|
||||
if (!disableNormalMaps && mat->NormalMapValid())
|
||||
if (!disableNormalMaps && mat->getNormalMap())
|
||||
{
|
||||
normalMaps.increment();
|
||||
features.addFeature(MFT_TerrainNormalMap, featureIndex);
|
||||
|
||||
normalMaps.last() = mat->getNormalMapResource();
|
||||
normalMaps.last() = mat->getNormalMap();
|
||||
|
||||
GFXFormat normalFmt = normalMaps.last().getFormat();
|
||||
if (normalFmt == GFXFormatBC3)
|
||||
|
|
@ -632,7 +632,7 @@ bool TerrainCellMaterial::_initShader(bool deferredMat,
|
|||
|
||||
// We only include materials that
|
||||
// have more than a base texture.
|
||||
if (!(mat->DetailMapValid() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
if (!(mat->getDetailMap() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
continue;
|
||||
|
||||
mMaterialInfos[i]->mBlendDepthConst = mShader->getShaderConstHandle(avar("$blendDepth%d", i));
|
||||
|
|
@ -676,7 +676,7 @@ void TerrainCellMaterial::_updateMaterialConsts( )
|
|||
if (mat == NULL)
|
||||
continue;
|
||||
|
||||
if (!(mat->DetailMapValid() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
if (!(mat->getDetailMap() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
continue;
|
||||
|
||||
detailMatCount++;
|
||||
|
|
@ -704,7 +704,7 @@ void TerrainCellMaterial::_updateMaterialConsts( )
|
|||
if (mat == NULL)
|
||||
continue;
|
||||
|
||||
if (!(mat->DetailMapValid() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
if (!(mat->getDetailMap() && mat->getDetailSize() > 0 && mat->getDetailDistance() > 0))
|
||||
continue;
|
||||
|
||||
F32 detailSize = matInfo->mat->getDetailSize();
|
||||
|
|
|
|||
|
|
@ -81,11 +81,6 @@ TerrainMaterial::TerrainMaterial()
|
|||
mIsSRGB(false),
|
||||
mInvertRoughness(false)
|
||||
{
|
||||
INIT_ASSET(DiffuseMap);
|
||||
INIT_ASSET(NormalMap);
|
||||
INIT_ASSET(DetailMap);
|
||||
INIT_ASSET(ORMConfigMap);
|
||||
INIT_ASSET(MacroMap);
|
||||
}
|
||||
|
||||
TerrainMaterial::~TerrainMaterial()
|
||||
|
|
@ -97,10 +92,10 @@ FRangeValidator hardnessValidator(0.0f, 0.999f);
|
|||
void TerrainMaterial::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map");
|
||||
addField( "diffuseSize", TypeF32, Offset( mDiffuseSize, TerrainMaterial ), "Used to scale the diffuse map to the material square" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(NormalMap, TerrainMaterial,"NormalMap");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(NormalMap, TerrainMaterial,"NormalMap");
|
||||
addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self "
|
||||
"occlusion effect (aka parallax) to the terrain material" );
|
||||
|
||||
|
|
@ -113,7 +108,7 @@ void TerrainMaterial::initPersistFields()
|
|||
addFieldV("blendHeightHardness", TypeF32, 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.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close.");
|
||||
addField( "detailSize", TypeF32, Offset( mDetailSize, TerrainMaterial ), "Used to scale the detail map to the material square" );
|
||||
addField( "detailStrength", TypeF32, Offset( mDetailStrength, TerrainMaterial ), "Exponentially sharpens or lightens the detail map rendering on the material" );
|
||||
addField( "detailDistance", TypeF32, Offset( mDetailDistance, TerrainMaterial ), "Changes how far camera can see the detail map rendering on the material" );
|
||||
|
|
@ -121,12 +116,12 @@ void TerrainMaterial::initPersistFields()
|
|||
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)");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(ORMConfigMap, TerrainMaterial, "AO|Roughness|metalness map (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.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(MacroMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo at a distance.");
|
||||
addField( "macroSize", TypeF32, Offset( mMacroSize, TerrainMaterial ), "Used to scale the Macro map to the material square" );
|
||||
addField( "macroStrength", TypeF32, Offset( mMacroStrength, TerrainMaterial ), "Exponentially sharpens or lightens the Macro map rendering on the material" );
|
||||
addField( "macroDistance", TypeF32, Offset( mMacroDistance, TerrainMaterial ), "Changes how far camera can see the Macro map rendering on the material" );
|
||||
|
|
@ -228,8 +223,8 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
|
|||
//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(TerrainMaterial, DiffuseMap);
|
||||
DEF_ASSET_BINDS(TerrainMaterial, NormalMap);
|
||||
DEF_ASSET_BINDS(TerrainMaterial, DetailMap);
|
||||
DEF_ASSET_BINDS(TerrainMaterial, ORMConfigMap);
|
||||
DEF_ASSET_BINDS(TerrainMaterial, MacroMap);
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -38,24 +38,17 @@ class TerrainMaterial : public SimObject
|
|||
protected:
|
||||
|
||||
///
|
||||
//FileName mDiffuseMap;
|
||||
|
||||
//AssetPtr<ImageAsset> mDiffuseAsset;
|
||||
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, DiffuseMap, onDiffuseMapChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_SETGET(TerrainMaterial, DiffuseMap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(TerrainMaterial, DiffuseMap, GFXStaticTextureSRGBProfile)
|
||||
|
||||
/// The size of the diffuse base map in meters
|
||||
/// used to generate its texture coordinates.
|
||||
F32 mDiffuseSize;
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, NormalMap, onNormalMapChanged, GFXNormalMapProfile);
|
||||
DECLARE_ASSET_SETGET(TerrainMaterial, NormalMap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(TerrainMaterial, NormalMap, GFXNormalMapProfile)
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, DetailMap, onDetailMapChanged, GFXStaticTextureProfile);
|
||||
DECLARE_ASSET_SETGET(TerrainMaterial, DetailMap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(TerrainMaterial, DetailMap, GFXStaticTextureProfile)
|
||||
|
||||
/// The size of the detail map in meters used
|
||||
/// to generate the texture coordinates for the
|
||||
|
|
@ -69,8 +62,7 @@ protected:
|
|||
F32 mDetailDistance;
|
||||
|
||||
///
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, ORMConfigMap, onORMConfigMapChanged, GFXStaticTextureProfile);
|
||||
DECLARE_ASSET_SETGET(TerrainMaterial, ORMConfigMap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(TerrainMaterial, ORMConfigMap, GFXStaticTextureProfile)
|
||||
|
||||
bool mIsSRGB;
|
||||
bool mInvertRoughness;
|
||||
|
|
@ -81,8 +73,8 @@ protected:
|
|||
/// planes.
|
||||
bool mSideProjection;
|
||||
|
||||
DECLARE_IMAGEASSET(TerrainMaterial, MacroMap, onMacroMapChanged, GFXStaticTextureProfile);
|
||||
DECLARE_ASSET_SETGET(TerrainMaterial, MacroMap);
|
||||
DECLARE_IMAGEASSET_REFACTOR(TerrainMaterial, MacroMap, GFXStaticTextureProfile)
|
||||
|
||||
F32 mMacroSize;
|
||||
F32 mMacroStrength;
|
||||
F32 mMacroDistance;
|
||||
|
|
@ -146,12 +138,6 @@ public:
|
|||
|
||||
bool getInvertRoughness() const { return mInvertRoughness; }
|
||||
|
||||
void onDiffuseMapChanged() {}
|
||||
void onNormalMapChanged() {}
|
||||
void onDetailMapChanged() {}
|
||||
void onORMConfigMapChanged() {}
|
||||
void onMacroMapChanged() {}
|
||||
|
||||
};
|
||||
|
||||
#endif // _TERRMATERIAL_H_
|
||||
|
|
|
|||
|
|
@ -96,19 +96,19 @@ void TerrainBlock::_updateMaterials()
|
|||
{
|
||||
TerrainMaterial *mat = mFile->mMaterials[i];
|
||||
|
||||
if (mat->getDiffuseMap() != StringTable->EmptyString())
|
||||
if (mat->getDiffuseMapAsset().notNull())
|
||||
{
|
||||
mBaseTextures[i] = mat->getDiffuseMapResource();
|
||||
mBaseTextures[i] = mat->getDiffuseMap();
|
||||
}
|
||||
else
|
||||
mBaseTextures[ i ] = GFXTexHandle();
|
||||
|
||||
// Find the maximum detail distance.
|
||||
if ( mat->getDetailMap() != StringTable->EmptyString() &&
|
||||
if ( mat->getDetailMapAsset().notNull() &&
|
||||
mat->getDetailDistance() > mMaxDetailDistance )
|
||||
mMaxDetailDistance = mat->getDetailDistance();
|
||||
|
||||
if ( mat->getMacroMap() != StringTable->EmptyString() &&
|
||||
if ( mat->getMacroMapAsset().notNull() &&
|
||||
mat->getMacroDistance() > mMaxDetailDistance )
|
||||
mMaxDetailDistance = mat->getMacroDistance();
|
||||
}
|
||||
|
|
@ -126,19 +126,19 @@ void TerrainBlock::_updateMaterials()
|
|||
{
|
||||
TerrainMaterial* mat = mFile->mMaterials[i];
|
||||
|
||||
if (mat->getDetailMap() != StringTable->EmptyString())
|
||||
detailTexArray[i] = mat->getDetailMapResource();
|
||||
if (mat->getMacroMap() != StringTable->EmptyString())
|
||||
macroTexArray[i] = mat->getMacroMapResource();
|
||||
if (mat->getNormalMap() != StringTable->EmptyString())
|
||||
normalTexArray[i] = mat->getNormalMapResource();
|
||||
if (mat->getDetailMapAsset().notNull())
|
||||
detailTexArray[i] = mat->getDetailMap();
|
||||
if (mat->getMacroMapAsset().notNull())
|
||||
macroTexArray[i] = mat->getMacroMap();
|
||||
if (mat->getNormalMapAsset().notNull())
|
||||
normalTexArray[i] = mat->getNormalMap();
|
||||
|
||||
//depending on creation method this may or may not have been shoved into srgb space eroneously
|
||||
GFXTextureProfile* profile = &GFXStaticTextureProfile;
|
||||
if (mat->getIsSRGB())
|
||||
profile = &GFXStaticTextureSRGBProfile;
|
||||
if (mat->getORMConfigMap() != StringTable->EmptyString())
|
||||
ormTexArray[i] = TEXMGR->createTexture(mat->getORMConfigMap(), profile);
|
||||
if (mat->getORMConfigMapAsset().notNull())
|
||||
ormTexArray[i] = mat->getORMConfigMapAsset()->getTexture(profile);
|
||||
}
|
||||
|
||||
if (mDetailTextureArray.isNull())
|
||||
|
|
|
|||
|
|
@ -1415,7 +1415,7 @@ singleton GuiControlProfile( ToolsGuiMenuBarProfile )
|
|||
|
||||
singleton GuiControlProfile( ToolsMenubarProfile : ToolsGuiDefaultProfile )
|
||||
{
|
||||
bitmap = "./menubar";
|
||||
bitmaAsset = "ToolsModule:menubar_image";
|
||||
category = "Editor";
|
||||
|
||||
opaque = true;
|
||||
|
|
@ -1433,7 +1433,7 @@ singleton GuiControlProfile (menubarProfile)
|
|||
border = -2;
|
||||
category = "Editor";
|
||||
|
||||
bitmap = "./menubar";
|
||||
bitmaAsset = "ToolsModule:menubar_image";
|
||||
category = "Editor";
|
||||
|
||||
fillColor = EditorSettings.value("Theme/windowBackgroundColor");
|
||||
|
|
@ -1447,35 +1447,35 @@ singleton GuiControlProfile (editorMenubarProfile)
|
|||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./editor-menubar";
|
||||
bitmaAsset = "ToolsModule:editor_menubar_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (editorMenu_wBorderProfile)
|
||||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./menu-fullborder";
|
||||
bitmaAsset = "ToolsModule:menu_fullborder_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (inspectorStyleRolloutProfile)
|
||||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./inspector-style-rollout";
|
||||
bitmaAsset = "ToolsModule:inspector_style_rollout_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (inspectorStyleRolloutListProfile)
|
||||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./inspector-style-rollout-list";
|
||||
bitmaAsset = "ToolsModule:inspector_style_rollout_list_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (inspectorStyleRolloutDarkProfile)
|
||||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./inspector-style-rollout-dark";
|
||||
bitmaAsset = "ToolsModule:inspector_style_rollout_dark_image";
|
||||
|
||||
fillColor = EditorSettings.value("Theme/windowBackgroundColor");
|
||||
fontColor = EditorSettings.value("Theme/headerTextColor");
|
||||
|
|
@ -1486,14 +1486,14 @@ singleton GuiControlProfile (inspectorStyleRolloutInnerProfile)
|
|||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./inspector-style-rollout_inner";
|
||||
bitmaAsset = "ToolsModule:inspector_style_rollout_inner_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (inspectorStyleRolloutNoHeaderProfile)
|
||||
{
|
||||
border = -2;
|
||||
category = "Editor";
|
||||
bitmap = "./inspector-style-rollout-noheader";
|
||||
bitmaAsset = "ToolsModule:inspector_style_rollout_noheader_image";
|
||||
category = "Editor";
|
||||
};
|
||||
singleton GuiControlProfile (IconDropdownProfile)
|
||||
|
|
@ -1502,7 +1502,6 @@ singleton GuiControlProfile (IconDropdownProfile)
|
|||
opaque = true;
|
||||
border = true;
|
||||
category = "Editor";
|
||||
//bitmap = "./icon-dropdownbar";
|
||||
|
||||
fillColor = EditorSettings.value("Theme/headerColor");
|
||||
};
|
||||
|
|
|
|||
|
|
@ -338,9 +338,9 @@ function RiverEditorGui::createRiver( %this )
|
|||
|
||||
baseColor = "45 108 171 255";
|
||||
|
||||
rippleTex = "Core_Rendering:ripple_image";
|
||||
foamTex = "Core_Rendering:foam_image";
|
||||
depthGradientTex = "Core_Rendering:depthcolor_ramp_image";
|
||||
RippleTexAsset = "Core_Rendering:ripple_image";
|
||||
FoamTexAsset = "Core_Rendering:foam_image";
|
||||
DepthGradientTexAsset = "Core_Rendering:depthcolor_ramp_image";
|
||||
};
|
||||
|
||||
return %river;
|
||||
|
|
|
|||
|
|
@ -1534,7 +1534,7 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) {
|
|||
internalName = "slider";
|
||||
position = "9 17";
|
||||
extent = "129 15";
|
||||
bitmap = "tools/gui/images/separator-h.png";
|
||||
bitmapAsset = "ToolsModule:separator_h_image";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
range = "1 200";
|
||||
|
|
|
|||
|
|
@ -1282,9 +1282,9 @@ function ObjectBuilderGui::addWaterObjectFields(%this)
|
|||
%this.addField("waveSpeed[2]", "TypeFloat", "Wave Speed", "1");
|
||||
%this.addField("overallWaveMagnitude", "TypeFloat", "Overall Wave Magnitude", "1.0");
|
||||
|
||||
%this.addField("rippleTex", "TypeImageAsset", "Ripple Texture", "Core_Rendering:ripple_image" );
|
||||
%this.addField("depthGradientTex", "TypeImageAsset", "Depth Gradient Texture", "Core_Rendering:depthcolor_ramp_image" );
|
||||
%this.addField("foamTex", "TypeImageAsset", "Foam Texture", "Core_Rendering:foam_image" );
|
||||
%this.addField("RippleTexAsset", "TypeImageAssetPtrRefactor", "Ripple Texture", "Core_Rendering:ripple_image" );
|
||||
%this.addField("DepthGradientTexAsset", "TypeImageAssetPtrRefactor", "Depth Gradient Texture", "Core_Rendering:depthcolor_ramp_image" );
|
||||
%this.addField("FoamTexAsset", "TypeImageAssetPtrRefactor", "Foam Texture", "Core_Rendering:foam_image" );
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildWaterBlock(%this)
|
||||
|
|
|
|||
Loading…
Reference in a new issue