SlidingDoors::SlidingDoors ( double room_width, double room_height, double thickness ) { Slab *slab; this->room_width = room_width; this->room_height = room_height; // Panels left_panel = new Assembly(); slab = new Slab( room_width, room_height * 5.0, thickness ); left_panel->AddComponent( slab ); slab = new Slab( HANDLE_SIZE, room_height * 5.0, HANDLE_SIZE ); slab->SetOffset( room_width / 2.0 - HANDLE_SIZE / 2.0, 0.0, thickness / 2.0 + HANDLE_SIZE ); slab->SetColor( RED ); left_panel->AddComponent( slab ); left_panel->SetOffset( - room_width / 2.0, room_height / 2.0, 0.0 ); AddComponent( left_panel ); right_panel = new Assembly(); slab = new Slab( room_width, room_height * 5.0, thickness ); right_panel->AddComponent( slab ); right_panel->SetOffset( room_width / 2, room_height / 2.0, 0.0 ); slab = new Slab( HANDLE_SIZE, room_height * 5.0, HANDLE_SIZE ); slab->SetOffset( - room_width / 2.0 + HANDLE_SIZE / 2.0, 0.0, thickness / 2.0 + HANDLE_SIZE ); slab->SetColor( RED ); right_panel->AddComponent( slab ); AddComponent( right_panel ); SetPosition( 0.0, 0.0, 0.0 ); SetColor( bulkhead_color ); }
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; }
Assembly *GraspGLObjects::CreateTorso( void ) { Assembly *torso = new Assembly(); Slab *slab = new Slab( torso_shape[X], torso_shape[Y], torso_shape[Z] ); slab->SetColor( 0.1f, 0.4f, 0.0f ); torso->AddComponent( slab ); Disk *disk = new Disk( 50.0 ); disk->SetPosition( 0.0, 0.0, -40.0 ); disk->SetColor( 1.0f, 0.7f, 0.0f ); torso->AddComponent( disk ); return torso; }
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 ); }
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 ); }
Dial::Dial ( void ) { thickness = 10.0; radius = 100.0; tilt = 30.0; label_width = 50.0; Slab *slab; Disk *disk; Cylinder *cylinder; Patch *rectangle; char path[1024]; sprintf( path, "%s%s", AfdTexturePath, "bmp\\ten.bmp" ); ten_texture = new Texture( path, label_width / 2.0, label_width / 2.0 ); sprintf( path, "%s%s", AfdTexturePath, "bmp\\five.bmp" ); five_texture = new Texture( path, label_width / 2.0, label_width / 2.0 ); sprintf( path, "%s%s", AfdTexturePath, "bmp\\zero.bmp" ); zero_texture = new Texture( path, label_width / 2.0, label_width / 2.0 ); sprintf( path, "%s%s", AfdTexturePath, "bmp\\meters.bmp" ); meters_texture = new Texture( path, label_width * 2.0, label_width / 2.0 ); needle = new Slab( thickness / 4.0, 0.90 * radius, thickness / 2.0 ); needle->SetOffset( 0.0, radius / 2.0, thickness / 2.0 ); needle->SetColor( ORANGE ); AddComponent( needle ); rectangle = new Patch( label_width / 2.0 , label_width / 2.0 ); rectangle->SetPosition( radius + label_width / 2.0, 0.0, 0.0 ); rectangle->SetTexture( ten_texture ); AddComponent( rectangle ); rectangle = new Patch( label_width / 2.0 , label_width / 2.0 ); rectangle->SetPosition( 0.0, radius + label_width / 2.0, 0.0 ); rectangle->SetTexture( five_texture ); AddComponent( rectangle ); rectangle = new Patch( label_width / 2.0 , label_width / 2.0 ); rectangle->SetPosition( - ( radius + label_width / 2.0 ), 0.0, 0.0 ); rectangle->SetTexture( zero_texture ); AddComponent( rectangle ); rectangle = new Patch( 2 * label_width , label_width / 2.0 ); rectangle->SetPosition( 0.0, - radius - label_width / 2.0, 0.0 ); rectangle->SetTexture( meters_texture ); // AddComponent( rectangle ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( -18.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( -36.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( -54.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( -72.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( -90.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( 18.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( 36.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( 54.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( 72.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 ); slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 ); slab->SetOrientation( 90.0, k_vector ); slab->SetColor( BLACK ); AddComponent( slab ); disk = new Disk( radius ); AddComponent( disk ); cylinder = new Cylinder( radius, radius, thickness ); AddComponent( cylinder ); SetColor( CYAN ); SetAttitude( tilt, i_vector ); minimum = 0.0; maximum = 10000; }