Commit 1fa2c574 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Sound portals finished

parent f0df9db1
......@@ -1080,7 +1080,7 @@ public:
m_pProtocol->ClientSetSoundPortalPosition( iSoundPortalID, vPos );
};
inline VAVec3 SetSoundPortalPosition( const int iSoundPortalID ) const
inline VAVec3 GetSoundPortalPosition( const int iSoundPortalID ) const
{
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
......
......@@ -793,6 +793,22 @@ void CVANetMessage::WriteSoundSourceInfo( const CVASoundSourceInfo& oInfo )
WriteVec3( oInfo.v3View );
}
void CVANetMessage::WriteSoundPortalInfo( const CVASoundPortalInfo& oInfo )
{
WriteBool( oInfo.bEnabled );
WriteInt( oInfo.iMaterialID );
WriteInt( oInfo.iNextPortalID );
WriteInt( oInfo.iSoundReceiverID );
WriteInt( oInfo.iID );
WriteInt( oInfo.iSoundSourceID );
WriteVAStruct( oInfo.oParams );
WriteQuat( oInfo.qOrient );
WriteString( oInfo.sName );
WriteVec3( oInfo.v3Pos );
WriteVec3( oInfo.v3View );
WriteVec3( oInfo.v3Up );
}
CVAAudioRendererInfo CVANetMessage::ReadAudioRenderingModuleInfo()
{
CVAAudioRendererInfo oRenderer;
......@@ -829,4 +845,22 @@ CVASoundSourceInfo CVANetMessage::ReadSoundSourceInfo()
oInfo.v3Up = ReadVec3();
oInfo.v3View = ReadVec3();
return oInfo;
}
\ No newline at end of file
}
CVASoundPortalInfo CVANetMessage::ReadSoundPortalInfo()
{
CVASoundPortalInfo oInfo;
oInfo.bEnabled = ReadBool();
oInfo.iMaterialID = ReadInt();
oInfo.iNextPortalID = ReadInt();
oInfo.iSoundReceiverID = ReadInt();
oInfo.iID = ReadInt();
oInfo.iSoundSourceID = ReadInt();
ReadVAStruct( oInfo.oParams );
oInfo.qOrient = ReadQuat();
oInfo.sName = ReadString();
oInfo.v3Pos = ReadVec3();
oInfo.v3View = ReadVec3();
oInfo.v3Up = ReadVec3();
return oInfo;
}
......@@ -88,6 +88,7 @@ public:
void WriteAudioRenderingModuleInfo( const CVAAudioRendererInfo& );
void WriteAudioReproductionModuleInfo( const CVAAudioReproductionInfo& );
void WriteSoundSourceInfo( const CVASoundSourceInfo& oInfo );
void WriteSoundPortalInfo( const CVASoundPortalInfo& oInfo );
std::string ReadString();
int ReadInt();
......@@ -109,6 +110,7 @@ public:
CVAAudioRendererInfo ReadAudioRenderingModuleInfo();
CVAAudioReproductionInfo ReadAudioReproductionModuleInfo();
CVASoundSourceInfo ReadSoundSourceInfo();
CVASoundPortalInfo ReadSoundPortalInfo();
VistaConnectionIP* GetConnection() const;
void ClearConnection();
......
......@@ -1327,7 +1327,6 @@ void CVANetNetworkProtocol::ServerGetSoundSourceEnabled()
pMsg->WriteBool( bEnabled );
}
CVASoundSourceInfo CVANetNetworkProtocol::ClientGetSoundSourceInfo( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_SOURCE_INFO, MESSAGE_WITH_ANSWER );
......@@ -2515,6 +2514,7 @@ void CVANetNetworkProtocol::ServerSetSceneEnabled()
int CVANetNetworkProtocol::ClientCreateSoundPortal( const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_SOUND_PORTAL, MESSAGE_WITH_ANSWER );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
......@@ -2550,14 +2550,16 @@ CVASoundPortalInfo CVANetNetworkProtocol::ClientGetSoundPortalInfo( const int iI
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_INFO, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadSoundPortalInfo();
}
void CVANetNetworkProtocol::ServerGetSoundPortalInfo()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const CVASoundPortalInfo oInfo = m_pRealCore->GetSoundPortalInfo( iID );
pMsg->WriteSoundPortalInfo( oInfo );
}
void CVANetNetworkProtocol::ClientSetSoundPortalName( const int iPortalID, const std::string& sName )
......@@ -2587,22 +2589,25 @@ void CVANetNetworkProtocol::ClientSetSoundPortalMaterial( const int iSoundPortal
void CVANetNetworkProtocol::ServerSetSoundPortalMaterial()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundPortalID = pMsg->ReadInt();
const int iMaterialID = pMsg->ReadInt();
m_pRealCore->SetSoundPortalMaterial( iSoundPortalID, iMaterialID );
}
int CVANetNetworkProtocol::ClientGetSoundPortalMaterial( const int iSoundPortalID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_PORTAL_MATERIAL, MESSAGE_WITH_ANSWER );
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_MATERIAL, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iSoundPortalID );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerGetSoundPortalMaterial()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iMaterialID = m_pRealCore->GetSoundPortalMaterial( iID );
pMsg->WriteInt( iMaterialID );
}
void CVANetNetworkProtocol::ClientSetSoundPortalNextPortal( const int iSoundPortalID, const int iNextSoundPortalID )
......@@ -2616,8 +2621,9 @@ void CVANetNetworkProtocol::ClientSetSoundPortalNextPortal( const int iSoundPort
void CVANetNetworkProtocol::ServerSetSoundPortalNextPortal()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundPortalID = pMsg->ReadInt();
const int iNextSoundPortalID = pMsg->ReadInt();
m_pRealCore->SetSoundPortalNextPortal( iSoundPortalID, iNextSoundPortalID );
}
int CVANetNetworkProtocol::ClientGetSoundPortalNextPortal( const int iSoundPortalID )
......@@ -2625,13 +2631,15 @@ int CVANetNetworkProtocol::ClientGetSoundPortalNextPortal( const int iSoundPorta
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_PORTAL_NEXT_SOUND_PORTAL, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iSoundPortalID );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerGetSoundPortalNextPortal()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iNextSoundPortalID = m_pRealCore->GetSoundPortalNextPortal( iID );
pMsg->WriteInt( iNextSoundPortalID );
}
void CVANetNetworkProtocol::ClientSetSoundPortalSoundReceiver( const int iSoundPortalID, const int iSoundReceiverID )
......@@ -2646,7 +2654,8 @@ void CVANetNetworkProtocol::ServerSetSoundPortalSoundReceiver()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundReceiverID = pMsg->ReadInt();
m_pRealCore->SetSoundPortalSoundReceiver( iID, iSoundReceiverID );
}
int CVANetNetworkProtocol::ClientGetSoundPortalSoundReceiver( const int iSoundPortalID )
......@@ -2654,13 +2663,15 @@ int CVANetNetworkProtocol::ClientGetSoundPortalSoundReceiver( const int iSoundPo
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_PORTAL_SOUND_RECEIVER, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iSoundPortalID );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerGetSoundPortalSoundReceiver()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundReceiverID = m_pRealCore->GetSoundPortalSoundReceiver( iID );
pMsg->WriteInt( iSoundReceiverID );
}
void CVANetNetworkProtocol::ClientSetSoundPortalSoundSource( const int iSoundPortalID, const int iSoundSourceID )
......@@ -2674,8 +2685,9 @@ void CVANetNetworkProtocol::ClientSetSoundPortalSoundSource( const int iSoundPor
void CVANetNetworkProtocol::ServerSetSoundPortalSoundSource()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundPortalID = pMsg->ReadInt();
const int iSoundSourceID = pMsg->ReadInt();
m_pRealCore->SetSoundPortalSoundSource( iSoundPortalID, iSoundSourceID );
}
int CVANetNetworkProtocol::ClientGetSoundPortalSoundSource( const int iSoundPortalID )
......@@ -2683,13 +2695,15 @@ int CVANetNetworkProtocol::ClientGetSoundPortalSoundSource( const int iSoundPort
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_SOUND_SOURCE, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iSoundPortalID );
ClientSendCommand( pMsg );
return pMsg->ReadInt();
}
void CVANetNetworkProtocol::ServerGetSoundPortalSoundSource()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const int iSoundSourceID = m_pRealCore->GetSoundPortalSoundSource( iID );
pMsg->WriteInt( iSoundSourceID );
}
void CVANetNetworkProtocol::ClientSetSoundPortalPosition( const int iSoundPortalID, const VAVec3& vPos )
......@@ -2758,6 +2772,38 @@ void CVANetNetworkProtocol::ServerGetSoundPortalOrientation()
pMsg->WriteQuat( qOrient );
}
void CVANetNetworkProtocol::ClientSetSoundPortalEnabled( const int iID, const bool bEnabled )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_SOUND_PORTAL_ENABLED, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteBool( bEnabled );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetSoundPortalEnabled()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bEnabled = pMsg->ReadBool();
m_pRealCore->SetSoundPortalEnabled( iID, bEnabled );
}
bool CVANetNetworkProtocol::ClientGetSoundPortalEnabled( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_ENABLED, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadBool();
}
void CVANetNetworkProtocol::ServerGetSoundPortalEnabled()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bEnabled = m_pRealCore->GetSoundPortalEnabled( iID );
pMsg->WriteBool( bEnabled );
}
std::string CVANetNetworkProtocol::ClientGetSoundPortalName( const int iPortalID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_NAME,
......
......@@ -222,6 +222,7 @@ public:
static const int VA_NP_SET_SOUND_PORTAL_SOUND_SOURCE = 1617;
static const int VA_NP_GET_SOUND_PORTAL_SOUND_RECEIVER = 1618;
static const int VA_NP_SET_SOUND_PORTAL_SOUND_RECEIVER = 1619;
static const int VA_NP_GET_SOUND_PORTAL_INFO = 1620;
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL = 1400;
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL_FROM_PARAMETERS = 1401;
......
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