//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CRopeKeyframe::NotifyPositionChanged( CBaseEntity *pEntity ) { ++m_nChangeCount; // Update our bbox? UpdateBBox( false ); CBaseEntity *ents[2] = { m_hStartPoint.Get(), m_hEndPoint.Get() }; if ( (m_RopeFlags & ROPE_RESIZE) && ents[0] && ents[0]->edict() && ents[1] && ents[1]->edict() ) { int len = (int)( ents[0]->GetAbsOrigin() - ents[1]->GetAbsOrigin() ).Length() + m_Slack; if ( len != m_RopeLength ) { m_RopeLength = len; } } // Figure out if our attachment points have gone away and make sure to update the client if they have. bool *pValid[2] = { &m_bStartPointValid, &m_bEndPointValid }; for ( int i=0; i < 2; i++ ) { bool bCurrentlyValid = ( ents[i] != NULL ); if ( *pValid[i] != bCurrentlyValid ) { *pValid[i] = bCurrentlyValid; } } }
void CRopeKeyframe::Init() { SetLocalAngles( vec3_angle ); RecalculateLength(); m_nSegments = clamp( m_nSegments, 2, ROPE_MAX_SEGMENTS ); UpdateBBox( true ); m_bStartPointValid = (m_hStartPoint.Get() != NULL); m_bEndPointValid = (m_hEndPoint.Get() != NULL); // Sanity-check the rope texture scale before it goes over the wire if ( m_TextureScale < 0.1f ) { Vector origin = GetAbsOrigin(); GetEndPointPos( 0, origin ); DevMsg( "move_rope has TextureScale less than 0.1 at (%2.2f, %2.2f, %2.2f)\n", origin.x, origin.y, origin.z ); m_TextureScale = 0.1f; } else if ( m_TextureScale > 10.0f ) { Vector origin = GetAbsOrigin(); GetEndPointPos( 0, origin ); DevMsg( "move_rope has TextureScale greater than 10 at (%2.2f, %2.2f, %2.2f)\n", origin.x, origin.y, origin.z ); m_TextureScale = 10.0f; } }
void PtCloudGeom::InitPts() { UpdateBBox(); UniquePts(); int n = m_Pts.size(); m_Selected.assign( n, false ); m_Hidden.assign( n, false ); }
void R3Mesh:: Update(void) { // Update everything UpdateBBox(); UpdateFacePlanes(); UpdateVertexNormals(); UpdateVertexCurvatures(); }
void CRopeKeyframe::Init() { SetLocalAngles( vec3_angle ); RecalculateLength(); m_nSegments = clamp( m_nSegments, 2, ROPE_MAX_SEGMENTS ); UpdateBBox( true ); m_bStartPointValid = (m_hStartPoint.Get() != NULL); m_bEndPointValid = (m_hEndPoint.Get() != NULL); }
void Worker::ProcessIterations(PPM* engine) { u_int64_t photonPerIteration = engine->photonsFirstIteration; uint iterationCount; resetRayBuffer(); UpdateBBox(); LookupSetHitPoints(hitPointsStaticInfo_iterationCopy, hitPoints_iterationCopy); uint iter = 0; double previousIterTime = WallClockTime(); fprintf(stdout, "iteration, photons_iter, photons_total, photons_sec, total_time, radius, device\n"); while (iter < config->max_iters) { ++iter; double start = WallClockTime(); iterationCount = engine->IncIteration(); if (engine->GetIterationNumber() > MAX_ITERATIONS) { break; } photonPerIteration = engine->photonsFirstIteration; #if defined USE_SPPMPA || defined USE_SPPM BuildHitPoints(iterationCount); UpdateBBox(); #endif #if defined USE_SPPM || defined USE_PPM if (iterationCount == 1) InitRadius(iterationCount); #else InitRadius(iterationCount); #endif updateDeviceHitPoints(); ReHash(currentPhotonRadius2);//argument ignored in non-PA updateDeviceLookupAcc(); photonPerIteration = AdvancePhotonPath(photonPerIteration); getDeviceHitpoints(); #if defined USE_PPM AccumulateFluxPPM(iterationCount, photonPerIteration); #endif #if defined USE_SPPM AccumulateFluxSPPM(iterationCount, photonPerIteration); #endif #if defined USE_SPPMPA AccumulateFluxSPPMPA(iterationCount, photonPerIteration); #endif #if defined USE_PPMPA AccumulateFluxPPMPA(iterationCount, photonPerIteration); #endif UpdateSampleFrameBuffer(photonPerIteration); /** * iteration lock required in PhotonTracedTotal */ engine->incPhotonTracedTotal(photonPerIteration); //PushHitPoints(); profiler->additeratingTime(WallClockTime() - start); profiler->addIteration(1); if (profiler->iterationCount % 100 == 0) profiler->printStats(deviceID); // if (iterationCount % 50 == 0) // engine->SaveImpl(to_string<uint> (iterationCount, std::dec) + engine->fileName); #if defined USE_SPPM || defined USE_PPM const float radius = hitPoints_iterationCopy[0].accumPhotonRadius2; #else const float radius = currentPhotonRadius2; #endif const double time = WallClockTime(); const double totalTime = time - engine->startTime; const double iterTime = time - previousIterTime; // const float itsec = engine->GetIterationNumber() / totalTime; const uint photonTotal = engine->getPhotonTracedTotal(); const float photonSec = photonTotal / (totalTime * 1000.f); fprintf(stdout, "%d, %lu, %u, %f, %f, %f, %f, %d\n", iterationCount, photonPerIteration, photonTotal, photonSec, iterTime, totalTime, radius, getDeviceID()); previousIterTime = time; } }
void Worker::ProcessIterations(PPM* engine) { u_int64_t photonPerIteration = engine->photonsFirstIteration; uint iterationCount; resetRayBuffer(); UpdateBBox(); while (!boost::this_thread::interruption_requested()) { double start = WallClockTime(); if (engine->GetIterationNumber() > config->max_iters) { break; } iterationCount = engine->IncIteration(); photonPerIteration = engine->photonsFirstIteration; // #if defined USE_SPPMPA || defined USE_SPPM BuildHitPoints(iterationCount); UpdateBBox(); // #endif // #if defined USE_SPPM || defined USE_PPM // if (iterationCount == 1) // InitRadius(iterationCount); // #else InitRadius(iterationCount); // #endif updateDeviceHitPoints(); #ifndef REBUILD_HASH if (iterationCount == 1) #endif ReHash(currentPhotonRadius2);//argument ignored in non-PA #ifndef REBUILD_HASH if (iterationCount == 1) #endif updateDeviceLookupAcc(); photonPerIteration = AdvancePhotonPath(photonPerIteration); // #if defined USE_PPM // getDeviceHitpoints(); // AccumulateFluxPPM(iterationCount, photonPerIteration); // #endif // #if defined USE_SPPM // AccumulateFluxSPPM(iterationCount, photonPerIteration); // #endif // #if defined USE_SPPMPA AccumulateFluxSPPMPA(iterationCount, photonPerIteration); // #endif // #if defined USE_PPMPA // AccumulateFluxPPMPA(iterationCount, photonPerIteration); // getDeviceHitpoints(); // #endif UpdateSampleFrameBuffer(photonPerIteration); /** * iteration lock required in PhotonTracedTotal */ engine->incPhotonTracedTotal(photonPerIteration); profiler->additeratingTime(WallClockTime() - start); profiler->addIteration(1); //if (profiler->iterationCount % 20 == 0) // profiler->printStats(deviceID); //if (iterationCount % 100 == 0) // engine->SaveImpl(to_string<uint> (iterationCount, std::dec) + engine->fileName); printf("iteration %d finished\n", iterationCount); } //profiler->printStats(deviceID); }