Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into Preview4_0

This commit is contained in:
Areloch 2021-09-19 02:28:19 -05:00
commit 9a809dfb6b
10 changed files with 102 additions and 57 deletions

View file

@ -127,7 +127,7 @@ ConsoleDocClass( PrecipitationData,
//----------------------------------------------------------
PrecipitationData::PrecipitationData()
{
soundProfile = NULL;
INIT_SOUNDASSET(Sound);
INIT_IMAGEASSET(Drop);
@ -143,8 +143,7 @@ PrecipitationData::PrecipitationData()
void PrecipitationData::initPersistFields()
{
addField( "soundProfile", TYPEID< SFXTrack >(), Offset(soundProfile, PrecipitationData),
"Looping SFXProfile effect to play while Precipitation is active." );
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"
@ -190,7 +189,7 @@ bool PrecipitationData::preload( bool server, String &errorStr )
if( Parent::preload( server, errorStr) == false)
return false;
if( !server && !sfxResolve( &soundProfile, errorStr ) )
if (!server && !getSFXProfile())
return false;
return true;
@ -200,7 +199,7 @@ void PrecipitationData::packData(BitStream* stream)
{
Parent::packData(stream);
sfxWrite( stream, soundProfile );
PACKDATA_SOUNDASSET(Sound);
PACKDATA_IMAGEASSET(Drop);
@ -217,7 +216,7 @@ void PrecipitationData::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
sfxRead( stream, &soundProfile );
UNPACKDATA_SOUNDASSET(Sound);
UNPACKDATA_IMAGEASSET(Drop);
@ -598,9 +597,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload )
{
SFX_DELETE( mAmbientSound );
if ( mDataBlock->soundProfile )
if ( mDataBlock->getSFXProfile())
{
mAmbientSound = SFX->createSource( mDataBlock->soundProfile, &getTransform() );
mAmbientSound = SFX->createSource(mDataBlock->getSFXProfile(), &getTransform() );
if ( mAmbientSound )
mAmbientSound->play();
}

View file

@ -34,8 +34,9 @@
#endif
#include "T3D/assets/ImageAsset.h"
#include "T3D/assets/SoundAsset.h"
class SFXTrack;
//class SFXTrack;
class SFXSource;
//--------------------------------------------------------------------------
@ -45,30 +46,39 @@ class PrecipitationData : public GameBaseData
typedef GameBaseData Parent;
public:
SFXTrack* soundProfile;
//SFXTrack* soundProfile;
DECLARE_SOUNDASSET(PrecipitationData, Sound);
DECLARE_SOUNDASSET_SETGET(PrecipitationData, Sound);
DECLARE_IMAGEASSET(PrecipitationData, Drop, onDropChanged, GFXStaticTextureSRGBProfile); ///< Texture for drop particles
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Drop);
DECLARE_IMAGEASSET(PrecipitationData, Drop, onDropChanged, GFXStaticTextureSRGBProfile); ///< Texture for drop particles
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Drop);
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
DECLARE_IMAGEASSET(PrecipitationData, Splash, onSplashChanged, GFXStaticTextureSRGBProfile); ///< Texture for splash particles
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Splash);
DECLARE_IMAGEASSET(PrecipitationData, Splash, onSplashChanged, GFXStaticTextureSRGBProfile); ///< Texture for splash particles
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Splash);
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
S32 mDropsPerSide; ///< How many drops are on a side of the raindrop texture.
S32 mSplashesPerSide; ///< How many splash are on a side of the splash texture.
S32 mDropsPerSide; ///< How many drops are on a side of the raindrop texture.
S32 mSplashesPerSide; ///< How many splash are on a side of the splash texture.
PrecipitationData();
DECLARE_CONOBJECT(PrecipitationData);
bool preload( bool server, String& errorStr );
static void initPersistFields();
virtual void packData(BitStream* stream);
virtual void unpackData(BitStream* stream);
PrecipitationData();
DECLARE_CONOBJECT(PrecipitationData);
bool preload( bool server, String& errorStr );
static void initPersistFields();
virtual void packData(BitStream* stream);
virtual void unpackData(BitStream* stream);
void onDropChanged() {}
void onSplashChanged() {}
void onDropChanged() {}
void onSplashChanged() {}
SFXProfile* getSFXProfile() {
if (mSoundAsset.notNull())
return mSoundAsset->getSfxProfile();
else
return NULL;
}
};
struct Raindrop