mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
sound asset conversions - materials
This commit is contained in:
parent
9af2de3c4b
commit
f0d919e859
3 changed files with 15 additions and 9 deletions
|
|
@ -7042,11 +7042,11 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( contactMaterial && contactMaterial->mFootstepSoundCustom )
|
else if( contactMaterial && contactMaterial->getCustomFootstepSoundProfile())
|
||||||
{
|
{
|
||||||
// Footstep sound defined on material.
|
// Footstep sound defined on material.
|
||||||
|
|
||||||
SFX->playOnce( contactMaterial->mFootstepSoundCustom, &footMat );
|
SFX->playOnce( contactMaterial->getCustomFootstepSoundProfile(), &footMat );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -7079,8 +7079,8 @@ void Player:: playImpactSound()
|
||||||
{
|
{
|
||||||
Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 );
|
Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 );
|
||||||
|
|
||||||
if( material && material->mImpactSoundCustom )
|
if( material && material->getCustomImpactSoundProfile() )
|
||||||
SFX->playOnce( material->mImpactSoundCustom, &getTransform() );
|
SFX->playOnce( material->getCustomImpactSoundProfile(), &getTransform() );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
S32 sound = -1;
|
S32 sound = -1;
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,8 @@ Material::Material()
|
||||||
|
|
||||||
mFootstepSoundId = -1; mImpactSoundId = -1;
|
mFootstepSoundId = -1; mImpactSoundId = -1;
|
||||||
mImpactFXIndex = -1;
|
mImpactFXIndex = -1;
|
||||||
mFootstepSoundCustom = 0; mImpactSoundCustom = 0;
|
INIT_ASSET(CustomFootstepSound);
|
||||||
|
INIT_ASSET(CustomImpactSound);
|
||||||
mFriction = 0.0;
|
mFriction = 0.0;
|
||||||
|
|
||||||
mDirectSoundOcclusion = 1.f;
|
mDirectSoundOcclusion = 1.f;
|
||||||
|
|
@ -476,7 +477,7 @@ void Material::initPersistFields()
|
||||||
"- 16: PlayerData::impactWaterHard\n"
|
"- 16: PlayerData::impactWaterHard\n"
|
||||||
"- 17: PlayerData::exitingWater\n");
|
"- 17: PlayerData::exitingWater\n");
|
||||||
|
|
||||||
addField("customFootstepSound", TypeSFXTrackName, Offset(mFootstepSoundCustom, Material),
|
INITPERSISTFIELD_SOUNDASSET(CustomFootstepSound, Material,
|
||||||
"The sound to play when the player walks over the material. If this is set, it overrides #footstepSoundId. This field is "
|
"The sound to play when the player walks over the material. If this is set, it overrides #footstepSoundId. This field is "
|
||||||
"useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.\n\n"
|
"useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.\n\n"
|
||||||
"@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too.");
|
"@warn Be aware that materials are client-side objects. This means that the SFXTracks assigned to materials must be client-side, too.");
|
||||||
|
|
@ -488,7 +489,7 @@ void Material::initPersistFields()
|
||||||
"What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater "
|
"What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater "
|
||||||
"than PlayerData::groundImpactMinSpeed.\n\n"
|
"than PlayerData::groundImpactMinSpeed.\n\n"
|
||||||
"For a list of IDs, see #impactFXId");
|
"For a list of IDs, see #impactFXId");
|
||||||
addField("customImpactSound", TypeSFXTrackName, Offset(mImpactSoundCustom, Material),
|
INITPERSISTFIELD_SOUNDASSET(CustomImpactSound, Material,
|
||||||
"The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed. "
|
"The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed. "
|
||||||
"If this is set, it overrides #impactSoundId. This field is useful for directly assigning custom impact sounds to materials "
|
"If this is set, it overrides #impactSoundId. This field is useful for directly assigning custom impact sounds to materials "
|
||||||
"without having to rely on the PlayerData sound assignment.\n\n"
|
"without having to rely on the PlayerData sound assignment.\n\n"
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@
|
||||||
#ifndef _ASSET_PTR_H_
|
#ifndef _ASSET_PTR_H_
|
||||||
#include "assets/assetPtr.h"
|
#include "assets/assetPtr.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SOUND_ASSET_H
|
||||||
|
#include "T3D/assets/SoundAsset.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class CubemapData;
|
class CubemapData;
|
||||||
class SFXTrack;
|
class SFXTrack;
|
||||||
|
|
@ -367,8 +370,10 @@ public:
|
||||||
/// Sound effect to play when walking on surface with this material.
|
/// Sound effect to play when walking on surface with this material.
|
||||||
/// If defined, overrides mFootstepSoundId.
|
/// If defined, overrides mFootstepSoundId.
|
||||||
/// @see mFootstepSoundId
|
/// @see mFootstepSoundId
|
||||||
SFXTrack* mFootstepSoundCustom;
|
DECLARE_SOUNDASSET(Material, CustomFootstepSound);
|
||||||
SFXTrack* mImpactSoundCustom;
|
DECLARE_ASSET_SETGET(Material, CustomFootstepSound);
|
||||||
|
DECLARE_SOUNDASSET(Material, CustomImpactSound);
|
||||||
|
DECLARE_ASSET_SETGET(Material, CustomImpactSound);
|
||||||
|
|
||||||
F32 mFriction; ///< Friction coefficient when moving along surface.
|
F32 mFriction; ///< Friction coefficient when moving along surface.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue