00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <assert.h>
00016
00017
00018
00019 #include "synchronization/semaphore.h"
00020 #include "PL_Juan.h"
00021 #include "jma_switch.h"
00022 #include "jma_aca_macros.h"
00023 #include <iosfwd>
00024 #include <iostream>
00025
00026 #include "opengl/glos.h"
00027 #include <gl/gl.h>
00028 #include "smoothers\SmootherBase.h"
00029
00030 #define THICKNESS 3
00031 #define WIN_WIDTH 1000
00032 #define WIN_HEIGHT 500
00033 #define EPSILON 1.0e-3
00034
00035 #define NUMBER_OF_EMBRYOS MAX_EMBRYOS
00036 #define BIG_NUMBER 1.0e+37
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 PL_Juan::PL_Juan():
00049 tree( NULL ),
00050 m_Initialized( false )
00051 {
00052 }
00053
00054
00055
00056
00057 PL_Juan::~PL_Juan()
00058 {
00059 delete tree;
00060 tree = NULL;
00061 }
00062
00063
00064
00065
00066 void PL_Juan::Initialize()
00067 {
00068 if( !m_Initialized )
00069 {
00070 tree = new JMA_Roadmap_Tree;
00071 m_Initialized = true;
00072 }
00073 }
00074
00075
00076 bool PL_Juan::Plan ()
00077 {
00078
00079 PlannerBase::StartTimer() ;
00080 Initialize();
00081 path.Clear() ;
00082
00083 if( collisionDetector->IsInterfering( GetStartConfig() ) )
00084 {
00085 path.AppendPoint( GetGoalConfig() );
00086 path.AppendPoint( GetGoalConfig() );
00087 return false;
00088 }
00089 if( collisionDetector->IsInterfering( GetGoalConfig() ) )
00090 {
00091 path.AppendPoint( GetStartConfig() ) ;
00092 path.AppendPoint( GetStartConfig() ) ;
00093 return false ;
00094 }
00095
00096 int new_path[500];
00097 int new_n_landmarks;
00098 int n_landmarks;
00099 int path_found;
00100
00101
00102
00103
00104 Semaphore semaphore( guid );
00105 semaphore.Lock();
00106 do
00107 {
00108 if (!(path_found = Search( tree ) ) )
00109 {
00110
00111 Explore( tree );
00112 }
00113 if( HasTimeLimitExpired() == true )
00114 {
00115 return false ;
00116 }
00117 semaphore.Unlock();
00118 semaphore.Lock();
00119 }while( ( !path_found ) && ( tree->n_nodes < MAX_LANDMARKS ) );
00120 semaphore.Unlock();
00121
00122
00123 if( path_found )
00124 {
00125
00126 GetIdsPath( tree, tree->n_nodes-1, ids_list, &n_landmarks );
00127 SimplifyIdsTrajectory( tree, ids_list, n_landmarks, new_path, &new_n_landmarks );
00128
00129 for( int i = 0; i < new_n_landmarks; i++ )
00130 {
00131 int pointIndex = new_path[ i ] ;
00132 Configuration point = tree->node[ pointIndex ].landmark.dof ;
00133 path.AppendPoint( point ) ;
00134 }
00135
00136
00137
00138
00139 path.AppendPoint( GetGoalConfig() ) ;
00140 }
00141 else
00142 {
00143 if( path.Size() == 0 )
00144 {
00145 path.AppendPoint( GetStartConfig() ) ;
00146 }
00147 return false ;
00148 }
00149
00150
00151 int size = path.Size();
00152 for( int i = 0; i < size - 1; ++i )
00153 {
00154 Configuration p1 = path[ i ] ;
00155 Configuration p2 = path[ i + 1 ] ;
00156 assert( !collisionDetector->IsInterferingLinear( p1, p2 ) ) ;
00157 if( collisionDetector->IsInterferingLinear( p1, p2 ) )
00158 {
00159 assert( false ) ;
00160 }
00161 }
00162
00163
00164 if( this->m_Smoother != NULL )
00165 {
00166 this->m_Smoother->SetPath( &this->path );
00167 this->m_Smoother->SetCollisionDetector( this->collisionDetector );
00168 m_Smoother->Smooth();
00169 this->path = m_Smoother->GetPath();
00170 m_Smoother->SetPath( NULL );
00171 }
00172
00173 return true ;
00174
00175 }
00176
00177 double PL_Juan::MyDistanceFunc (const Configuration& conf1, const Configuration& conf2) const
00178 {
00179
00180 return collisionDetector->DistanceBetween( conf1, conf2 ) ;
00181
00182 }
00183
00184 int PL_Juan::MyRandomPath (int id_landmark, const int id_embryo, const int n_dof, const JMA_Configuration init_conf, JMA_Configuration* embryo) const
00185 {
00186
00187 Configuration config = GetStartConfig();
00188 bool isConfigInCollision = collisionDetector->IsInterfering( config ) ;
00189 assert( isConfigInCollision == false ) ;
00190 Configuration current = init_conf.dof ;
00191
00192
00193
00194 for( int j = 0; j < config.DOF(); j++ )
00195 {
00196 double jointMax = collisionDetector->JointMax( j ) ;
00197 double jointMin = collisionDetector->JointMin( j ) ;
00198 double random01 = (double) switch_random()/BIGEST_RND_NUMBER ;
00199 double jointVal = jointMin + random01 * ( jointMax - jointMin );
00200 config[ j ] = jointVal ;
00201 }
00202
00203 while( collisionDetector->IsInterferingLinear( current, config ) )
00204 {
00205
00206 Configuration intersect = collisionDetector->GetLastIntersection() ;
00207 config = ( current + intersect ) / 2 ;
00208 }
00209 ( *embryo ).dof = config ;
00210 return(0);
00211
00212 }
00213
00214 int PL_Juan::SimplifyIdsTrajectory (const JMA_Roadmap_Tree* tree, const int list[], int n_nodes, int new_list[], int* new_n_nodes) const
00215 {
00216
00217 int i,j,k;
00218 int simplified;
00219 int couting;
00220
00221 for(i=0;i<n_nodes;i++)
00222 new_list[i] = list[i];
00223
00224 i = 0;
00225 simplified = FALSE;
00226 while( i < n_nodes)
00227 {
00228 j = n_nodes-1;
00229 couting = FALSE;
00230
00231 while( (j > i+1) )
00232 {
00233 if (! MyPtpCollision((*tree).node[new_list[i]].landmark.dof,(*tree).node[new_list[j]].landmark.dof))
00234 {
00235 for(k=j; k< n_nodes; k++)
00236 new_list[i+(k-j)+1] = new_list[k];
00237 n_nodes = i + 1 + ( n_nodes - j );
00238 simplified = TRUE;
00239 break;
00240 }
00241 j--;
00242 }
00243 i++;
00244 }
00245 ( *new_n_nodes ) = n_nodes;
00246 return( simplified );
00247
00248
00249 }
00250
00251 int PL_Juan::GetNAncestors (const JMA_Roadmap_Tree* tree, const int landmark_id)
00252 {
00253 if( landmark_id >= tree->n_nodes )
00254 {
00255 return 0;
00256 }
00257 IJG_Assert( landmark_id < tree->n_nodes );
00258
00259 int id = landmark_id;
00260 int counter = 0;
00261
00262 while(id != 0)
00263 {
00264 IJG_Assert( id < tree->n_nodes );
00265 ++counter;
00266 id = tree->node[id].father_id;
00267 }
00268 return( counter );
00269 }
00270
00271 int PL_Juan::Search (JMA_Roadmap_Tree* tree) const
00272 {
00273
00274 Configuration local_minima;
00275
00276 int numberOfNodes = (*tree).n_nodes ;
00277 Configuration start = (*tree).node[ numberOfNodes - 1 ].landmark.dof ;
00278 MyLocalPlanner( start, local_minima );
00279 return(MyGoalFunc(local_minima));
00280
00281 }
00282
00283 int PL_Juan::MyLocalPlanner (const Configuration& start_conf, Configuration& local_minima) const
00284 {
00285
00286 int collision=FALSE;
00287 collision = MyPtpCollision(start_conf, GetGoalConfig() );
00288
00289 if(!collision)
00290 {
00291 local_minima = GetGoalConfig();
00292 }
00293 else
00294 {
00295 local_minima = start_conf ;
00296 }
00297 return(0);
00298
00299 }
00300
00301 int PL_Juan::MyGoalFunc (const Configuration& config) const
00302 {
00303
00304 if( config != GetGoalConfig() )
00305 {
00306 return false ;
00307 }
00308 return TRUE ;
00309
00310
00311 }
00312
00313 int PL_Juan::MyPtpCollision (const Configuration& start_conf, const Configuration& local_minima) const
00314 {
00315
00316 int steps = 100 ;
00317
00318
00319
00320
00321 Configuration s = start_conf ;
00322 Configuration g = local_minima ;
00323 Configuration offset = g - s ;
00324 Configuration current = start_conf ;
00325
00326 if( collisionDetector->IsInterferingLinear( s, g ) )
00327 {
00328 return true ;
00329 }
00330 else
00331 {
00332 return false ;
00333 }
00334
00335
00336 }
00337
00338 void PL_Juan::InitRoadmapTree (JMA_Roadmap_Tree* tree, const int n_dof, const int n_embryos, const JMA_Configuration init_conf) const
00339 {
00340 int i;
00341 double dist;
00342
00343 tree->N_dof = n_dof;
00344 tree->n_nodes = 1;
00345 tree->max_dist = 0.0;
00346 tree->last_max_dist = -1.0;
00347 tree->best_father_id = 0;
00348
00349 tree->node[0].N_embryos = n_embryos;
00350 tree->node[0].father_id = NIL;
00351
00352 tree->node[0].landmark.dof = init_conf.dof;
00353 tree->node[0].landmark.dist = init_conf.dist;
00354
00355 dist = 0.0;
00356 for( i = 0; i < tree->node[0].N_embryos; ++i )
00357 {
00358 GenerateNewEmbryo(tree,0,i);
00359
00360 if( tree->node[0].embryo[i].dist > dist )
00361 {
00362 tree->best_embryo_id = i;
00363 dist = tree->node[0].embryo[i].dist;
00364 }
00365 }
00366 tree->max_dist = dist;
00367 }
00368
00369 void PL_Juan::Explore (JMA_Roadmap_Tree* tree) const
00370 {
00371
00372 int i;
00373
00374
00375 (*tree).node[(*tree).n_nodes].landmark = (*tree).node[(*tree).best_father_id].embryo[(*tree).best_embryo_id];
00376 (*tree).node[(*tree).n_nodes].father_id = (*tree).best_father_id;
00377
00378
00379
00380
00381 (*tree).node[(*tree).n_nodes].N_embryos = NUMBER_OF_EMBRYOS;
00382
00383 for(i=0; i< NUMBER_OF_EMBRYOS; i++)
00384 GenerateNewEmbryo(tree,(*tree).n_nodes,i);
00385
00386
00387
00388 GenerateNewEmbryo(tree,(*tree).best_father_id,(*tree).best_embryo_id);
00389
00390 UpdateRoadmapTree(tree);
00391 (*tree).n_nodes++;
00392
00393
00394
00395 }
00396
00397 void PL_Juan::GenerateNewEmbryo (JMA_Roadmap_Tree* tree, const int id_landmark, const int id_embryo) const
00398 {
00399
00400
00401 ((*tree).node[id_landmark].embryo[id_embryo]).dof = GetStartConfig();
00402 int N_Dof = (*tree).N_dof ;
00403 MyRandomPath( id_landmark, id_embryo, N_Dof, (*tree).node[id_landmark].landmark, &((*tree).node[id_landmark].embryo[id_embryo]) );
00404
00405 ComputeEmbryoDistance(tree,&((*tree).node[id_landmark].embryo[id_embryo]));
00406
00407 }
00408
00409 void PL_Juan::GetIdsPath( const JMA_Roadmap_Tree* tree, const int landmark_id, int list_ids[], int* n_landmarks)
00410 {
00411 int counter = GetNAncestors( tree, landmark_id );
00412 *n_landmarks = counter + 1;
00413
00414 int id = landmark_id;
00415 while( counter > 0 )
00416 {
00417 list_ids[ counter ] = id;
00418 id = tree->node[ id].father_id;
00419 --counter;
00420 }
00421 if( landmark_id >= tree->n_nodes )
00422 {
00423 list_ids[ counter ] = tree->best_father_id;
00424 }
00425 else
00426 {
00427 list_ids[ counter ] = id;
00428 }
00429 }
00430
00431 void PL_Juan::UpdateRoadmapTree (JMA_Roadmap_Tree* tree) const
00432 {
00433
00434 int i, j;
00435 double distance;
00436
00437 (*tree).last_max_dist = (*tree).max_dist;
00438 (*tree).max_dist = 0.0;
00439
00440 for(i = 0 ; i < (*tree).n_nodes; i++)
00441 for(j = 0; j < (*tree).node[i].N_embryos; j++)
00442 {
00443
00444
00445 distance = MyDistanceFunc((*tree).node[i].embryo[j].dof,
00446 (*tree).node[(*tree).n_nodes].landmark.dof);
00447
00448 if (distance < (*tree).node[i].embryo[j].dist)
00449 (*tree).node[i].embryo[j].dist = distance;
00450
00451
00452
00453
00454 if ((*tree).max_dist < (*tree).node[i].embryo[j].dist)
00455 {
00456 (*tree).max_dist = (*tree).node[i].embryo[j].dist;
00457 (*tree).best_father_id = i;
00458 (*tree).best_embryo_id = j;
00459 }
00460 }
00461
00462 }
00463
00464 void PL_Juan::ComputeEmbryoDistance (JMA_Roadmap_Tree* tree, JMA_Configuration* embryo) const
00465 {
00466
00467 int i;
00468 double distance;
00469
00470 (*embryo).dist = BIG_NUMBER;
00471
00472 for(i=0; i < (*tree).n_nodes; i++)
00473 {
00474
00475 distance = MyDistanceFunc((*embryo).dof,(*tree).node[i].landmark.dof);
00476
00477 if (distance < (*embryo).dist)
00478 (*embryo).dist = distance;
00479 }
00480
00481 }
00482
00483 void PL_Juan::CopyTrajectoryToPath ()
00484 {
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503 }
00504
00505 bool PL_Juan::Save (const char *filename) const
00506 {
00507
00508 char filenameWithExtension[ 256 ] = "" ;
00509 strcpy( filenameWithExtension, filename ) ;
00510 strcat( filenameWithExtension, ".ACA" ) ;
00511
00512
00513 FILE* outfile = fopen( filenameWithExtension, "wb" ) ;
00514 assert( outfile != NULL ) ;
00515
00516
00517 fwrite( "PACA", 1, 4, outfile ) ;
00518
00519
00520 fwrite( &( tree->N_dof ), sizeof( tree->N_dof ), 1, outfile ) ;
00521 fwrite( &( tree->n_nodes ), sizeof( tree->n_nodes ), 1, outfile ) ;
00522 fwrite( &( tree->max_dist ), sizeof( tree->max_dist ), 1, outfile ) ;
00523 fwrite( &( tree->last_max_dist ), sizeof( tree->last_max_dist ), 1, outfile ) ;
00524 fwrite( &( tree->best_father_id ), sizeof( tree->best_father_id ), 1, outfile ) ;
00525 fwrite( &( tree->best_embryo_id ), sizeof( tree->best_embryo_id ), 1, outfile ) ;
00526
00527
00528 for( int i = 0; i < tree->n_nodes; i++ )
00529 {
00530 JMA_Node node = tree->node[ i ] ;
00531 fwrite( &node.N_embryos, sizeof( node.N_embryos ), 1, outfile ) ;
00532 fwrite( &node.father_id, sizeof( node.father_id ), 1, outfile ) ;
00533
00534
00535 int j = 0 ;
00536 for( j = 0; j < tree->N_dof; j++ )
00537 {
00538 fwrite( &node.landmark.dof[ j ], sizeof( node.landmark.dof[ j ] ), 1, outfile ) ;
00539 }
00540 fwrite( &node.landmark.dist, sizeof( node.landmark.dist ), 1, outfile ) ;
00541
00542
00543 int k = 0 ;
00544 for( k = 0; k < node.N_embryos; k++ )
00545 {
00546 JMA_Configuration embryo = node.embryo[ k ] ;
00547 for( j = 0; j < tree->N_dof; j++ )
00548 {
00549 fwrite( &embryo.dof[ j ], sizeof( embryo.dof[ j ] ), 1, outfile ) ;
00550 }
00551 fwrite( &embryo.dist, sizeof( embryo.dist ), 1, outfile ) ;
00552 }
00553 }
00554
00555
00556 fclose( outfile ) ;
00557
00558 return false ;
00559
00560 }
00561
00562 void PL_Juan::SetStartConfig (const Configuration& configuration)
00563 {
00564 Initialize();
00565 Configuration oldStart = GetStartConfig();
00566 PL_Boolean_Output::SetStartConfig( configuration ) ;
00567 if( configuration != oldStart )
00568 {
00569 init_conf.dof = configuration ;
00570 init_conf.dist = 0 ;
00571 InitRoadmapTree( tree, GetStartConfig().DOF(), MAX_EMBRYOS, init_conf );
00572 }
00573 }
00574
00575 bool PL_Juan::Load (const char *filename)
00576 {
00577
00578 Semaphore semaphore( this->guid );
00579 semaphore.Lock();
00580
00581 char filenameWithExtension[ 256 ] = "" ;
00582 strcpy( filenameWithExtension, filename ) ;
00583 strcat( filenameWithExtension, ".ACA" ) ;
00584
00585
00586 FILE* infile = fopen( filenameWithExtension, "rb" ) ;
00587 if( infile == NULL )
00588 {
00589 semaphore.Unlock();
00590 return false ;
00591 }
00592
00593
00594 char header[ 5 ] = "" ;
00595 fread( header, 4, 1, infile ) ;
00596 header[ 4 ] = NULL ;
00597 assert( strcmp( header, "PACA" ) == 0 ) ;
00598
00599
00600 size_t itemsRead ;
00601 itemsRead = fread( &tree->N_dof, sizeof( tree->N_dof ), 1, infile ) ;
00602 assert( itemsRead == 1 ) ;
00603 itemsRead = fread( &tree->n_nodes, sizeof( tree->n_nodes ), 1, infile ) ;
00604 assert( itemsRead == 1 ) ;
00605 itemsRead = fread( &tree->max_dist, sizeof( tree->max_dist ), 1, infile ) ;
00606 assert( itemsRead == 1 ) ;
00607 itemsRead = fread( &tree->last_max_dist, sizeof( tree->last_max_dist ), 1, infile ) ;
00608 assert( itemsRead == 1 ) ;
00609 itemsRead = fread( &tree->best_father_id, sizeof( tree->best_father_id ), 1, infile ) ;
00610 assert( itemsRead == 1 ) ;
00611 itemsRead = fread( &tree->best_embryo_id, sizeof( tree->best_embryo_id ), 1, infile ) ;
00612 assert( itemsRead == 1 ) ;
00613
00614
00615 for( int i = 0; i < tree->n_nodes; i++ )
00616 {
00617 JMA_Node& node = tree->node[ i ] ;
00618 itemsRead = fread( &node.N_embryos, sizeof( node.N_embryos ), 1, infile ) ;
00619 assert( itemsRead == 1 ) ;
00620 itemsRead = fread( &node.father_id, sizeof( node.father_id ), 1, infile ) ;
00621 assert( itemsRead == 1 ) ;
00622
00623
00624
00625 int j = 0 ;
00626 node.landmark.dof.SetLength( tree->N_dof ) ;
00627 for( j = 0; j < tree->N_dof; ++j )
00628 {
00629 double dof = 0 ;
00630 fread( &dof, sizeof( dof ), 1, infile ) ;
00631 node.landmark.dof[ j ] = dof ;
00632 }
00633 itemsRead = fread( &node.landmark.dist, sizeof( node.landmark.dist ), 1, infile ) ;
00634 assert( itemsRead == 1 ) ;
00635
00636 int k = 0 ;
00637 for( k = 0; k < node.N_embryos; k++ )
00638 {
00639 JMA_Configuration& embryo = node.embryo[ k ] ;
00640 node.embryo[ k ].dof.SetLength( tree->N_dof ) ;
00641 for( j = 0; j < tree->N_dof; j++ )
00642 {
00643 double dof = 0 ;
00644 size_t itemsRead = fread( &dof, sizeof( dof ), 1, infile ) ;
00645 assert( itemsRead == 1 ) ;
00646 embryo.dof[ j ] = dof ;
00647 }
00648 itemsRead = fread( &embryo.dist, sizeof( embryo.dist ), 1, infile ) ;
00649 assert( itemsRead == 1 ) ;
00650 }
00651 }
00652
00653
00654 fclose( infile ) ;
00655
00656 SetStartConfig( tree->node[ 0 ].landmark.dof );
00657 semaphore.Unlock();
00658 return true ;
00659
00660 }
00661
00662 bool PL_Juan::DrawExplicit () const
00663 {
00664
00665 Semaphore semaphore( this->guid );
00666 semaphore.Lock();
00667
00668 glClearColor( 0.0f, 0.0f, 0.2f, 1.0f );
00669 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
00670
00671
00672 BOOL lightingState = glIsEnabled( GL_LIGHTING );
00673 glDisable( GL_LIGHTING );
00674
00675
00676 BOOL zbufferState = glIsEnabled( GL_DEPTH_TEST );
00677 glDisable( GL_DEPTH_TEST );
00678
00679
00680 glShadeModel( GL_SMOOTH );
00681
00682
00683 int i = 0;
00684 glColor4d( 1.0, 1.0, 1.0, 1.0 );
00685 glPointSize( 3.0 );
00686
00687 int dof = GetGoalConfig().DOF();
00688
00689 glColor3f( 1.0f, 1.0f, 0.0f );
00690 glBegin( GL_POINTS );
00691 double g0 = 0;
00692 double g1 = 0;
00693 double g2 = 0;
00694 if( dof > 0 )
00695 {
00696 g0 = GetGoalConfig()[ 0 ];
00697 }
00698 if( dof > 1 )
00699 {
00700 g1 = GetGoalConfig()[ 1 ];
00701 }
00702 if( dof > 2 )
00703 {
00704 g2 = GetGoalConfig()[ 2 ];
00705 }
00706 glVertex3f( g0, g1, g2 );
00707 glEnd();
00708
00709 for( i = 0; i < tree->n_nodes; i++ )
00710 {
00711 JMA_Node node = tree->node[ i ];
00712 JMA_Configuration current = node.landmark;
00713 double v0 = 0;
00714 double v1 = 0;
00715 double v2 = 0;
00716
00717 v0 = current.dof[ 0 ];
00718 v1 = current.dof[ 1 ];
00719 if( dof > 2 )
00720 {
00721 v2 = current.dof[ 2 ];
00722 }
00723
00724 glBegin( GL_POINTS );
00725 glVertex3f( v0, v1, 0 );
00726 glEnd();
00727
00728 int parent = node.father_id;
00729 if( parent == -1 )
00730 {
00731 }
00732 else
00733 {
00734 JMA_Node parentNode = tree->node[ parent ];
00735 JMA_Configuration parentConfig = parentNode.landmark;
00736 double p0 = 0;
00737 double p1 = 0;
00738 double p2 = 0;
00739
00740 p0 = parentConfig.dof[ 0 ];
00741 p1 = parentConfig.dof[ 1 ];
00742 if( dof > 2 )
00743 {
00744 p2 = parentConfig.dof[ 2 ];
00745 }
00746
00747 glColor4d( 1.0, 1.0, 1.0, 1.0 );
00748 glBegin( GL_LINES );
00749 glVertex3f( v0, v1, v2 );
00750 glVertex3f( p0, p1, p2 );
00751 glEnd();
00752 }
00753
00754 int j = 0;
00755 for( j = 0; j < node.N_embryos; j++ )
00756 {
00757 JMA_Configuration embryoConfig = node.embryo[ j ];
00758 double e0 = 0;
00759 double e1 = 0;
00760 double e2 = 0;
00761
00762 e0 = embryoConfig.dof[ 0 ];
00763 e1 = embryoConfig.dof[ 1 ];
00764 if( dof > 2 )
00765 {
00766 e2 = embryoConfig.dof[ 2 ];
00767 }
00768
00769
00770 glBegin( GL_LINES );
00771 glColor4d( 1.0, 1.0, 0.0, 0.5 );
00772 glVertex3f( e0, e1, e2 );
00773 glColor4d( 1.0, 0.0, 0.0, 0.5 );
00774 glVertex3f( v0, v1, v2 );
00775 glEnd();
00776
00777 }
00778 }
00779 if( lightingState != 0x00 )
00780 {
00781 glEnable( GL_LIGHTING );
00782 }
00783
00784
00785 if( zbufferState )
00786 {
00787 glEnable( GL_DEPTH_TEST );
00788 }
00789 else
00790 {
00791 glDisable( GL_DEPTH_TEST );
00792 }
00793
00794 semaphore.Unlock();
00795 return true;
00796
00797 }
00798
00799
00800
00801
00802
00803
00804