Commit 22fb11d1 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding geometry mesh methods

parent 1fa2c574
......@@ -1359,57 +1359,79 @@ public:
inline int CreateGeometryMesh( const CVAGeometryMesh& oMesh, const std::string& sName = "" )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientCreateGeometryMesh( oMesh, sName );
};
inline int CreateGeometryMeshFromParameters( const CVAStruct& oParams, const std::string& sName = "" )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientCreateGeometryMeshFromParameters( oParams, sName );
};
inline bool DeleteGeometryMesh( const int iID )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientDeleteGeometryMesh( iID );
};
inline CVAGeometryMesh GetGeometryMesh( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetGeometryMesh( iID );
};
inline void GetGeometryMeshIDs( std::vector<int>& viIDs ) const
inline void GetGeometryMeshIDs( std::vector< int >& viIDs ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientGetGeometryMeshIDs( viIDs );
};
inline void SetGeometryMeshEnabled( const int iID, const bool bEnabled = true )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientSetGeometryMeshEnabled( iID, bEnabled );
};
inline bool GetGeometryMeshEnabled( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetGeometryMeshEnabled( iID );
};
inline void SetGeometryMeshName( const int iID, const std::string& sName )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientSetGeometryMeshName( iID, sName );
};
inline std::string GetGeometryMeshName( const int iID ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetGeometryMeshName( iID );
};
inline CVAStruct GetGeometryMeshParameters( const int iID, const CVAStruct& oParams ) const
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetGeometryMeshParameters( iID, oParams );
};
inline void SetGeometryMeshParameters( const int iID, const CVAStruct& oParams )
{
VA_EXCEPT_NOT_IMPLEMENTED;
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
m_pProtocol->ClientSetGeometryMeshParameters( iID, oParams );
};
......
......@@ -809,6 +809,33 @@ void CVANetMessage::WriteSoundPortalInfo( const CVASoundPortalInfo& oInfo )
WriteVec3( oInfo.v3Up );
}
void CVANetMessage::WriteGeometryMesh( const CVAGeometryMesh& oMesh )
{
WriteBool( oMesh.bEnabled );
WriteInt( oMesh.iID );
WriteVAStruct( oMesh.oParams );
WriteInt( int( oMesh.voFaces.size() ) );
for( size_t i = 0; i < oMesh.voFaces.size(); i++ )
WriteGeometryMeshFace( ( oMesh.voFaces[ i ] ) );
WriteInt( int( oMesh.voVertices.size() ) );
for( size_t i = 0; i < oMesh.voVertices.size(); i++ )
WriteGeometryMeshVertex( oMesh.voVertices[ i ] );
}
void CVANetMessage::WriteGeometryMeshFace( const CVAGeometryMesh::CVAFace & oFace )
{
WriteInt( oFace.iID );
WriteInt( oFace.iMaterialID );
WriteInt( int( oFace.viVertexList.size() ) );
for( size_t i = 0; i < oFace.viVertexList.size(); i++ )
WriteInt( oFace.viVertexList[ i ] );
}
void CVANetMessage::WriteGeometryMeshVertex( const CVAGeometryMesh::CVAVertex & oVertex )
{
WriteInt( oVertex.iID );
WriteVec3( oVertex.v3Point );
}
CVAAudioRendererInfo CVANetMessage::ReadAudioRenderingModuleInfo()
{
CVAAudioRendererInfo oRenderer;
......@@ -864,3 +891,37 @@ CVASoundPortalInfo CVANetMessage::ReadSoundPortalInfo()
oInfo.v3Up = ReadVec3();
return oInfo;
}
CVAGeometryMesh CVANetMessage::ReadGeometryMesh()
{
CVAGeometryMesh oMesh;
oMesh.bEnabled = ReadBool();
oMesh.iID = ReadInt();
ReadVAStruct( oMesh.oParams );
const int iNumFaces = ReadInt();
for( int i = 0; i < iNumFaces; i++ )
oMesh.voFaces.push_back( ReadGeometryMeshFace() );
const int iNumVertices = ReadInt();
for( int i = 0; i < iNumVertices; i++ )
oMesh.voVertices.push_back( ReadGeometryMeshVertex() );
return oMesh;
}
CVAGeometryMesh::CVAFace CVANetMessage::ReadGeometryMeshFace()
{
CVAGeometryMesh::CVAFace oFace;
oFace.iID = ReadInt();
oFace.iMaterialID = ReadInt();
const int iNumVertices = ReadInt();
for( int i = 0; i < iNumVertices; i++ )
oFace.viVertexList.push_back( ReadInt() );
return oFace;
}
CVAGeometryMesh::CVAVertex CVANetMessage::ReadGeometryMeshVertex()
{
CVAGeometryMesh::CVAVertex oVertex;
oVertex.iID = ReadInt();
oVertex.v3Point = ReadVec3();
return oVertex;
}
......@@ -89,6 +89,9 @@ public:
void WriteAudioReproductionModuleInfo( const CVAAudioReproductionInfo& );
void WriteSoundSourceInfo( const CVASoundSourceInfo& oInfo );
void WriteSoundPortalInfo( const CVASoundPortalInfo& oInfo );
void WriteGeometryMesh( const CVAGeometryMesh& oMesh );
void WriteGeometryMeshFace( const CVAGeometryMesh::CVAFace & oFace );
void WriteGeometryMeshVertex( const CVAGeometryMesh::CVAVertex & oVertex );
std::string ReadString();
int ReadInt();
......@@ -111,6 +114,9 @@ public:
CVAAudioReproductionInfo ReadAudioReproductionModuleInfo();
CVASoundSourceInfo ReadSoundSourceInfo();
CVASoundPortalInfo ReadSoundPortalInfo();
CVAGeometryMesh ReadGeometryMesh();
CVAGeometryMesh::CVAFace ReadGeometryMeshFace();
CVAGeometryMesh::CVAVertex ReadGeometryMeshVertex();
VistaConnectionIP* GetConnection() const;
void ClearConnection();
......
......@@ -675,7 +675,7 @@ std::string CVANetNetworkProtocol::ClientFindFilePath( const std::string& sFileP
return pMsg->ReadString();
}
void CVANetNetworkProtocol::ServerClientFindFilePath()
void CVANetNetworkProtocol::ServerFindFilePath()
{
CVANetMessage* pMsg = ServerGetMessage();
const std::string sFilePath = pMsg->ReadString();
......@@ -2806,13 +2806,9 @@ void CVANetNetworkProtocol::ServerGetSoundPortalEnabled()
std::string CVANetNetworkProtocol::ClientGetSoundPortalName( const int iPortalID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_NAME,
MESSAGE_WITH_ANSWER );
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_SOUND_PORTAL_NAME, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iPortalID );
ClientSendCommand( pMsg );
return pMsg->ReadString();
}
......@@ -2859,6 +2855,206 @@ void CVANetNetworkProtocol::ServerSetSoundPortalParameters()
m_pRealCore->SetSoundPortalParameters( iPortalID, oParams );
}
int CVANetNetworkProtocol::ClientCreateGeometryMesh( const CVAGeometryMesh& oMesh, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_GEOMETRY_MESH, MESSAGE_WITH_ANSWER );
pMsg->WriteGeometryMesh( oMesh );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
const int iID = pMsg->ReadInt();
return iID;
}
void CVANetNetworkProtocol::ServerCreateGeometryMesh()
{
CVANetMessage* pMsg = ServerGetMessage();
const CVAGeometryMesh oMesh = pMsg->ReadGeometryMesh();
const std::string sName = pMsg->ReadString();
const int iID = m_pRealCore->CreateGeometryMesh( oMesh, sName );
pMsg->WriteInt( iID );
}
int CVANetNetworkProtocol::ClientCreateGeometryMeshFromParameters( const CVAStruct& oStruct, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CREATE_GEOMETRY_MESH_FROM_PARAMETERS, MESSAGE_WITH_ANSWER );
pMsg->WriteVAStruct( oStruct );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
const int iID = pMsg->ReadInt();
return iID;
}
void CVANetNetworkProtocol::ServerCreateGeometryMeshFromParameters()
{
CVANetMessage* pMsg = ServerGetMessage();
CVAStruct oParams;
pMsg->ReadVAStruct( oParams );
const std::string sName = pMsg->ReadString();
const int iID = m_pRealCore->CreateGeometryMeshFromParameters( oParams, sName );
pMsg->WriteInt( iID );
}
bool CVANetNetworkProtocol::ClientDeleteGeometryMesh( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_DELETE_GEOMETRY_MESH, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadBool();
}
void CVANetNetworkProtocol::ServerDeleteGeometryMesh()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bRet = m_pRealCore->DeleteGeometryMesh( iID );
pMsg->WriteBool( bRet );
}
CVAGeometryMesh CVANetNetworkProtocol::ClientGetGeometryMesh( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GEOMETRY_MESH, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadGeometryMesh();
}
void CVANetNetworkProtocol::ServerGetGeometryMesh()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const CVAGeometryMesh oMesh = m_pRealCore->GetGeometryMesh( iID );
pMsg->WriteGeometryMesh( oMesh );
}
void CVANetNetworkProtocol::ClientGetGeometryMeshIDs( std::vector< int >& viIDs )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GEOMETRY_MESH_IDS, MESSAGE_WITH_ANSWER );
ClientSendCommand( pMsg );
viIDs.clear();
const int iNumElems = pMsg->ReadInt();
for( int i = 0; i < iNumElems; i++ )
viIDs.push_back( pMsg->ReadInt() );
}
void CVANetNetworkProtocol::ServerGetGeometryMeshIDs()
{
CVANetMessage* pMsg = ServerGetMessage();
std::vector< int > vIDs;
m_pRealCore->GetSoundSourceIDs( vIDs );
pMsg->WriteInt( ( int ) vIDs.size() );
for( size_t i = 0; i < vIDs.size(); i++ )
pMsg->WriteInt( vIDs[ i ] );
}
void CVANetNetworkProtocol::ClientSetGeometryMeshName( const int iID, const std::string& sName )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_GEOMETRY_MESH_NAME, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteString( sName );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerClientSetGeometryMeshName()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const std::string sName = pMsg->ReadString();
m_pRealCore->SetGeometryMeshName( iID, sName );
}
std::string CVANetNetworkProtocol::ClientGetGeometryMeshName( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GEOMETRY_MESH_NAME, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadString();
}
void CVANetNetworkProtocol::ServerGetGeometryMeshName()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const CVAGeometryMesh& oMesh = m_pRealCore->GetGeometryMesh( iID );
pMsg->WriteGeometryMesh( oMesh );
}
CVAStruct CVANetNetworkProtocol::ClientGetGeometryMeshParameters( const int iID, const CVAStruct& oArgs )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GEOMETRY_MESH_PARAMETERS, MESSAGE_WITH_ANSWER );
pMsg->WriteInt( iID );
pMsg->WriteVAStruct( oArgs );
ClientSendCommand( pMsg );
CVAStruct oParams;
pMsg->ReadVAStruct( oParams );
return oParams;
}
void CVANetNetworkProtocol::ServerGetGeometryMeshParameters()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
CVAStruct oArgs;
pMsg->ReadVAStruct( oArgs);
CVAStruct oParams = m_pRealCore->GetGeometryMeshParameters( iID, oArgs );
pMsg->WriteVAStruct( oParams );
}
void CVANetNetworkProtocol::ClientSetGeometryMeshParameters( const int iPortalID, const CVAStruct& oParams )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_GEOMETRY_MESH_ENABLED, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iPortalID );
pMsg->WriteVAStruct( oParams );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetGeometryMeshParameters()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
CVAStruct oParams;
pMsg->ReadVAStruct( oParams );
m_pRealCore->SetGeometryMeshParameters( iID, oParams );
}
bool CVANetNetworkProtocol::ClientGetGeometryMeshEnabled( const int iID )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_GEOMETRY_MESH_ENABLED, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
ClientSendCommand( pMsg );
return pMsg->ReadBool();
}
void CVANetNetworkProtocol::ServerGetGeometryMeshEnabled()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bEnabled = m_pRealCore->GetGeometryMeshEnabled( iID );
pMsg->WriteBool( bEnabled );
}
void CVANetNetworkProtocol::ClientSetGeometryMeshEnabled( const int iID, const bool bEnabled )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_GEOMETRY_MESH_ENABLED, MESSAGE_ALLOWS_BUFFERING );
pMsg->WriteInt( iID );
pMsg->WriteBool( bEnabled );
ClientSendCommand( pMsg );
}
void CVANetNetworkProtocol::ServerSetGeometryMeshEnabled()
{
CVANetMessage* pMsg = ServerGetMessage();
const int iID = pMsg->ReadInt();
const bool bEnabled = pMsg->ReadBool();
m_pRealCore->SetGeometryMeshEnabled( iID, bEnabled );
}
void CVANetNetworkProtocol::ClientSetInputGain( const double dGain )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_SET_INPUT_GAIN, MESSAGE_ALLOWS_BUFFERING );
......
......@@ -224,6 +224,18 @@ public:
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_GEOMETRY_MESH = 1700;
static const int VA_NP_CREATE_GEOMETRY_MESH_FROM_PARAMETERS = 1701;
static const int VA_NP_DELETE_GEOMETRY_MESH = 1702;
static const int VA_NP_GET_GEOMETRY_MESH = 1703;
static const int VA_NP_GET_GEOMETRY_MESH_IDS = 1704;
static const int VA_NP_GET_GEOMETRY_MESH_PARAMETERS = 1705;
static const int VA_NP_SET_GEOMETRY_MESH_PARAMETERS = 1706;
static const int VA_NP_GET_GEOMETRY_MESH_NAME = 1707;
static const int VA_NP_SET_GEOMETRY_MESH_NAME = 1708;
static const int VA_NP_GET_GEOMETRY_MESH_ENABLED = 1709;
static const int VA_NP_SET_GEOMETRY_MESH_ENABLED = 1710;
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL = 1400;
static const int VA_NP_CREATE_ACOUSTIC_MATERIAL_FROM_PARAMETERS = 1401;
static const int VA_NP_DELETE_ACOUSTIC_MATERIAL = 1402;
......@@ -389,7 +401,7 @@ public:
void ServerGetSearchPaths();
std::string ClientFindFilePath( const std::string& sFilePath );
void ServerClientFindFilePath();
void ServerFindFilePath();
CVAStruct ClientCallModule( const std::string& sModuleName, const CVAStruct& oArgs );
void ServerCallModule();
......@@ -716,6 +728,30 @@ public:
void ServerSetSoundPortalParameters();
int ClientCreateGeometryMesh( const CVAGeometryMesh& oMesh, const std::string& sName );
void ServerCreateGeometryMesh();
int ClientCreateGeometryMeshFromParameters( const CVAStruct& oParams, const std::string& sName );
void ServerCreateGeometryMeshFromParameters();
bool ClientDeleteGeometryMesh( const int iID );
void ServerDeleteGeometryMesh();
CVAGeometryMesh ClientGetGeometryMesh( const int iID );
void ServerGetGeometryMesh();
void ClientGetGeometryMeshIDs( std::vector< int >& viIDs );
void ServerGetGeometryMeshIDs();
void ClientSetGeometryMeshName( const int iID, const std::string& sName );
void ServerClientSetGeometryMeshName();
std::string ClientGetGeometryMeshName( const int iID );
void ServerGetGeometryMeshName();
void ClientSetGeometryMeshParameters( const int iID, const CVAStruct& oParams );
void ServerSetGeometryMeshParameters();
CVAStruct ClientGetGeometryMeshParameters( const int iID, const CVAStruct& oParams );
void ServerGetGeometryMeshParameters();
void ClientSetGeometryMeshEnabled( const int iID, const bool bEnabled );
void ServerSetGeometryMeshEnabled();
bool ClientGetGeometryMeshEnabled( const int iID );
void ServerGetGeometryMeshEnabled();
double ClientGetCoreClock();
void ServerGetCoreClock();
void ClientSetCoreClock( const double dSeconds );
......
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