Beispiel #1
0
MarkerStructureGLObject *GraspGLObjects::CreateHandMarkerStructure ( char *model_file ) {

	Slab *bar;
	Assembly *frame, *square, *diamond;

	MarkerStructureGLObject *structure = new MarkerStructureGLObject( model_file );

	frame = new Assembly();

	square = new Assembly();
	bar = new Slab( STRUCTURE_BAR_RADIUS, 160.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition(   70.0, 0.0, 0.0 );
	square->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, 160.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( - 70.0, 0.0, 0.0 );
	square->AddComponent( bar );
	bar = new Slab( 160.0, STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( 0.0, 70.0, 0.0 );
	square->AddComponent( bar );
	bar = new Slab( 160.0, STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( 0.0, -70.0, 0.0 );
	square->AddComponent( bar );

	frame->AddComponent( square );

	diamond = new Assembly();
	bar = new Slab( STRUCTURE_BAR_RADIUS, 80.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition(   35.0, 0.0, 0.0 );
	diamond->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, 80.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( - 35.0, 0.0, 0.0 );
	diamond->AddComponent( bar );
	bar = new Slab( 80.0, STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( 0.0, 35.0, 0.0 );
	diamond->AddComponent( bar );
	bar = new Slab( 80.0, STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( 0.0, -35.0, 0.0 );
	diamond->AddComponent( bar );
	diamond->SetOrientation( 45.0, 0.0, 0.0 );
	diamond->SetPosition( 0.0, 0.0, -100.0 );

	frame->AddComponent( diamond );

	static double vertices[][2] = {{-100, -40}, {-100, 40}, {0, 70}, {100, 50}, {100, -50}, {0, -70}, {-100, -40}};
	Extrusion *plate = new Extrusion( 10.0, vertices, 7 );
	plate->SetOrientation( 0.0, 0.0, 90.0 );
	plate->SetPosition( -10.0, 0.0, 0.0 );
	frame->AddComponent( plate );

	square->SetColor( Translucid( GRAY ) );
	diamond->SetColor( Translucid( GRAY ) );
	plate->SetColor( Translucid( GRAY ) );
	frame->SetOffset( 0.0, 0.0, 70.0 );

	structure->AddComponent( frame );
	return( structure );
}
Beispiel #2
0
void MarkerStructureGLObject::AddBar( int marker1, int marker2 ) {

	Slab *slab;
	Vector3 center, delta;

	AddVectors( center, modelMarker[marker1].position, modelMarker[marker2].position );
	ScaleVector( center, center, 0.5 );
	SubtractVectors( delta, modelMarker[marker1].position, modelMarker[marker2].position );
	slab = new Slab( STRUCTURE_BAR_RADIUS, VectorNorm( delta ) * 1.1, STRUCTURE_BAR_RADIUS );
	slab->SetPosition( center[X], center[Y], center[Z] + STRUCTURE_BAR_RADIUS );
	slab->SetOrientation( ToDegrees( atan2( delta[X], delta[Y] ) ), 0.0, 0.0 );
	slab->SetColor( 1.0, 1.0, 0.0, 0.35 );
	AddComponent( slab );
}
Beispiel #3
0
Assembly *GraspGLObjects::CreateCodaBar( double r, double g, double b ) {

	Assembly *coda = new Assembly();
	Slab *slab = new Slab( coda_shape[X], coda_shape[Y], coda_shape[Z] );
	slab->SetColor( r, g, b, 1.0 );
	coda->AddComponent( slab );
	for ( int lens = 0; lens < 3; lens ++ ) {
		slab = new Slab( coda_shape[X] / 10.0, coda_shape[Y] * 0.8, coda_shape[Z] );
		slab->SetPosition( ( 1 - lens ) * 0.4 * coda_shape[X], 0.0, - 10.0 );
		slab->SetColor( BLACK );
		coda->AddComponent( slab );
	}
	coda->SetOffset( - 0.4 * coda_shape[X], 0.0, 0.0 );
	coda->SetAttitude( 0.0, -90.0, 0.0 );
	return coda;

}
Beispiel #4
0
MarkerStructureGLObject *GraspGLObjects::CreateHmdMarkerStructure ( char *model_file ) {

	MarkerStructureGLObject *structure = new MarkerStructureGLObject( model_file );

	Slab *bar;
	Assembly *frame = new Assembly();

	bar = new Slab( STRUCTURE_BAR_RADIUS, 100.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition(   0.0, 0.0, 0.0 );
	frame->AddComponent( bar );
	bar = new Slab( 210.0, STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS );
	bar->SetPosition(   0.0, 0.0, 0.0 );
	frame->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, 160.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( 110.0, 0.0, 40.0 );
	frame->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, 160.0, STRUCTURE_BAR_RADIUS );
	bar->SetPosition( -110.0, 0.0, 40.0 );
	frame->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS, 40 );
	bar->SetPosition( -110.0, 0.0, 20.0 );
	frame->AddComponent( bar );
	bar = new Slab( STRUCTURE_BAR_RADIUS, STRUCTURE_BAR_RADIUS, 40 );
	bar->SetPosition( 110.0, 0.0, 20.0 );
	frame->AddComponent( bar );


	frame->SetPosition( 0.0, 0.0, -10.0 );

	structure->AddComponent( frame );


	structure->SetColor( Translucid( GRAY ) );
	//	structure->SetOrientation( 0.0, 0.0, 90.0 );
	return( structure );
}
CODA::CODA( void ) {
	
	double near_vertex[3], far_vertex[3];
	double vergence;
	
	
	// Initialize standard parameters.
	reach = 3000.0;
	baseline = 600.0;
	toein = 7.0;
	fov = 70.0;
	
	// Create a structure to hold everything together.
	all = new Assembly();
	AddComponent( all );
	
	// Compute frustrum.
	vergence = radians( fov / 2.0 + toein );
	
	near_vertex[Z] = sin( PI / 2.0 - vergence ) * baseline / sin( 2.0 * vergence );
	near_vertex[X] = 0.0;
	near_vertex[Y] = near_vertex[Z] * tan( radians( fov / 2.0 ) );
	
	far_vertex[X] = reach * cos( PI / 2.0 - vergence ) - baseline / 2.0;
	far_vertex[Y] = reach * sin( PI / 2.0 - vergence );
	far_vertex[Z] = reach * sin( radians( fov / 2.0 ) );
	
	frustrum = new Frustrum( near_vertex, far_vertex );
	frustrum->SetColor( Translucid( MAGENTA ) );
	all->AddComponent( frustrum );
	
	// Create the camera bar objects.
	
	Slab *slab;
	double length = baseline + 120;
	
	body = new Slab( length, 120.0, 100.0);
	//  body->SetColor( GRAY );
	all->AddComponent( body );
	
	caps = new Assembly();
	slab = new Slab( 40.0, 140.0, 120.0 );
	slab->SetPosition( length / 2.0 + 20.0, 0.0, 0.0 );
	caps->AddComponent( slab );
	slab = new Slab( 40.0, 140.0, 120.0 );
	slab->SetPosition( - length / 2.0 - 20.0, 0.0, 0.0 );
	caps->AddComponent( slab );
	caps->SetColor( BLACK );
	all->AddComponent( caps );
	
	lenses = new Assembly();
	all->AddComponent( lenses );
	lenses->SetColor( BLACK );
	
	slab = new Slab( 140.0, 80.0, 40.0 );
	slab->SetPosition( - baseline / 2.0 + 20, 0.0, 50.0 );
	lenses->AddComponent( slab );
	
	slab = new Slab( 140.0, 80.0, 40.0 );
	slab->SetPosition( baseline / 2.0 - 20, 0.0, 50.0 );
	lenses->AddComponent( slab );
	
	slab = new Slab( 120.0, 80.0, 40.0 );
	slab->SetPosition( 0.0, 0.0, 50.0 );
	lenses->AddComponent( slab );
	
	slab = new Slab( 100.0, 80.0, 40.0 );
	slab->SetPosition( - baseline / 4.0, 0.0, 50.0 );
	lenses->AddComponent( slab );

	power_led = new Slab( 20, 10, 10 );
	power_led->SetPosition( - baseline / 4.0 - 20, - 20.0, 80.0 );
	power_led->SetColor( GREEN );
	lenses->AddComponent( power_led );

	acquire_led = new Slab( 20, 10, 10 );
	acquire_led->SetPosition( - baseline / 4.0 - 20, 20.0, 80.0 );
	acquire_led->SetColor( ORANGE );
	lenses->AddComponent( acquire_led );

	
	all->SetOrientation( 0.0, 90.0, 180.0 );
	
}
Beispiel #6
0
ISS::ISS( ApertureType type, RoomTextures *tex, double width, double height, double length ) {


  // Object dimensions in the virtual world.
  // All values are in millimeters.

  // The rack is slightly smaller than the full height of the module.
  // This leaves a border top and bottom.
  rack_height =  1600.0; // Real height of Columbus module walls (rack) in mm.
  rack_width =   1000.0; // Real width of rack in mm.

  // The Columbus module is 2 x 2 x 8 meters wide.
  room_width  =  width;
  room_height =  height; 
  room_length =  length;
  wall_thickness = 250.0;

  float blank_color[4] = { 0.15, 0.15, 0.05, 1.0 };

//  char *rack_texture_file = "epm.bmp";

  Slab *slab;

 /* 
  * Define a viewing projection with:
  *  45° vertical field-of-view - horizontal fov will be determined by window aspect ratio.
  *  60 mm inter-pupilary distance - the units don't matter to OpenGL, but all the dimensions
  *      that I give for the model room here are in mm.
  *  10.0 to 10000.0  depth clipping planes - making this smaller would improve the depth resolution.
  */
  viewpoint = new Viewpoint( 6.0, 45.0, 10.0, 20000.0);

  /*
   * The rack texture is 256 pixels wide by 512 high.
   * We map this onto a patch that is 2 meters wide by 4 meter high in the virtual scene.
   * It then gets pasted on the left and right walls. The pattern is repeated to fill the
   *  entire wall from left to right. 
   * A neutral panel is added above and below to avoid gaps if the floor or ceiling are
   *  above or below the limits of the panel.
   */
//  rack_texture = new Texture( rack_texture_file, rack_width, rack_height );


  // Static objects in the room.

  SetColor( WHITE );
  SetPosition( 0.0, 0.0, 0.0 );

  // Right Wall
  right_wall = new Assembly;
  slab = new Slab( room_length, rack_height, wall_thickness );
  if ( tex ) slab->texture = tex->right;
//  slab->texture = rack_texture;
  right_wall->AddComponent( slab );

  // Extend Above
  slab = new Slab( room_length, rack_height, wall_thickness );
  slab->SetPosition( 0.0, rack_height, 0.0 );
  slab->SetColor( blank_color );
  right_wall->AddComponent( slab );

  // Extend Below
  slab = new Slab( room_length, rack_height, wall_thickness );
  slab->SetPosition( 0.0, - rack_height, 0.0 );
  slab->SetColor( blank_color );
  right_wall->AddComponent( slab );

  AddComponent( right_wall );
  right_wall->SetOffset( 0.0, room_height / 2.0, 0.0 );
  right_wall->SetPosition( ( room_width + wall_thickness ) / 2.0, 0.0, room_length / 2.0 );
  right_wall->SetOrientation( -90.0, j_vector );

// Left Wall
  left_wall = new Assembly;
  slab = new Slab( room_length, rack_height, wall_thickness );
  if ( tex ) slab->texture = tex->left;
//  slab->texture = rack_texture;
  left_wall->AddComponent( slab );

  // Extend Above
  slab = new Slab( room_length, rack_height, wall_thickness );
  slab->SetPosition( 0.0, rack_height, 0.0 );
  slab->SetColor( blank_color );
  left_wall->AddComponent( slab );

  // Extend Below
  slab = new Slab( room_length, rack_height, wall_thickness );
  slab->SetPosition( 0.0, - rack_height, 0.0 );
  slab->SetColor( blank_color );
  left_wall->AddComponent( slab );

  AddComponent( left_wall );
  left_wall->SetOffset( 0.0 , room_height / 2.0, 0.0 );
  left_wall->SetPosition( ( - room_width - wall_thickness ) / 2, 0.0, room_length / 2.0 );
  left_wall->SetOrientation( 90.0, j_vector );

  // Create a ceiling. 
  // Make it wide enough so as not to see the left and right edges.
  // The dimension Y sets the far edge in depth.
  ceiling = new Slab( 6.0 * room_width, room_length, wall_thickness );
  ceiling->SetOffset( 0.0,0.0, wall_thickness / 2 );
  ceiling->SetPosition( room_width / 2.0, rack_height, 0.0 );
  ceiling->SetOrientation( 90.0, i_vector );
  ceiling->SetColor( WHITE );
  if ( tex ) ceiling->texture = tex->ceiling;
  AddComponent( ceiling );

  // Floor
//  deck = new Slab( 6.0 * room_width, 2.0 * room_length, wall_thickness );
//  deck = new Slab( 6.0 * room_width, 2.0 * room_length, wall_thickness );
  deck = new Slab( 6.0 * room_width, 1.1 * room_length, wall_thickness );
  deck->SetColor( WHITE );
  deck->SetOffset( 0.0,0.0, wall_thickness / 2 );
  deck->SetPosition( - room_width / 2.0, 0.0, 0.0 );
  deck->SetOrientation( -90.0, i_vector );
  if ( tex ) deck->texture = tex->floor;
  AddComponent( deck );

  // Background
  if ( tex ) {
    if ( tex->rear ) {
      backdrop = new Patch( 6.0 * room_width, 6.0 * room_height );
      backdrop->SetPosition( 0.0, 0.0, - room_length );
      backdrop->SetTexture( tex->front );
      AddComponent( backdrop );
    }
  }

  /*
   * Create the doorway.
   */

  switch ( type ) {

  case SLIDING:
    doorway = new SlidingDoors( room_width, room_height, wall_thickness );
    break;

  case HUBLOT:
    doorway = new Hublot( room_width, room_height, wall_thickness );
    break;

  }
  doorway->SetColor( bulkhead_color );
  AddComponent( doorway );


  SetAperture( 1000.0 );
  SetPerceivedEH( .75 * rack_height );
  SetPerceivedDistance( 3000.0 );

}