示例#1
0
Assembly *GraspGLObjects::CreateRollPrompt( double radius ) {

	Assembly *prompt = new Assembly();

	// Angular extent of the circular arrow, where 1.0 = 360°.
	double guage =  radius / 10.0;
	double arc = 0.85;

	Annulus *donut = new Annulus( radius, guage, arc, curve_facets, curve_facets );
	donut->SetAttitude( 0.0, 90.0, 0.0 );
	prompt->AddComponent( donut );

	TaperedAnnulus *tip = new TaperedAnnulus( radius, radius / 3.0, 1.0, 0.05, curve_facets );
	tip->SetAttitude( 0.0, 90.0, 0.0 );
	tip->SetOrientation( - arc * 360.0, 0.0, 0.0 );
	prompt->AddComponent( tip );

	Ellipsoid *base = new Ellipsoid ( guage, guage / 2.0, guage );
	base->SetPosition( radius, 0.0, 0.0 );
	prompt->AddComponent( base );
	prompt->SetColor( 0.5, 0.5, 0.5, 0.5 );

	return prompt;

}
示例#2
0
// Create a translucid cloud to show where to place the hand.
Assembly *GraspGLObjects::CreateZone( void ) {
	Assembly *assembly = new Assembly();
	Disk *disk = new Disk( 50.0, 0.0, 128 );
	assembly->AddComponent( disk );
	// Set the color to a blinking translucid green.
	assembly->SetColor( 0.0, 1.0, 0.0, - 0.05 );
	return assembly;
}
示例#3
0
Assembly *GraspGLObjects::CreateStarrySky( void ) {
	Assembly *sky = new Assembly();
	Patch *patch = new Patch( room_radius * 4.4, room_radius * 4.4 );
	patch->SetTexture( sky_texture );
	sky->AddComponent( patch );
	sky->SetColor(WHITE);
	return( sky );
}
示例#4
0
Assembly *GraspGLObjects::CreateDarkSky( void ) {
	Assembly *darkSky = new Assembly();
	Patch *patch = new Patch( room_radius * 2.2, room_radius * 2.2 );
	patch->SetTexture( sky_texture );// there is something strange if I dont put the texture the ligthing of the whole tunnel changes
	darkSky->AddComponent( patch );
	darkSky->SetColor( BLACK );
	darkSky->enabled = false;
	return( darkSky );
}
示例#5
0
Assembly *GraspGLObjects::CreateIndicator( Texture *texture, double hole_radius ) {

	Assembly	*assembly = new Assembly();
	Disk		*surface;

	surface = new Disk( 120.0, hole_radius, 128 );
	surface->SetTexture( texture );
	assembly->AddComponent( surface );
	assembly->SetColor( 0.9, 0.9, 1.0, hmdTransparency );
	assembly->Disable();

	return assembly;
}
示例#6
0
Assembly *GraspGLObjects::CreatePositionOnlyTarget( void ) {
	Assembly *target = new Assembly();
	Sphere *sphere = new Sphere( room_radius - 100.0 );
	target->AddComponent( sphere );
	target->SetColor( Translucid( CYAN ) );

	// I put back the sphere so that we don't get a flattened disk in an oblique view.
	// I changed the color to CYAN to provide a better background to the yellow-red hand.

	//Disk *disk = new Disk( room_radius - 80.0, 0.0 );//Tagliabue (disk instead of sphere otherwise it hides 
	//disk->SetPosition(0.0 , 0.0 , 5.0);//Tagliabue (moved slightly in front of the sky otherwhise interferences)
	//target->AddComponent( disk );//Tagliabue
	//target->SetColor( Translucid( ORANGE ) );//Tagliabue (translucid is to avoid to see too clearly the pixels)
	return target;
}
示例#7
0
Assembly *GraspGLObjects::CreateKinestheticTool( void ) {

	static const double hand_radius = finger_ball_radius * 2.5;
	Assembly *finger = new Assembly();
	Sphere *sphere = new Sphere( hand_radius );
	sphere->SetPosition( 0.0, 0.0, 0.0 );
	finger->AddComponent( sphere );
	Cylinder *cylinder = new Cylinder( hand_radius, hand_radius, finger_length );
	cylinder->SetPosition( 0.0, 0.0, - finger_length / 2 );
	finger->AddComponent( cylinder );
	sphere = new Sphere( hand_radius );
	sphere->SetPosition( 0.0, 0.0, - finger_length );
	finger->AddComponent( sphere );
	// Set a default color. I like blue.
	// In K-K color will be varied according to the orientation error.
	finger->SetColor( 0.0, 0.0, 1.0, 1.0 );
	return finger;

}
示例#8
0
Assembly *GraspGLObjects::CreateRoom( void ) {

	Assembly *structure = new Assembly();
	structure->SetColor( BLACK );

	// Tunnel
	tunnel = new Assembly();
	Cylinder *cylinder = new Cylinder( room_radius, room_radius, room_length, room_facets );
	cylinder->SetColor( WHITE );
	cylinder->SetTexture( wall_texture );
	cylinder->SetOrientation( 90.0, 0.0, 0.0 );
	tunnel->AddComponent( cylinder );
	// Reference Bars 
	double bar_length = room_length - 5.0 * reference_bar_radius;
	for (int i=0; i < reference_bars; i++ ){ 
		Cylinder *referenceBar = new Cylinder( reference_bar_radius, reference_bar_radius, bar_length, reference_bar_facets );
		referenceBar->SetOffset( room_radius, 0.0, 0.0 );
		referenceBar->SetOrientation( 90.0 + 180 * (float) i / (float) reference_bars, referenceBar->kVector );
		referenceBar->SetColor(  1.0 - (double) i / reference_bars, 1.0f - (double) i / reference_bars, 1.0f - (double) i / reference_bars, 1.0 );
		// The texturing on the bars may be commented out for the moment because it lengthens the rendering time too much.
		referenceBar->SetTexture( references_texture );
		tunnel->AddComponent( referenceBar );
		referenceBar = new Cylinder( reference_bar_radius, reference_bar_radius, bar_length, reference_bar_facets );
		referenceBar->SetOffset( room_radius, 0.0, 0.0 );
		referenceBar->SetOrientation( - 90.0 + 180 * (float) i / (float) reference_bars, referenceBar->kVector );
		referenceBar->SetColor(  (double) i / reference_bars, (double) i / reference_bars, (double) i / reference_bars, 1.0 );
		// See above.
		referenceBar->SetTexture( references_texture );
		tunnel->AddComponent( referenceBar );
	}
	structure->AddComponent( tunnel );

	Sphere *sphere = new Sphere( target_ball_radius );
	sphere->SetPosition( 0.0, 0.0, room_length / 2.0 );
	sphere->SetColor( RED );
	structure->AddComponent( sphere );

	return structure;
}