Пример #1
0
void drawHelp( arMasterSlaveFramework &fw )
{
	static arTexture tex;
	static bool init = false;
	if( !init )
	{
		tex.readJPEG( "help.jpg" );
		init = true;
	}
	
	static float size = 4;
    static GLfloat v[4][3] =
    {
        { -size / 2, -size / 2, 0.0001 },
        { size / 2, -size / 2, 0.0001 },
        { size / 2, size / 2, 0.0001 },
        { -size / 2, size / 2, 0.0001 }
    };
	
	glPushMatrix();
		glMultMatrixf( ( ar_getNavMatrix() * fw.getMidEyeMatrix() * ar_TM( 0, 0, -5 ) ).v );
		
		glClearColor( 1, 1, 1, 0 );
		tex.activate();
		glBegin( GL_QUADS );
			glTexCoord2f( 0, 0 ); glVertex3fv( v[0] );
			glTexCoord2f( 1, 0 ); glVertex3fv( v[1] );
			glTexCoord2f( 1, 1 ); glVertex3fv( v[2] );
			glTexCoord2f( 0, 1 ); glVertex3fv( v[3] );
		glEnd();
		tex.deactivate();
	glPopMatrix();
}
Пример #2
0
// preExchange callback
// Purposes:
//		- Handle navigation updates.
//		- Process user input.
//		- Set random variables.
//		- Update shared memory.
// Notes:
//		This is only called on the master node of the cluster and before shared memory is 
//		transferred to the slave nodes.
void preExchange(arMasterSlaveFramework& framework)
{
	// Handle navigation update. The resulting navigation matrix is automatically transferred
	// to the slave nodes.
	framework.navUpdate();
	
	currentTimeGlobal = framework.getTime();
	
	double currentTime = framework.getTime();
	
	// Process user input.
	
	
	// Update shared memory.
	
	// Transfer data about objects to slave nodes.

	// Detect right hand collisions.
	rightHand.detectCollisions(rightHand, objects);

	// Extend left ray to collision point.
	leftHand.extend(leftHand, objects);

	// Update input state (placement matrix & button states) of our effectors.
	rightHand.updateState(framework.getInputState());
	leftHand.updateState(framework.getInputState());
	// Handle any interaction with the objects (see interaction/arInteractionUtilities.h).
	
	list<arInteractable*> objectlist;
	std::copy(objects.begin (), objects.end (), std::back_inserter(objectlist));
	
	ar_pollingInteraction(rightHand, objectlist);
	ar_pollingInteraction(leftHand, objectlist);
	
	
	// Play click sound if right hand has grabbed an object.
	if(rightHand.getGrabbedObject() != 0) 
	{
		dsLoop(clickSound, "click.mp3", -1, 1.0, arVector3(0, 0, 0));
	}
	// Or reset the trigger
	else 
	{
		dsLoop(clickSound, "click.mp3", 0, 1.0, arVector3(0, 0, 0));
	}
	
	
	
	// Update shared memory.
	
	// Transfer data about objects to slave nodes.

	vector<arInteractable*>::iterator i;
	for(i=objects.begin(); i != objects.end(); ++i) 
	{
		Object* oby = ((Object*)(*i));
		oby->matrix = oby->getMatrix();
	}

	
	arMatrix4 navMatrix = ar_getNavMatrix();

}