Commit 7113667d authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

More implementations for new API, including homogeneous medium data

parent 31ac0674
......@@ -88,7 +88,8 @@ CVAMotionState* CVAListenerState::AlterMotionState()
// Falls der Zustand finalisiert => Zustand aus der Basiskonfig => Autonomen Zustand erzeugen
// Falls der Zustand nicht finalisiert => Bereits erzeugter autonomen Zustand => Diesen zurckgeben
if( data.pMotionState->IsFixed() ) {
if( data.pMotionState->IsFixed() )
{
// Autonomen Zustand ableiten
CVAMotionState* pNewState = GetManager()->RequestMotionState();
......
......@@ -41,10 +41,25 @@ void CVAMotionState::Copy( const CVAMotionState* pSrc, double dModificationTime
SetModificationTime( dModificationTime );
}
void CVAMotionState::Fix() { CVASceneStateBase::Fix(); }
VAVec3 CVAMotionState::GetPosition() const { return data.vPos; }
VAVec3 CVAMotionState::GetView() const { return data.vView; }
VAVec3 CVAMotionState::GetUp() const { return data.vUp; }
void CVAMotionState::Fix()
{
CVASceneStateBase::Fix();
}
VAVec3 CVAMotionState::GetPosition() const
{
return data.vPos;
}
VAVec3 CVAMotionState::GetView() const
{
return data.vView;
}
VAVec3 CVAMotionState::GetUp() const
{
return data.vUp;
}
CVAMotionState::CVAPose CVAMotionState::GetRealWorldPose() const
{
......@@ -81,3 +96,23 @@ void CVAMotionState::SetOrientationVU( const VAVec3& vView, const VAVec3& vUp )
data.vView = vView;
data.vUp = vUp;
}
VAQuat CVAMotionState::GetHeadAboveTorsoOrientation() const
{
return data.qHATO;
}
void CVAMotionState::SetHeadAboveTorsoOrientation( const VAQuat& qOrient )
{
data.qHATO = qOrient;
}
VAQuat CVAMotionState::GetRealWorldHeadAboveTorsoOrientation() const
{
return data.qRealWorldHATO;
}
void CVAMotionState::SetRealWorldHeadAboveTorsoOrientation( const VAQuat& qOrient )
{
data.qRealWorldHATO = qOrient;
}
......@@ -60,6 +60,12 @@ public:
void SetOrientation( const VAQuat& qOrient );
void SetOrientationVU( const VAVec3& vView, const VAVec3& vUp );
VAQuat GetHeadAboveTorsoOrientation() const;
void SetHeadAboveTorsoOrientation( const VAQuat& qOrient );
VAQuat GetRealWorldHeadAboveTorsoOrientation() const;
void SetRealWorldHeadAboveTorsoOrientation( const VAQuat& qOrient );
CVAPose GetRealWorldPose() const;
void SetRealWorldPose( const CVAPose& );
......@@ -70,6 +76,8 @@ private:
VAVec3 vView; //!< View vector
VAVec3 vUp; //!< Up vector
CVAPose oRealWorldPose; //!< Pose in real world coordination system (i.e. playback room position)
VAQuat qHATO; //!< Head-above-torso orientation
VAQuat qRealWorldHATO; //!< Real-world head-above-torso orientation
} data;
};
......
......@@ -3325,7 +3325,6 @@ void CVACoreImpl::SetSoundReceiverOrientationVU( const int iID, const VAVec3& v3
VA_RETHROW;
}
VAQuat CVACoreImpl::GetSoundReceiverOrientation( const int iID ) const
{
VA_NO_REENTRANCE;
......@@ -3389,12 +3388,65 @@ void CVACoreImpl::SetSoundReceiverOrientation( const int iID, const VAQuat& qOri
VAQuat CVACoreImpl::GetSoundReceiverHeadAboveTorsoOrientation( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED_NEXT_VERSION;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
CVASceneState* pHeadState = m_pSceneManager->GetHeadSceneState();
const CVAListenerState* pListenerState = pHeadState->GetListenerState( iID );
if( !pListenerState )
// Hrer existiert nicht
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
const CVAMotionState* pMotionState = pListenerState->GetMotionState();
if( !pMotionState )
VA_EXCEPT2( INVALID_PARAMETER, "Sound receiver has invalid motion state, probably it has not been positioned, yet?" );
return pMotionState->GetHeadAboveTorsoOrientation();
}
VA_RETHROW;
}
void CVACoreImpl::SetSoundReceiverHeadAboveTorsoOrientation( const int iID, const VAQuat& qOrient )
{
VA_EXCEPT_NOT_IMPLEMENTED_NEXT_VERSION;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
const bool bSync = GetUpdateLocked();
if( !bSync )
LockUpdate();
CVAListenerState* pListenerState = m_pNewSceneState->AlterListenerState( iID );
if( !pListenerState )
{
if( !bSync )
UnlockUpdate();
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
}
CVAMotionState* pNewMotionState = pListenerState->AlterMotionState();
pNewMotionState->SetHeadAboveTorsoOrientation( qOrient );
/* Ereignis generieren
CVAEvent ev;
ev.iEventType = CVAEvent::VA_EVENT_SOUND_RECEIVER_REALCHANGED_POSE;
ev.pSender = this;
ev.iObjectID = iID;
SetCoreEventParams( ev, pNewMotionState );
m_pEventManager->EnqueueEvent( ev );
*/
if( !bSync )
UnlockUpdate();
}
VA_RETHROW;
}
void CVACoreImpl::GetSoundReceiverRealWorldPositionOrientationVU( const int iID, VAVec3& v3Pos, VAVec3& v3View, VAVec3& v3Up ) const
......@@ -3413,7 +3465,7 @@ void CVACoreImpl::GetSoundReceiverRealWorldPositionOrientationVU( const int iID,
const CVAMotionState* pMotionState = pListenerState->GetMotionState();
if( !pMotionState )
VA_EXCEPT2( INVALID_PARAMETER, "SoundReceiver has invalid motion state, probably it has not been positioned, yet?" );
VA_EXCEPT2( INVALID_PARAMETER, "Sound receiver has invalid motion state, probably it has not been positioned, yet?" );
v3Pos = pMotionState->GetRealWorldPose().vPos;
VAQuat qOrient = pMotionState->GetRealWorldPose().qOrient;
......@@ -3445,8 +3497,7 @@ void CVACoreImpl::SetSoundReceiverRealWorldPositionOrientationVU( const int iID,
CVAMotionState* pNewMotionState = pListenerState->AlterMotionState();
CVAMotionState::CVAPose oNewPose;
oNewPose.vPos = v3Pos;
oNewPose.vPos = v3View;
oNewPose.vPos = v3Up;
ConvertViewUpToQuaternion( v3View, v3Up, oNewPose.qOrient );
pNewMotionState->SetRealWorldPose( oNewPose );
/* Ereignis generieren
......@@ -3468,82 +3519,232 @@ void CVACoreImpl::SetSoundReceiverRealWorldPositionOrientationVU( const int iID,
void CVACoreImpl::GetSoundReceiverRealWorldPose( const int iID, VAVec3& v3Pos, VAQuat& qOrient ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
CVASceneState* pHeadState = m_pSceneManager->GetHeadSceneState();
const CVAListenerState* pListenerState = pHeadState->GetListenerState( iID );
if( !pListenerState )
// Hrer existiert nicht
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
const CVAMotionState* pMotionState = pListenerState->GetMotionState();
if( !pMotionState )
VA_EXCEPT2( INVALID_PARAMETER, "Sound receiver has invalid motion state, probably it has not been positioned, yet?" );
v3Pos = pMotionState->GetRealWorldPose().vPos;
qOrient = pMotionState->GetRealWorldPose().qOrient;
}
VA_RETHROW;
}
void CVACoreImpl::SetSoundReceiverRealWorldPose( const int iID, const VAVec3& v3Pos, const VAQuat& qOrient )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
const bool bSync = GetUpdateLocked();
if( !bSync )
LockUpdate();
CVAListenerState* pListenerState = m_pNewSceneState->AlterListenerState( iID );
if( !pListenerState )
{
if( !bSync )
UnlockUpdate();
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
}
CVAMotionState* pNewMotionState = pListenerState->AlterMotionState();
CVAMotionState::CVAPose oNewPose;
oNewPose.vPos = v3Pos;
oNewPose.qOrient = qOrient;
pNewMotionState->SetRealWorldPose( oNewPose );
/* Ereignis generieren
CVAEvent ev;
ev.iEventType = CVAEvent::VA_EVENT_REAL_WORLD_SOUND_RECEIVER_CHANGED_POSE;
ev.pSender = this;
ev.iObjectID = iID;
SetCoreEventParams( ev, pNewMotionState );
m_pCoreEventMan->EnqueueEvent( ev );
*/
if( !bSync )
UnlockUpdate();
}
VA_RETHROW;
}
VAQuat CVACoreImpl::GetSoundReceiverRealWorldHeadAboveTorsoOrientation( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
CVASceneState* pHeadState = m_pSceneManager->GetHeadSceneState();
const CVAListenerState* pListenerState = pHeadState->GetListenerState( iID );
if( !pListenerState )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
const CVAMotionState* pMotionState = pListenerState->GetMotionState();
if( !pMotionState )
VA_EXCEPT2( INVALID_PARAMETER, "Sound receiver has invalid motion state, probably it has not been positioned, yet?" );
return pMotionState->GetRealWorldHeadAboveTorsoOrientation();
}
VA_RETHROW;
}
void CVACoreImpl::SetSoundReceiverRealWorldHeadAboveTorsoOrientation( const int iID, const VAQuat& qOrient )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
VA_TRY
{
const bool bSync = GetUpdateLocked();
if( !bSync )
LockUpdate();
CVAListenerState* pListenerState = m_pNewSceneState->AlterListenerState( iID );
if( !pListenerState )
{
if( !bSync )
UnlockUpdate();
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound receiver ID" );
}
CVAMotionState* pNewMotionState = pListenerState->AlterMotionState();
pNewMotionState->SetRealWorldHeadAboveTorsoOrientation( qOrient );
/* Ereignis generieren
CVAEvent ev;
ev.iEventType = CVAEvent::VA_EVENT_REAL_WORLD_SOUND_RECEIVER_CHANGED_POSE;
ev.pSender = this;
ev.iObjectID = iID;
SetCoreEventParams( ev, pNewMotionState );
m_pCoreEventMan->EnqueueEvent( ev );
*/
if( !bSync )
UnlockUpdate();
}
VA_RETHROW;
}
void CVACoreImpl::SetHomogeneousMediumSoundSpeed( const double dSoundSpeed )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_TRY
{
if( dSoundSpeed <= 0.0f )
VA_EXCEPT2( INVALID_PARAMETER, "Speed of sound can not be zero or negative" );
m_oHomogeneousMedium.dSoundSpeed = dSoundSpeed;
}
VA_RETHROW;
}
double CVACoreImpl::GetHomogeneousMediumSoundSpeed() const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.dSoundSpeed;
}
void CVACoreImpl::SetHomogeneousMediumTemperature( const double dDegreesCentigrade )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_TRY
{
if( dDegreesCentigrade <= -270.0f )
VA_EXCEPT2( INVALID_PARAMETER, "Temperature can not be below total zero" );
m_oHomogeneousMedium.dTemperatureDegreeCentigrade = dDegreesCentigrade;
}
VA_RETHROW;
}
double CVACoreImpl::GetHomogeneousMediumTemperature() const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.dTemperatureDegreeCentigrade;
}
void CVACoreImpl::SetHomogeneousMediumStaticPressure( const double dPressurePascal )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_TRY
{
if( dPressurePascal <= 0.0f )
VA_EXCEPT2( INVALID_PARAMETER, "Static pressure can not be zero or negative" );
m_oHomogeneousMedium.dStaticPressurePascal = dPressurePascal;
}
VA_RETHROW;
}
double CVACoreImpl::GetHomogeneousMediumStaticPressure() const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.dStaticPressurePascal;
}
void CVACoreImpl::SetHomogeneousMediumRelativeHumidity( const double dRelativeHumidityPercent )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_TRY
{
if( dRelativeHumidityPercent < 0.0f )
VA_EXCEPT2( INVALID_PARAMETER, "Relative humidity can not be negative" );
m_oHomogeneousMedium.dRelativeHumidityPercent = dRelativeHumidityPercent;
}
VA_RETHROW;
}
double CVACoreImpl::GetHomogeneousMediumRelativeHumidity()
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.dRelativeHumidityPercent;
}
void CVACoreImpl::SetHomogeneousMediumShiftSpeed( const VAVec3& v3TranslationSpeed )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
VA_TRY
{
if( v3TranslationSpeed.Length() >= m_oHomogeneousMedium.dSoundSpeed )
VA_EXCEPT2( INVALID_PARAMETER, "Medium shift can not be equal or faster than sound speed" );
m_oHomogeneousMedium.v3ShiftSpeed = v3TranslationSpeed;
}
VA_RETHROW;
}
VAVec3 CVACoreImpl::GetHomogeneousMediumShiftSpeed() const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.v3ShiftSpeed;
}
void CVACoreImpl::SetHomogeneousMediumParameters( const CVAStruct& oParams )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
m_oHomogeneousMedium.oParameters = oParams;
}
CVAStruct CVACoreImpl::GetHomogeneousMediumParameters( const CVAStruct& oArgs )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_NO_REENTRANCE;
return m_oHomogeneousMedium.oParameters;
}
std::string CVACoreImpl::CreateScene( const CVAStruct& oParams, const std::string& sSceneName )
......@@ -3578,7 +3779,7 @@ CVASceneInfo CVACoreImpl::GetSceneInfo( const std::string& sSceneID ) const
VA_TRY
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
VA_RETHROW;
}
......@@ -3590,7 +3791,7 @@ bool CVACoreImpl::GetSceneEnabled( const std::string& sID ) const
VA_TRY
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
VA_RETHROW;
}
......@@ -3598,28 +3799,29 @@ bool CVACoreImpl::GetSceneEnabled( const std::string& sID ) const
int CVACoreImpl::CreateSoundPortal( const std::string& sName /*= "" */ )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
//m_pSceneManager->CreatePortalDesc()
}
void CVACoreImpl::GetSceneIDs( std::vector< std::string >& vsIDs ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
std::string CVACoreImpl::GetSceneName( const std::string& sID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSceneName( const std::string& sID, const std::string& sName )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSceneEnabled( const std::string& sID, const bool bEnabled /*= true */ )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::GetSoundPortalIDs( std::vector< int >& vPortalIDs )
......@@ -3636,7 +3838,7 @@ void CVACoreImpl::GetSoundPortalIDs( std::vector< int >& vPortalIDs )
CVASoundPortalInfo CVACoreImpl::GetSoundPortalInfo( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
std::string CVACoreImpl::GetSoundPortalName( const int iPortalID ) const
......@@ -3675,42 +3877,42 @@ void CVACoreImpl::SetSoundPortalName( const int iPortalID, const std::string& sN
void CVACoreImpl::SetSoundPortalMaterial( const int iSoundPortalID, const int iMaterialID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
int CVACoreImpl::GetSoundPortalMaterial( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalNextPortal( const int iSoundPortalID, const int iNextSoundPortalID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
int CVACoreImpl::GetSoundPortalNextPortal( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalSoundReceiver( const int iSoundPortalID, const int iSoundReceiverID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
int CVACoreImpl::GetSoundPortalSoundReceiver( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalSoundSource( const int iSoundPortalID, const int iSoundSourceID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
int CVACoreImpl::GetSoundPortalSoundSource( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
bool CVACoreImpl::GetSoundPortalEnabled( const int iPortalID ) const
......@@ -3720,39 +3922,39 @@ bool CVACoreImpl::GetSoundPortalEnabled( const int iPortalID ) const
VA_TRY
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
VA_RETHROW;
}
CVAStruct CVACoreImpl::GetSoundPortalParameters( const int iID, const CVAStruct& oArgs ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalParameters( const int iID, const CVAStruct& oParams )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalPosition( const int iSoundPortalID, const VAVec3& vPos )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
VAVec3 CVACoreImpl::GetSoundPortalPosition( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalOrientation( const int iSoundPortalID, const VAQuat& qOrient )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
VAQuat CVACoreImpl::GetSoundPortalOrientation( const int iSoundPortalID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_EXCEPT_NOT_IMPLEMENTED_FUTURE_VERSION;
}
void CVACoreImpl::SetSoundPortalEnabled( const int iID, const bool bEnabled )
......@@ -4101,9 +4303,9 @@ std::string CVACoreImpl::FindFilePath( const std::string& sRelativeFilePath ) co
}
return sFinalPathWithSearch;
}
VA_RETHROW;
}
VA_RETHROW;
}
void CVACoreImpl::InitializeAudioDriver()
{
......
......@@ -460,6 +460,27 @@ private:
CVACoreEventManager* m_pEventManager;
//! Homogeneous medium definitions
struct CVAHomogeneousMedium
{
double dSoundSpeed; //!< Speed of sound in m/s
double dStaticPressurePascal; //!< Static pressure in Pascal
double dTemperatureDegreeCentigrade; //!< Temperature in degree centigrade
double dRelativeHumidityPercent; //!< Relative humidity
VAVec3 v3ShiftSpeed; //!< Medium shift speed in m/s
CVAStruct oParameters; //!< Special parameters, for prototyping
inline CVAHomogeneousMedium()
{
dSoundSpeed = 344.0f;
dStaticPressurePascal = 105125.0f;
dTemperatureDegreeCentigrade = 20.0f;
dRelativeHumidityPercent = 20.0f;
v3ShiftSpeed.Set( 0.0f, 0.0f, 0.0f );
}
} m_oHomogeneousMedium;
// Diese Hilfsmethoden bedienen die Locks um die serielle Ausfhrung
// externer Methoden zu gewhrleisten und die Reentrance zu blockieren
// (siehe externe Methoden).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment