static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { // step 1, select a ticket choosing[id] = 1; // entry protocol Fence(); // force store before more loads TYPE max = 0; // O(N) search for largest ticket for ( int j = 0; j < N; j += 1 ) { TYPE v = ticket[j]; // could change so must copy if ( max < v ) max = v; } // for #if 1 max += 1; // advance ticket ticket[id] = max; choosing[id] = 0; Fence(); // force store before more loads // step 2, wait for ticket to be selected for ( int j = 0; j < N; j += 1 ) { // check other tickets while ( choosing[j] == 1 ) Pause(); // busy wait if thread selecting ticket while ( ticket[j] != 0 && // busy wait if choosing or ( ticket[j] < max || // greater ticket value or lower priority ( ticket[j] == max && j < id ) ) ) Pause(); } // for #else ticket[id] = max + 1; // advance ticket choosing[id] = 0; Fence(); // force store before more loads // step 2, wait for ticket to be selected for ( int j = 0; j < N; j += 1 ) { // check other tickets while ( choosing[j] == 1 ) Pause(); // busy wait if thread selecting ticket while ( ticket[j] != 0 && // busy wait if choosing or ( ticket[j] < ticket[id] || // greater ticket value or lower priority ( ticket[j] == ticket[id] && j < id ) ) ) Pause(); } // for #endif CriticalSection( id ); ticket[id] = 0; // exit protocol #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST int j; for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { flag[id] = 1; Fence(); // force store before more loads for ( j = 0; j < N; j += 1 ) // wait until doors open await( flag[j] < 3 ); flag[id] = 3; // close door 1 Fence(); // force store before more loads for ( j = 0; j < N; j += 1 ) // check for if ( flag[j] == 1 ) { // others in group ? flag[id] = 2; // enter waiting room Fence(); // force store before more loads L: for ( int k = 0; k < N; k += 1 ) // wait for if ( flag[k] == 4 ) goto fini; // door 2 to open goto L; fini: ; } // if flag[id] = 4; // open door 2 Fence(); // force store before more loads // for ( j = 0; j < N; j += 1 ) // wait for all threads in waiting room // await( flag[j] < 2 || flag[j] > 3 ); // to pass through door 2 for ( j = 0; j < id; j += 1 ) // service threads in priority order await( flag[j] < 2 ); CriticalSection( id ); for ( j = id + 1; j < N; j += 1 ) // wait for all threads in waiting room await( flag[j] < 2 || flag[j] > 3 ); // to pass through door 2 flag[id] = 0; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST TYPE copy[N]; int j; for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { c[id] = 1; // stage 1, establish FCFS Fence(); // force store before more loads for ( j = 0; j < N; j += 1 ) // copy turn values copy[j] = turn[j]; // turn[id] = cycleUp( turn[id], 4 ); // advance my turn turn[id] = cycleUp( turn[id], 3 ); // advance my turn v[id] = 1; c[id] = 0; Fence(); // force store before more loads for ( j = 0; j < N; j += 1 ) while ( c[j] != 0 || (v[j] != 0 && copy[j] == turn[j]) ) Pause(); L: intents[id] = 1; // B-L Fence(); // force store before more loads for ( j = 0; j < id; j += 1 ) // stage 2, high priority search if ( intents[j] != 0 ) { intents[id] = 0; Fence(); // force store before more loads while ( intents[j] != 0 ) Pause(); goto L; } // if for ( j = id + 1; j < N; j += 1 ) // stage 3, low priority search while ( intents[j] != 0 ) Pause(); CriticalSection( id ); v[id] = intents[id] = 0; // exit protocol #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
////////////////////////////////////////////////////////////////////////// // destroy //virtual void ScnDebugRenderComponent::destroy() { for( BcU32 Idx = 0; Idx < 2; ++Idx ) { TRenderResource& RenderResource = RenderResources_[ Idx ]; // Allocate render side vertex buffer. RsCore::pImpl()->destroyResource( RenderResource.pVertexBuffer_ ); // Allocate render side primitive. RsCore::pImpl()->destroyResource( RenderResource.pPrimitive_ ); } // Wait for renderer. SysFence Fence( RsCore::WORKER_MASK ); // Delete working data. for( BcU32 Idx = 0; Idx < 2; ++Idx ) { TRenderResource& RenderResource = RenderResources_[ Idx ]; // Delete vertices. delete [] RenderResource.pVertices_; } }
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST TYPE temp; for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { if ( id == 0 ) { temp = Q[1]; Q[0] = temp == Z ? T : (temp == T ? T : F); Fence(); temp = Q[1]; Q[0] = temp == Z ? Q[0] : (temp == T ? T : F); Fence(); await( Q[1] != Q[0] ); } else { temp = Q[0]; Q[1] = temp == Z ? T : (temp == T ? F : T); Fence(); temp = Q[0]; Q[1] = temp == Z ? Q[1] : (temp == T ? F : T); Fence(); await( Q[0] == Z || Q[0] == Q[1] ); } // for CriticalSection( id ); Q[id] = Z; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
////////////////////////////////////////////////////////////////////////// // destroy //virtual void ScnViewComponent::destroy() { SysFence Fence( RsCore::WORKER_MASK ); RsCore::pImpl()->destroyResource( ViewUniformBuffer_ ); ScnComponent::destroy(); }
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { L0: control[id] = WantIn; // entry protocol Fence(); // force store before more loads // step 1, wait for threads with higher priority L1: for ( int j = HIGH; j != id; j = cycleUp( j, N ) ) if ( control[j] != DontWantIn ) { Pause(); goto L1; } // restart search control[id] = EnterCS; Fence(); // force store before more loads // step 2, check for any other thread finished step 1 for ( int j = 0; j < N; j += 1 ) if ( j != id && control[j] == EnterCS ) goto L0; if ( control[HIGH] != DontWantIn && HIGH != id ) goto L0; HIGH = id; // its now ok to enter CriticalSection( id ); // look for any thread that wants in other than this thread // for ( int j = cycleUp( id + 1, N );; j = cycleUp( j, N ) ) // exit protocol for ( int j = cycleUp( HIGH + 1, N );; j = cycleUp( j, N ) ) // exit protocol if ( control[j] != DontWantIn ) { HIGH = j; break; } control[id] = DontWantIn; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { L: intents[id] = WantIn; Fence(); // force store before more loads for ( int j = 0; j < id; j += 1 ) { // check if thread with higher id wants in // for ( int j = id - 1; j >= 0; j -= 1 ) { if ( intents[j] == WantIn ) { intents[id] = DontWantIn; Fence(); // force store before more loads while ( intents[j] == WantIn ) Pause(); goto L; } // if } // for for ( int j = id + 1; j < N; j += 1 ) while ( intents[j] == WantIn ) Pause(); CriticalSection( id ); // critical section intents[id] = DontWantIn; // exit protocol #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
void SharedSurface_ANGLEShareHandle::Fence_ContentThread_Impl() { if (mFence) { MOZ_ASSERT(mGL->IsExtensionSupported(GLContext::NV_fence)); mGL->fSetFence(mFence, LOCAL_GL_ALL_COMPLETED_NV); mGL->fFlush(); return; } Fence(); }
static void *Worker( void *arg ) { TYPE id = (size_t)arg; #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST uint64_t entry; for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { L0: control[id] = WantIn; // entry protocol Fence(); // force store before more loads L1: for ( int j = turn; j != id; j = cycleDown( j, N ) ) if ( control[j] != DontWantIn ) { Pause(); goto L1; } // restart search control[id] = EnterCS; Fence(); // force store before more loads for ( int j = N - 1; j >= 0; j -= 1 ) if ( j != id && control[j] == EnterCS ) goto L0; CriticalSection( id ); // cycle through threads if ( control[turn] == DontWantIn || turn == id ) // exit protocol turn = cycleDown( turn, N ); control[id] = DontWantIn; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
void SharedSurface_ANGLEShareHandle::ProducerReleaseImpl() { if (mKeyedMutex) { // XXX: ReleaseSync() has an implicit flush of the D3D commands // whether we need Flush() or not depends on the ANGLE semantics. // For now, we'll just do it mGL->fFlush(); mKeyedMutex->ReleaseSync(0); return; } Fence(); }
static inline bool trylock( TYPE id ) { // based on Lamport-Fast algorithm b[id] = true; x = id; Fence(); // force store before more loads if ( FASTPATH( y != N ) ) { b[id] = false; return false; } // if y = id; Fence(); // force store before more loads if ( FASTPATH( x != id ) ) { b[id] = false; Fence(); // OPTIONAL, force store before more loads for ( int k = 0; k < N; k += 1 ) await( ! b[k] ); if ( FASTPATH( y != id ) ) return false; } // if bool leader; if ( ! fast ) { fast = true; leader = true; } else leader = false; y = N; b[id] = false; return leader; } // WCas
////////////////////////////////////////////////////////////////////////// // registerThreadId //virtual void SysProfilerChromeTracing::endProfiling() { if( --BeginCount_ == 0 ) { // Final flush out. SysFence Flush( BcErrorCode ); // Stop profiling. --ProfilingActive_; // Wait for all workers to complete. SysFence Fence( BcErrorCode ); SysFence Fence1( BcErrorCode ); SysFence Fence2( BcErrorCode ); SysFence Fence3( BcErrorCode ); std::stringstream Stream; Stream << "{\"traceEvents\" : ["; // Clear all per thread sections back down to the root nodes. for( BcU32 Idx = 0; Idx < ProfilerSectionIndex_; ++Idx ) { TProfilerEvent* Event = &ProfilerSectionPool_[ Idx ]; Stream << "{" << "\"cat\": \"" << "Psybrus" << "\"," << "\"pid\": 0," << "\"tid\": " << Event->ThreadId_ << "," << "\"ts\": " << Event->StartTime_ * 1000000.0 << "," << "\"ph\": \"" << Event->Type_ << "\"," << "\"name\": \"" << Event->Tag_ << "\"," << "\"args\": {}" << "},\n"; } Stream << "{}]}"; std::ofstream OutFileStream; OutFileStream.open( "test.json", std::ofstream::out | std::ofstream::trunc ); OutFileStream << Stream.str(); OutFileStream.close(); } else { ++BeginCount_; } }
static inline bool trylock( TYPE id ) { // based on Burns-Lamport algorithm b[id] = true; Fence(); // force store before more loads for ( typeof(id) thr = 0; thr < id; thr += 1 ) { if ( FASTPATH( b[thr] ) ) { b[id] = false; return false ; } // if } // for for ( typeof(id) thr = id + 1; thr < N; thr += 1 ) { await( ! b[thr] ); } // for bool leader; if ( ! fast ) { fast = true; leader = true; } else leader = false; b[id] = false; return leader; } // WCas
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; int other = inv( id ); // int is better than TYPE #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { intents[id] = WantIn; // entry protocol last = id; // RACE Fence(); // force store before more loads if ( FASTPATH( intents[other] != DontWantIn ) ) // local spin while ( last == id ) Pause(); // busy wait CriticalSection( id ); intents[id] = DontWantIn; // exit protocol last = id; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment other = inv( id ); cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; other = inv( id ); #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
////////////////////////////////////////////////////////////////////////// // destroy //virtual void ScnParticleSystemComponent::destroy() { for( BcU32 Idx = 0; Idx < 2; ++Idx ) { TVertexBuffer& VertexBuffer = VertexBuffers_[ Idx ]; RsCore::pImpl()->destroyResource( VertexBuffer.pVertexBuffer_ ); RsCore::pImpl()->destroyResource( VertexBuffer.pPrimitive_ ); } // Wait for renderer. SysFence Fence( RsCore::WORKER_MASK ); // Delete working data. for( BcU32 Idx = 0; Idx < 2; ++Idx ) { TVertexBuffer& VertexBuffer = VertexBuffers_[ Idx ]; delete [] VertexBuffer.pVertexArray_; } delete [] pParticleBuffer_; }
////////////////////////////////////////////////////////////////////////// // registerThreadId //virtual void SysProfilerChromeTracing::beginProfiling() { if( BeginCount_++ == 0 ) { // Final flush out. SysFence Flush( BcErrorCode ); // Reset allocation ProfilerSectionIndex_ = 0; // Mark timer! Timer_.mark(); // And we're off! ++ProfilingActive_; // SysFence Fence( BcErrorCode ); } else { --BeginCount_; } }
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; int other = inv( id ); // int is better than TYPE #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) cc[id] = i % 2; // flicker #endif // FLICKER cc[id] = WantIn; // declare intent Fence(); // force store before more loads while ( cc[other] == WantIn ) { if ( FASTPATH( last == id ) ) { #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) cc[id] = i % 2; // flicker #endif // FLICKER cc[id] = DontWantIn; while( cc[other] == WantIn && last == id ) Pause(); // low priority busy wait #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) cc[id] = i % 2; // flicker #endif // FLICKER cc[id] = WantIn; // declare intent Fence(); // force store before more loads } // if } // while CriticalSection( id ); if ( last != id ) { #ifdef FLICKER for ( int i = id; i < 100; i += 1 ) last = i % 2; // flicker #endif // FLICKER last = id; } // if #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) cc[id] = i % 2; // flicker #endif // FLICKER cc[id] = DontWantIn; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment other = inv( id ); cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; other = inv( id ); #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
static void *Worker( void *arg ) { TYPE id = (size_t)arg; uint64_t entry; int other = inv( id ); // int is better than TYPE #ifdef FAST unsigned int cnt = 0, oid = id; #endif // FAST for ( int r = 0; r < RUNS; r += 1 ) { entry = 0; while ( stop == 0 ) { for ( ;; ) { #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) intents[id] = i % 2; // flicker #endif // FLICKER intents[id] = WantIn; // declare intent // Necessary to prevent the read of intents[other] from floating above the assignment // intents[id] = WantIn, when the hardware determines the two subscripts are different. Fence(); // force store before more loads if ( FASTPATH( intents[other] == DontWantIn ) ) break; if ( last == id ) { #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) intents[id] = i % 2; // flicker #endif // FLICKER intents[id] = DontWantIn; // Optional fence to prevent LD of "last" from being lifted above store of // intends[id]=DontWantIn. Because a thread only writes its own id into "last", // and because of eventual consistency (writes eventually become visible), // the fence is conservative. //Fence(); // force store before more loads await( last != id ); // low priority busy wait } // if } // for CriticalSection( id ); #ifdef FLICKER for ( int i = id; i < 100; i += 1 ) last = i % 2; // flicker #endif // FLICKER last = id; // exit protocol #ifdef FLICKER for ( int i = 0; i < 100; i += 1 ) intents[id] = i % 2; // flicker #endif // FLICKER intents[id] = DontWantIn; #ifdef FAST id = startpoint( cnt ); // different starting point each experiment other = inv( id ); cnt = cycleUp( cnt, NoStartPoints ); #endif // FAST entry += 1; } // while #ifdef FAST id = oid; other = inv( id ); #endif // FAST entries[r][id] = entry; __sync_fetch_and_add( &Arrived, 1 ); while ( stop != 0 ) Pause(); __sync_fetch_and_add( &Arrived, -1 ); } // for return NULL; } // Worker
void Display(void) { /*glPushMatrix(); glPopMatrix();*/ double c = L/(2*R1); double alfa= 90 - acos(c)*180/PI; double static Time=0; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); Fence(500,0,-r2-r1,-r2-r1,2); // пол glColor3d(1, 0.5, 0); // glPushMatrix(); glPushMatrix(); glTranslated(-20,0,0); glRotated(Time+60,0,1,0); glTranslated(R1,0,0); //glTranslated(-20,0,0); glRotated(90,0,1,0); glPushMatrix(); glRotated(-Time*(R1/r2),0,0,1); Koleso(r1,r2); // переднее колесо glPopMatrix(); glPushMatrix(); glTranslated(0,0,1.2); glColor3d(1, 0.3, 0); // Cylinder(0.3,0,r1+r2+0.5); // планка руля 1 glTranslated(0,0,-2.4); Cylinder(0.3,0,r1+r2+0.5); // планка руля 2 glPopMatrix(); Cylinder(0.5,r1+r2+0.5,r1+r2+0.5+L2); // передняя вертикальная планка glPushMatrix(); glRotated(-90,1,0,0); glColor3d(0, 1, 0.5); // Cylinder(0.2,-2,2); // передняя ось glPushMatrix(); glTranslated(0,2,0); glPushMatrix(); glRotated(180+Time*(R1/r2),0,1,0); // педаль 1 glTranslated(r2,0,0); Cylinder(0.4,0,2); glPopMatrix(); glRotated(90,0,0,1); glRotated(Time*(R1/r2),1,0,0); Cylinder(0.2,0,r2); // ось педали 1 glPopMatrix(); glPushMatrix(); glTranslated(0,-4,0); glRotated(180+Time*(R1/r2),0,1,0); // педаль 2 glTranslated(-r2,0,0); Cylinder(0.4,0,2); glPopMatrix(); glPushMatrix(); glTranslated(0,-2,0); glRotated(-90,0,0,1); glRotated(-Time*(R1/r2),1,0,0); Cylinder(0.2,0,r2); // ось педали 2 glPopMatrix(); glTranslated(0,0,r1+r2+0.5); glColor3d(0, 1, 0.5); // Cylinder(0.3,-1.5,1.5); // передняя гооизонтальная планка glTranslated(0,0,L2); Cylinder(0.3,-L3,L3); // руль glPopMatrix(); glRotated(90,0,0,1); glTranslated(r2+r1+0.5+L2/2,0,0); glRotated(-alfa,1,0,0); Cylinder(0.5,0,L); // горизонтальная планка glRotated(90,1,0,0); glTranslated(-2*r2+r4-2*r1+r3-0.5-L2/2,0,-L); Cylinder(0.5,-L1+r3/2,L1-r3/2); // задняя ось Cylinder(0.2,-L1-r3/2,L1+r3/2); // задняя ось glRotated(90,1,0,0); glPushMatrix(); glRotated(-90,0,0,1); glColor3d(1, 0.3, 0); // Cylinder(0.5,0,2*r1+2*r2-r3-r4+2+L2/2); // задняя вертикальная планка Fence(1,1,2*r1+2*r2-r3-r4+2+L2/2,2*r1+2*r2-r3-r4+2.5+L2/2,1); // седлушка Fence(1,0,2*r1+2*r2-r3-r4+2.5+L2/2,2*r1+2*r2-r3-r4+2.5+L2/2,1); glPopMatrix(); glTranslated(0,0,L1); glPushMatrix(); glRotated(Time*((R1-L1)/r4),0,0,1); glColor3d(1, 0.5, 0); // Koleso(r3,r4); // заднее колесо 1 glPopMatrix(); glTranslated(0,0,-(2*L1)); glPushMatrix(); glRotated(Time*((R1+L1)/r4),0,0,1); Koleso(r3,r4); // заднее колесо 2 glPopMatrix(); glPopMatrix(); glPopMatrix(); glFinish(); glutSwapBuffers(); Time=Time+V; }
Fence(const Size<double> &size, const double height) { *this = Fence(Vec3(0), size, height); }