|
anyKode Marilou
|
Changing the active viewpoint.
bool ViewpointChoose(xkode::lib::String ViewpointFullName);
|
Parameters |
Description |
|
xkode::lib::String ViewpointFullName |
[in] Absolute viewpoint's name. If the name is empty, the default user viewpoint is chosen. |
true is the simulator have received the command, false otherwise.
ViewpointChoose changes Exec's active viewpoint. The viewpoint can be a Viewpoint type geometry as well as a Bookmark (v4.7.17).
//////////////////////////////////////////////////////////
//source code from Samples/simple/6.0_Viewpoint
//////////////////////////////////////////////////////////
#include "Modacpp.h"
#include "conio.h"
#define MODASERVER "localhost"
int main(int argc, char* argv[])
{
ModaCPP::Connection *pConnection=new ModaCPP::Connection(true);
//Try connect to MODA server
if(pConnection->Connect(MODASERVER))
{
_cprintf("Connection ok to moda server\r\n");
while(!_kbhit())
{
//choose default viewpoint and rotate it around Z (Y for directx ...)
pConnection->ViewpointChooseDefault();
for(int i=0;i<360;i+=2)
{
MODAVECTOR3 pos=MODAVECTOR3(cos(xkode::lib::Math::ToRad(float(i))),2.0f,sin(xkode::lib::Math::ToRad(float(i))));
MODAVECTOR3 dir=-pos;
pConnection->ViewpointMoveTo(pos,dir);
pConnection->Sleep(20);
}
//change viewpoint
pConnection->ViewpointChoose("/viewpoint0");
pConnection->Sleep(1000);
pConnection->ViewpointChoose("/viewpoint1");
pConnection->Sleep(1000);
pConnection->ViewpointChoose("/viewpoint2");
pConnection->Sleep(1000);
pConnection->ViewpointChoose("/viewpoint3");
pConnection->Sleep(1000);
pConnection->ViewpointChoose("bookmark3");
pConnection->Sleep(1000);
}
}
else
{
_cprintf("Unable to connect to moda server\r\n");
}
//Disconnect & delete
pConnection->Disconnect();
delete pConnection;
_getch();
return 0;
}|
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|