Jump to content

IG view to Syncker View


photo

Recommended Posts

I'd like to define a view via the IG getView(), setDefinition(), and setRotation() commands and then pass that view on to Syncker.

Syncker's setSyncPlayer() function looks like it should do the trick but it asks for a player and when I try to pass it the IG getView() which creates a player I'm getting an error.  How do I access the player dummy pointer that is created with the IG::getView() function?

 

Also where do I find the source code for the IG class?  I can see a set of virtual functions in IGInterface.h but I can't find the cpp file that defines the specifics.  Are they still using the same definitions as in the deprecated CIGI plugin? Ie. from View.cpp

 

Cigi::View::View(int id)
{
    view_id = id;
    node_player = PlayerDummy::create();
    node = node_player->getNode();
    node->setName(String::format("cigi_view (id: %d)", id).get());

    setDefinition(1, 100000, -40, 40, 30, -30); // default values in CIGI Host Emulator 3
    node_player->setRotation(quat(-90, -90, 0)); // rotate camera to X axis as forward, Y as right, Z as down
}

 

 

Edited by Walters.Robert
Link to comment

Hi, Robert!

To control the synker cameras, you need to configure the synker configuration without shifts(in one place in the center). Currently, AppProjection does not have an API, so you have to manually configure it once.

Next, add callback in your application.

cigi->setReceivePacketCallback(IG::CIGI::CIGI_OPCODE_VIEW_DEF, MakeCallback(this, &AppSystemLogic::view_def));

in view_def method

1. create all cameras in synker
2. Install each slave the correct camera.

simple example:

void AppSystemLogic::view_def(CIGI::ICigiViewDef *packet)
{
  // create camera in slaves
	if (packet->getGroupID() > 0)
	{
		auto group = ig_manager->getViewGroup(packet->getGroupID());
		syncker_manager->createNode(group->getNode(), 1, 1);
	}
	
	IG::IView *view = ig_manager->getView(packet->getViewID());
	syncker_manager->createNode(view->getNode(), 1, 1);
	
  //set cameras to slave example
	if (packet->getViewID() == 1) { // 1 - CIGI view left
		int num_slaves = syncker_manager->getNumSlaves();
		for (int i = 0; i < num_slaves; i++)
		{
			if (strcmp(syncker_manager->getSlaveView(i, 0), "left") == 0) //"left" name in Syncker
			{
				syncker_manager->setSlavePlayer(1<<i, view->getPlayer()->getPlayer());
				Log::message("set view %d to slave %d \n", view->getID(), i);
			}
		}
	}
}

Note: The syncker package "set camera" may come before the camera is fully created on the slave. You may have to call setSlavePlayer in another place. If you created View manualy in your App, just call setSlavePlayer in the next frame.


IG sources is closed. CIGIConnector is bit like to the CigiClient, but has more integration with IG.

Link to comment
×
×
  • Create New...