From 1cebfff06e7d9e55c3858ee27bc25d6577c05156 Mon Sep 17 00:00:00 2001 From: phevosccp Date: Tue, 27 Oct 2026 15:26:37 +0000 Subject: [PATCH 1/6] Tell audio emitters which ball they are mounted on Space objects and effect roots pass their ball (translation curve) to their observers and, through EveChildUpdateParams, to child containers and EveChildAudio. Audio forwards it to destiny's sightline query, which skips that ball's own collision geometry, so deployables and walls no longer occlude their own emitters. --- trinity/Eve/EveEffectRoot2.cpp | 2 ++ trinity/Eve/SpaceObject/Children/EveChildAudio.cpp | 8 ++++++++ trinity/Eve/SpaceObject/Children/EveChildContainer.cpp | 1 + trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h | 6 +++++- trinity/Eve/SpaceObject/EveSpaceObject2.cpp | 2 ++ trinity/TriObserverLocal.cpp | 9 +++++++++ trinity/TriObserverLocal.h | 2 ++ 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/trinity/Eve/EveEffectRoot2.cpp b/trinity/Eve/EveEffectRoot2.cpp index ccd0a9154..d98d3e386 100644 --- a/trinity/Eve/EveEffectRoot2.cpp +++ b/trinity/Eve/EveEffectRoot2.cpp @@ -206,6 +206,7 @@ void EveEffectRoot2::UpdateSyncronous( const EveUpdateContext& updateContext ) for( TriObserverLocalVector::iterator it = m_observers.begin(); it != m_observers.end(); ++it ) { + ( *it )->SetParentBall( m_ballPosition ); ( *it )->Update( m_lastUpdateMatrix ); } @@ -220,6 +221,7 @@ void EveEffectRoot2::UpdateSyncronous( const EveUpdateContext& updateContext ) params.bones = nullptr; params.localToWorldTransform = worldTransform; params.isVisible = m_display; + params.ballPosition = m_ballPosition; for( auto ecIt = m_effectChildren.begin(); ecIt != m_effectChildren.end(); ++ecIt ) { diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp index 0e7f9b9a0..9e4eeace7 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp @@ -3,6 +3,9 @@ #include "StdAfx.h" #include "EveChildAudio.h" +#include +#include + EveChildAudio::EveChildAudio( IRoot* lockobj ) : m_mute( false ), @@ -98,6 +101,11 @@ void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, con if( m_audioEmitter && !m_mute ) { + if( auto emitter = dynamic_cast( m_audioEmitter.p ) ) + { + emitter->SetParentBall( params.ballPosition ); + } + Vector3 position = m_worldTransform.GetTranslation(); Quaternion rotation = RotationQuaternion( m_worldTransform ); Matrix rotationMatrix = RotationMatrix( rotation ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp index a6a567eeb..e19f9846f 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp @@ -507,6 +507,7 @@ void EveChildContainer::UpdateSyncronous( const EveUpdateContext& updateContext, } for( auto it = m_observers.begin(); it != m_observers.end(); it++ ) { + ( *it )->SetParentBall( params.ballPosition ); ( *it )->Update( m_worldTransform ); } } diff --git a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h index 9f635f921..986befce5 100644 --- a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h +++ b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h @@ -14,6 +14,7 @@ class Tr2LightManager; BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); BLUE_DECLARE( EveSpaceObjectChild ); BLUE_DECLARE_INTERFACE( IEveChildTransformModifier ); +BLUE_DECLARE_INTERFACE( ITriVectorFunction ); struct EveChildUpdateParams { @@ -27,7 +28,8 @@ struct EveChildUpdateParams isVisible( true ), localToWorldTransform( IdentityMatrix() ), controllerUpdateFrequency( 0.5f ), - worldVelocity( 0.f, 0.f, 0.f ) + worldVelocity( 0.f, 0.f, 0.f ), + ballPosition( nullptr ) { } @@ -41,6 +43,8 @@ struct EveChildUpdateParams bool isVisible; Matrix localToWorldTransform; Vector3 worldVelocity; + /// Translation curve of the root space object, usually its destiny ball. May be nullptr. + ITriVectorFunction* ballPosition; }; /** diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index 0dac34cba..419437c1d 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -581,6 +581,7 @@ void EveSpaceObject2::UpdateSyncronous( const EveUpdateContext& updateContext ) Matrix observerTransform = GetObserverTransform(); for( TriObserverLocalVector::iterator it = m_observers.begin(); it != observersEnd; ++it ) { + ( *it )->SetParentBall( m_ballPosition ); ( *it )->Update( observerTransform ); } @@ -595,6 +596,7 @@ void EveSpaceObject2::UpdateSyncronous( const EveUpdateContext& updateContext ) params.ownerMaxSpeed = m_maxSpeed; params.activationStrength = m_activationStrength; params.localToWorldTransform = worldTransform; + params.ballPosition = m_ballPosition; Tr2GrannyAnimationUtils::GetBoneList( m_animationUpdater, params.bones, params.boneCount ); diff --git a/trinity/TriObserverLocal.cpp b/trinity/TriObserverLocal.cpp index b3a29bf18..e35e891f4 100644 --- a/trinity/TriObserverLocal.cpp +++ b/trinity/TriObserverLocal.cpp @@ -2,6 +2,7 @@ #include "StdAfx.h" #include +#include #include "TriObserverLocal.h" @@ -41,6 +42,14 @@ void TriObserverLocal::Update( const Matrix& worldTransform ) } } +void TriObserverLocal::SetParentBall( IRoot* ball ) +{ + if( auto emitter = dynamic_cast( m_observer.p ) ) + { + emitter->SetParentBall( ball ); + } +} + IBluePlacementObserver* TriObserverLocal::GetObserver() { return m_observer; diff --git a/trinity/TriObserverLocal.h b/trinity/TriObserverLocal.h index 0c43b5282..c43fe499e 100644 --- a/trinity/TriObserverLocal.h +++ b/trinity/TriObserverLocal.h @@ -22,6 +22,8 @@ BLUE_CLASS( TriObserverLocal ) : EXPOSE_TO_BLUE(); void Update( const Matrix& worldTransform ); + /// Tells an audio emitter observer which ball it is mounted on. Does nothing for other observers. + void SetParentBall( IRoot * ball ); // ITriObserverLocal IBluePlacementObserver* GetObserver(); From 14cd7aa96ecab53a6346e8cb23c3483124becf36 Mon Sep 17 00:00:00 2001 From: phevosccp Date: Mon, 2 Nov 2026 14:54:18 +0000 Subject: [PATCH 2/6] requested pr changes --- trinity/Eve/SpaceObject/Children/EveChildAudio.cpp | 9 ++++++--- trinity/Eve/SpaceObject/Children/EveChildAudio.h | 2 ++ trinity/TriObserverLocal.cpp | 12 +++++++++--- trinity/TriObserverLocal.h | 5 ++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp index 9e4eeace7..bfd5384de 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp @@ -9,7 +9,8 @@ EveChildAudio::EveChildAudio( IRoot* lockobj ) : m_mute( false ), - m_worldTransform( IdentityMatrix() ) + m_worldTransform( IdentityMatrix() ), + m_parentBall( nullptr ) { m_name = BlueSharedString( "EveChildAudio" ); } @@ -19,6 +20,7 @@ bool EveChildAudio::Initialize() // Early exit if already initialized if( m_audioEmitter ) { + m_parentBall = dynamic_cast( m_audioEmitter.p ); return true; } @@ -36,6 +38,7 @@ bool EveChildAudio::Initialize() emitterName = m_name.c_str(); } m_audioEmitter->Initialize( emitterName, L"", position ); + m_parentBall = dynamic_cast( m_audioEmitter.p ); return true; } @@ -101,9 +104,9 @@ void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, con if( m_audioEmitter && !m_mute ) { - if( auto emitter = dynamic_cast( m_audioEmitter.p ) ) + if( m_parentBall ) { - emitter->SetParentBall( params.ballPosition ); + m_parentBall->SetParentBall( params.ballPosition ); } Vector3 position = m_worldTransform.GetTranslation(); diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.h b/trinity/Eve/SpaceObject/Children/EveChildAudio.h index 732b683c6..20c87c081 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.h +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.h @@ -20,6 +20,7 @@ // Forward declarations and smart pointer typedefs BLUE_DECLARE_INTERFACE( ITr2AudEmitter ); BLUE_DECLARE_IVECTOR( ITr2AudEmitter ); +BLUE_DECLARE_INTERFACE( ITr2AudParentBall ); BLUE_DECLARE( EveChildAudio ); /** @@ -85,6 +86,7 @@ BLUE_CLASS( EveChildAudio ) : Matrix m_worldTransform; ///< Cached world transformation matrix. bool m_mute; ///< Whether audio playback is muted. ITr2AudEmitterPtr m_audioEmitter; ///< The audio emitter instance. + ITr2AudParentBall* m_parentBall; }; /** diff --git a/trinity/TriObserverLocal.cpp b/trinity/TriObserverLocal.cpp index e35e891f4..a48c88c7e 100644 --- a/trinity/TriObserverLocal.cpp +++ b/trinity/TriObserverLocal.cpp @@ -9,7 +9,8 @@ TriObserverLocal::TriObserverLocal( IRoot* lockobj ) : m_front( 0.0f, 0.0f, 1.0f ), m_position( 0.0f, 0.0f, 0.0f ), - m_mute( false ) + m_mute( false ), + m_parentBall( nullptr ) { } @@ -44,9 +45,14 @@ void TriObserverLocal::Update( const Matrix& worldTransform ) void TriObserverLocal::SetParentBall( IRoot* ball ) { - if( auto emitter = dynamic_cast( m_observer.p ) ) + if( m_observer.p != m_parentBallObserver.p ) { - emitter->SetParentBall( ball ); + m_parentBallObserver = m_observer; + m_parentBall = dynamic_cast( m_observer.p ); + } + if( m_parentBall ) + { + m_parentBall->SetParentBall( ball ); } } diff --git a/trinity/TriObserverLocal.h b/trinity/TriObserverLocal.h index c43fe499e..f7e0e851e 100644 --- a/trinity/TriObserverLocal.h +++ b/trinity/TriObserverLocal.h @@ -8,6 +8,7 @@ #include +BLUE_DECLARE_INTERFACE( ITr2AudParentBall ); struct Vector3; struct Matrix; @@ -23,7 +24,7 @@ BLUE_CLASS( TriObserverLocal ) : void Update( const Matrix& worldTransform ); /// Tells an audio emitter observer which ball it is mounted on. Does nothing for other observers. - void SetParentBall( IRoot * ball ); + void SetParentBall( IRoot* ball ); // ITriObserverLocal IBluePlacementObserver* GetObserver(); @@ -49,6 +50,8 @@ BLUE_CLASS( TriObserverLocal ) : Vector3 m_front; Vector3 m_position; IBluePlacementObserverPtr m_observer; + IBluePlacementObserverPtr m_parentBallObserver; + ITr2AudParentBall* m_parentBall; }; BLUE_DECLARE_VECTOR( TriObserverLocal ); From 2b59859516b53eea7a2d2bb89f84016c170083fb Mon Sep 17 00:00:00 2001 From: Phevos Rinis <160875214+phevosccp@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:04:06 +0000 Subject: [PATCH 3/6] Update trinity/TriObserverLocal.h Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- trinity/TriObserverLocal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trinity/TriObserverLocal.h b/trinity/TriObserverLocal.h index f7e0e851e..8a6256182 100644 --- a/trinity/TriObserverLocal.h +++ b/trinity/TriObserverLocal.h @@ -24,7 +24,7 @@ BLUE_CLASS( TriObserverLocal ) : void Update( const Matrix& worldTransform ); /// Tells an audio emitter observer which ball it is mounted on. Does nothing for other observers. - void SetParentBall( IRoot* ball ); + void SetParentBall( IRoot * ball ); // ITriObserverLocal IBluePlacementObserver* GetObserver(); From ae803cc2b7bd733c7a3c6459a460ac94a62f3dd1 Mon Sep 17 00:00:00 2001 From: phevosccp Date: Tue, 3 Nov 2026 13:41:17 +0000 Subject: [PATCH 4/6] requested pr changes --- trinity/Eve/EveEffectRoot2.cpp | 2 +- .../Eve/SpaceObject/Children/EveChildContainer.cpp | 2 +- trinity/Eve/SpaceObject/EveSpaceObject2.cpp | 2 +- trinity/TriObserverLocal.cpp | 12 +++++++++--- trinity/TriObserverLocal.h | 5 +++-- trinity/TriObserverLocal_Blue.cpp | 3 ++- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/trinity/Eve/EveEffectRoot2.cpp b/trinity/Eve/EveEffectRoot2.cpp index d98d3e386..150568f0b 100644 --- a/trinity/Eve/EveEffectRoot2.cpp +++ b/trinity/Eve/EveEffectRoot2.cpp @@ -1009,7 +1009,7 @@ ITr2AudEmitterPtr EveEffectRoot2::FindSoundEmitter( const char* name ) void EveEffectRoot2::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( observer ); + m_observers.Append( static_cast( observer ) ); } void EveEffectRoot2::SetMute( bool isMute ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp index e19f9846f..4bb9ed93a 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp @@ -1062,7 +1062,7 @@ ITr2AudEmitterPtr EveChildContainer::FindSoundEmitter( const char* name ) void EveChildContainer::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( observer ); + m_observers.Append( static_cast( observer ) ); } float EveChildContainer::GetOwnerMaxSpeed() const diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index 419437c1d..f9a54ea1d 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -3395,7 +3395,7 @@ void EveSpaceObject2::AddController( ITr2Controller* controller ) // -------------------------------------------------------------------------------- void EveSpaceObject2::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( observer ); + m_observers.Append( static_cast( observer ) ); } // -------------------------------------------------------------------------------- diff --git a/trinity/TriObserverLocal.cpp b/trinity/TriObserverLocal.cpp index a48c88c7e..6715f73f7 100644 --- a/trinity/TriObserverLocal.cpp +++ b/trinity/TriObserverLocal.cpp @@ -10,7 +10,8 @@ TriObserverLocal::TriObserverLocal( IRoot* lockobj ) : m_front( 0.0f, 0.0f, 1.0f ), m_position( 0.0f, 0.0f, 0.0f ), m_mute( false ), - m_parentBall( nullptr ) + m_parentBall( nullptr ), + m_parentBallStale( true ) { } @@ -45,10 +46,10 @@ void TriObserverLocal::Update( const Matrix& worldTransform ) void TriObserverLocal::SetParentBall( IRoot* ball ) { - if( m_observer.p != m_parentBallObserver.p ) + if( m_parentBallStale ) { - m_parentBallObserver = m_observer; m_parentBall = dynamic_cast( m_observer.p ); + m_parentBallStale = false; } if( m_parentBall ) { @@ -64,6 +65,7 @@ IBluePlacementObserver* TriObserverLocal::GetObserver() void TriObserverLocal::SetObserver( IBluePlacementObserver* obs ) { m_observer = obs; + m_parentBallStale = true; } void TriObserverLocal::SetPosition( Vector3 pos ) @@ -105,6 +107,10 @@ void TriObserverLocal::SetMute( bool isMute ) bool TriObserverLocal::OnModified( Be::Var* val ) { + if( IsMatch( val, m_observer ) ) + { + m_parentBallStale = true; + } return true; } diff --git a/trinity/TriObserverLocal.h b/trinity/TriObserverLocal.h index 8a6256182..5070b2e3b 100644 --- a/trinity/TriObserverLocal.h +++ b/trinity/TriObserverLocal.h @@ -14,7 +14,8 @@ struct Vector3; struct Matrix; BLUE_CLASS( TriObserverLocal ) : - public ITriObserverLocal + public ITriObserverLocal, + public INotify { public: TriObserverLocal( IRoot* lockobj = NULL ); @@ -50,8 +51,8 @@ BLUE_CLASS( TriObserverLocal ) : Vector3 m_front; Vector3 m_position; IBluePlacementObserverPtr m_observer; - IBluePlacementObserverPtr m_parentBallObserver; ITr2AudParentBall* m_parentBall; + bool m_parentBallStale; }; BLUE_DECLARE_VECTOR( TriObserverLocal ); diff --git a/trinity/TriObserverLocal_Blue.cpp b/trinity/TriObserverLocal_Blue.cpp index 554f18c1e..ac1156cbc 100644 --- a/trinity/TriObserverLocal_Blue.cpp +++ b/trinity/TriObserverLocal_Blue.cpp @@ -10,12 +10,13 @@ const Be::ClassInfo* TriObserverLocal::ExposeToBlue() { EXPOSURE_BEGIN( TriObserverLocal, "Connects locators to placement observers." ) MAP_INTERFACE( ITriObserverLocal ) + MAP_INTERFACE( INotify ) MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "position", m_position, "", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "front", m_front, "", Be::READWRITE | Be::PERSIST ) MAP_PROPERTY( "mute", GetMute, SetMute, "" ) - MAP_ATTRIBUTE( "observer", m_observer, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "observer", m_observer, "", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) EXPOSURE_END() From 1945c449c96261d730ef152f806145d7d07af173 Mon Sep 17 00:00:00 2001 From: phevosccp Date: Thu, 5 Nov 2026 11:45:37 +0000 Subject: [PATCH 5/6] use GetRawRoot when appending observers --- trinity/Eve/EveEffectRoot2.cpp | 2 +- trinity/Eve/SpaceObject/Children/EveChildContainer.cpp | 2 +- trinity/Eve/SpaceObject/EveSpaceObject2.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trinity/Eve/EveEffectRoot2.cpp b/trinity/Eve/EveEffectRoot2.cpp index 150568f0b..b795cd814 100644 --- a/trinity/Eve/EveEffectRoot2.cpp +++ b/trinity/Eve/EveEffectRoot2.cpp @@ -1009,7 +1009,7 @@ ITr2AudEmitterPtr EveEffectRoot2::FindSoundEmitter( const char* name ) void EveEffectRoot2::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( static_cast( observer ) ); + m_observers.Append( observer->GetRawRoot() ); } void EveEffectRoot2::SetMute( bool isMute ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp index 4bb9ed93a..303f6b387 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp @@ -1062,7 +1062,7 @@ ITr2AudEmitterPtr EveChildContainer::FindSoundEmitter( const char* name ) void EveChildContainer::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( static_cast( observer ) ); + m_observers.Append( observer->GetRawRoot() ); } float EveChildContainer::GetOwnerMaxSpeed() const diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index f9a54ea1d..1cde33c25 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -3395,7 +3395,7 @@ void EveSpaceObject2::AddController( ITr2Controller* controller ) // -------------------------------------------------------------------------------- void EveSpaceObject2::AddObserver( TriObserverLocalPtr observer ) { - m_observers.Append( static_cast( observer ) ); + m_observers.Append( observer->GetRawRoot() ); } // -------------------------------------------------------------------------------- From 63495b98f28753edb670833d46be49f5b8881b69 Mon Sep 17 00:00:00 2001 From: phevosccp Date: Thu, 5 Nov 2026 11:45:37 +0000 Subject: [PATCH 6/6] bump carbon-trinityaudioapi to 3.2.0 --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index d8e514cf6..952265d73 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -43,7 +43,7 @@ }, { "name": "carbon-trinityaudioapi", - "version>=": "3.1.0" + "version>=": "3.2.0" }, { "name": "freetype",