void FractalGenerator::calculateRegion( const QRect& region ) { GeneratorCore::Input input; calculateInput( &input, region ); GeneratorCore::Output output; calculateOutput( &output, region ); int maxIterations = maximumIterations(); double threshold = m_settings.detailThreshold(); m_mutex.unlock(); #if defined( HAVE_SSE2 ) if ( m_functorSSE2 ) { GeneratorCore::generatePreviewSSE2( input, output, m_functorSSE2, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetailsSSE2( input, output, m_functorSSE2, maxIterations, threshold ); } else #endif if ( m_functor ) { GeneratorCore::generatePreview( input, output, m_functor, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetails( input, output, m_functor, maxIterations, threshold ); } m_mutex.lock(); appendValidRegion( region ); if ( !m_preview && m_update == NoUpdate ) postUpdate( PartialUpdate ); }
void AvatarManager::postUpdate(float deltaTime, const render::ScenePointer& scene) { auto hashCopy = getHashCopy(); AvatarHash::iterator avatarIterator = hashCopy.begin(); for (avatarIterator = hashCopy.begin(); avatarIterator != hashCopy.end(); avatarIterator++) { auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value()); avatar->postUpdate(deltaTime, scene); } }
void FractalGenerator::handleState() { if ( m_activeJobs > 0 || !m_enabled || m_pendingResolution.isEmpty() ) return; if ( !m_regions.isEmpty() && !m_pending ) { addJobs(); return; } if ( m_preview && m_buffer && m_regions.isEmpty() && m_resolution == m_pendingResolution ) { delete[] m_previewBuffer; m_previewBuffer = m_buffer; m_buffer = NULL; postUpdate( FullUpdate ); } if ( m_pending ) { if ( m_buffer && m_bufferSize != m_pendingBufferSize ) { delete[] m_buffer; m_buffer = NULL; } m_type = m_pendingType; m_position = m_pendingPosition; m_settings = m_pendingSettings; m_resolution = m_pendingResolution; m_bufferSize = m_pendingBufferSize; m_pending = false; if ( !m_buffer ) m_buffer = new double[ m_bufferSize.width() * m_bufferSize.height() ]; createFunctor(); if ( !m_preview ) postUpdate( InitialUpdate ); m_validRegions.clear(); splitRegions(); addJobs(); } }
void System::update() { preUpdate(); auto it = entities.begin(); while(it != entities.end()){ updateEntity(**it); it++; } postUpdate(); }
void btGImpactConvexDecompositionShape::buildConvexDecomposition(bool transformSubShapes) { m_decomposition = new GIM_ConvexDecomposition(this,transformSubShapes); int part_count = m_trimeshInterfaces.size(); for (int i = 0;i<part_count ;i++ ) { m_decomposition->processDecomposition(i); } postUpdate(); }
MojErr MojDbSandwichDatabase::put(MojDbSandwichItem& key, MojDbSandwichItem& val, MojDbStorageTxn* txn, bool updateIdQuota) { LOG_TRACE("Entering function %s", __FUNCTION__); MojAssert(m_db.Valid() ); MojAssert( !txn || dynamic_cast<MojDbSandwichEnvTxn *> (txn) ); MojErr err; if (txn) { MojInt64 quotaOffset = val.size(); if (updateIdQuota) quotaOffset += key.size(); err = txn->offsetQuota(quotaOffset); MojErrCheck(err); } MojDbSandwichEnvTxn * leveldb_txn = static_cast<MojDbSandwichEnvTxn *> (txn); leveldb::Status s; if(leveldb_txn) { s = leveldb_txn->ref(impl()).Put(*key.impl(), *val.impl()); } else s = m_db.Put(*key.impl(), *val.impl()); #if defined(MOJ_DEBUG) char str_buf[1024]; size_t size1 = key.size(); size_t size2 = val.size(); MojErr err2 = MojByteArrayToHex(key.data(), size1, str_buf); MojErrCheck(err2); if (size1 > 16) // if the object-id is in key strncat(str_buf, (char *)(key.data()) + (size1 - 17), 16); LOG_DEBUG("[db_ldb] ldb put: %s; keylen: %zu, key: %s ; vallen = %zu; err = %s\n", this->m_name.data(), size1, str_buf, size2, s.ToString().c_str()); #endif /* if(leveldb_txn) ;//MojLdbErrCheck(batch->status(), _T("db->put")); else */ MojLdbErrCheck(s, _T("db->put")); postUpdate(txn, key.size() + val.size()); return MojErrNone; }
bool QPSolver::solve(const rbd::MultiBody& mb, rbd::MultiBodyConfig& mbc) { preUpdate(mb, mbc); bool success = solver_->solve(); if(!success) { solver_->errorMsg(mb, tasks_, eqConstr_, inEqConstr_, genInEqConstr_, boundConstr_, std::cerr) << std::endl; } postUpdate(mb, mbc, success); return success; }
void Game::mainLoop() { while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) handleEvent(event); if (GameState == mainMenu) menuUpdate(); else if (GameState == inGame) gameUpdate(); else if (GameState == paused) pauseUpdate(); else if (GameState == postGame) postUpdate(); render(); } }
//----------------------------------------------------------------------------- AFAFAFAFAAF void multifxVSTEditor::setParameter (long index, float value) { //pour ttes les fonctions générants des appels a la bibli mfc AFX_MANAGE_STATE(AfxGetStaticModuleState()); // called from the Aeffect to update the control's value // test if the plug is opened if (!frame) return; if (index == kChainTag) { UpdateType = 1; }else if((index >= kNumParams) && (index < kNumParams + APP->parameter->GetCount())) { UpdateType = 2; } // call this to be sure that the graphic will be updated postUpdate (); }
MojErr MojDbLevelDatabase::del(MojDbLevelItem& key, bool& foundOut, MojDbStorageTxn* txn) { LOG_TRACE("Entering function %s", __FUNCTION__); MojAssert(m_db); MojAssert( !txn || dynamic_cast<MojDbLevelAbstractTxn *> (txn) ); foundOut = false; MojErr err = txn->offsetQuota(-(MojInt64) key.size()); MojErrCheck(err); MojDbLevelAbstractTxn * leveldb_txn = static_cast<MojDbLevelAbstractTxn *> (txn); leveldb::Status st; if(leveldb_txn) { leveldb_txn->tableTxn(impl()).Delete(*key.impl()); } else st = m_db->Delete(MojDbLevelEngine::getWriteOptions(), *key.impl()); #if defined(MOJ_DEBUG) char str_buf[1024]; // big enough for any key size_t size = key.size(); MojErr err2 = MojByteArrayToHex(key.data(), size, str_buf); MojErrCheck(err2); if (size > 16) // if the object-id is in key strncat(str_buf, (char *)(key.data()) + (size - 17), 16); LOG_DEBUG("[db_ldb] ldbdel: %s; keylen: %zu, key= %s; err = %d \n", this->m_name.data(), size, str_buf, !st.ok()); #endif if (st.IsNotFound() == false) { MojLdbErrCheck(st, _T("db->del")); foundOut = true; } postUpdate(txn, key.size()); return MojErrNone; }
void CameraThread::mainLoop() { UTimer totalTime; UDEBUG(""); CameraInfo info; SensorData data = _camera->takeImage(&info); if(!data.imageRaw().empty() || (dynamic_cast<DBReader*>(_camera) != 0 && data.id()>0)) // intermediate nodes could not have image set { postUpdate(&data, &info); info.cameraName = _camera->getSerial(); info.timeTotal = totalTime.ticks(); this->post(new CameraEvent(data, info)); } else if(!this->isKilled()) { UWARN("no more images..."); this->kill(); this->post(new CameraEvent()); } }
void Scene::updateBase(const float deltaTime) { if (isActive()) { const float dt = deltaTime * m_deltaScale; // Have to check every step since engine state // might be changed at any time if (Engine::getState() == Engine::State::Running) preUpdate(dt); if (Engine::getState() == Engine::State::Running) Object::update(dt); if (detail::CullerComponent::cullingEnabled() && Engine::getState() < Engine::State::Frozen) m_cullingWorld.update(1.f / 60.f); if (Engine::getState() == Engine::State::Running) postUpdate(dt); } }
void NormalDelete(pBtree p,int key) { int pos; pos=Find(p->Key,1,p->Sum,key); if(IsLeaf(p)) { if(Equal(p,pos,key)) { Delete(p,pos); } return; } else { if(Equal(p,pos,key)) { if(NodeAvailable(p->Child[pos-1])) { key=preUpdate(p,pos); NormalDelete(p->Child[pos-1],key); } else if(NodeAvailable(p->Child[pos])) { key=postUpdate(p,pos); NormalDelete(p->Child[pos],key); } else { Union(p,pos); NormalDelete(p->Child[pos-1],key); } } else { if(NodeAvailable(p->Child[pos-1])) { NormalDelete(p->Child[pos-1],key); } else { if(Exist(pos-2,p)&&NodeAvailable(p->Child[pos-2])) { rightFix(pos-2,p,pos-1); NormalDelete(p->Child[pos-1],key); } else if(Exist(pos,p)&&NodeAvailable(p->Child[pos])) { leftFix(pos-1,p,pos); NormalDelete(p->Child[pos-1],key); } else if(Exist(pos-2,p)) { Union(p,pos-1); NormalDelete(p->Child[pos-2],key); } else { Union(p,pos); NormalDelete(p->Child[pos-1],key); } } } } }
void System::update(double dt) { preUpdate(); do_update(dt); postUpdate(); }
//----------------------------------------------------------------------------- // called from SkidderEdit void SkidderEditor::setParameter(long index, float value) { if (!frame) return; long rateTag = onOffTest(effect->getParameter(kTempoSync)) ? kTempoRate : kRate; switch (index) { case kRate: case kTempoRate: // store these into the static global variables so that the string convert function can see them theCycleRate = calculateTheCycleRate(); strcpy( tempoRateString, ((Skidder*)effect)->tempoRateTable->getDisplay(effect->getParameter(kTempoRate)) ); theTempoSync = ((Skidder*)effect)->fTempoSync; if (rateTag == index) { if (rateFader) rateFader->setValue(value); if (rateDisplay) rateDisplay->setValue(value); // update the rate random range display if (rateRandRangeDisplay) rateRandRangeDisplay->setDirty(); } break; case kTempoSync: strcpy( tempoRateString, ((Skidder*)effect)->tempoRateTable->getDisplay(effect->getParameter(kTempoRate)) ); theTempoSync = ((Skidder*)effect)->fTempoSync; theCycleRate = calculateTheCycleRate(); if (tempoSyncButton) tempoSyncButton->setValue(value); // update the rate displays if the sync mode is changed if (rateRandRangeDisplay) rateRandRangeDisplay->setDirty(); // see if we need to swap the parameter assignment for the rate controls if (rateFader) { if (rateTag != rateFader->getTag()) { rateFader->setTag(rateTag); rateFader->setValue(effect->getParameter(rateTag)); } } if (rateDisplay) { if (rateTag != rateDisplay->getTag()) { rateDisplay->setTag(rateTag); rateDisplay->setValue(effect->getParameter(rateTag)); rateDisplay->setDirty(); } } break; case kRateRandFactor: theCycleRate = calculateTheCycleRate(); if (rateRandFactorFader) rateRandFactorFader->setValue(value); if (rateRandFactorDisplay) rateRandFactorDisplay->setValue(value); if (rangeDisplay) rangeDisplay->setValue(value); if (rateRandRangeDisplay) { rateRandRangeDisplay->setValue(value); // makes the rate random range display disappear when there's no rate randomness if ( effect->getParameter(kRateRandFactor) <= 0.0003f ) { rateRandRangeDisplay->setBackColor(kBackgroundCColor); rateRandRangeDisplay->setFrameColor(kBackgroundCColor); } else { rateRandRangeDisplay->setBackColor(kMyPaleGreenCColor); rateRandRangeDisplay->setFrameColor(kBlackCColor); } rateRandRangeDisplay->setDirty(); } break; case kTempo: theCycleRate = calculateTheCycleRate(); if (tempoFader) tempoFader->setValue(value); if (tempoTextEdit) { if ( (value > 0.0f) || (((Skidder*)effect)->hostCanDoTempo != 1) ) sprintf(tempoString, "%.3f bpm", tempoScaled(value)); else strcpy(tempoString, "auto"); tempoTextEdit->setText(tempoString); } // update the rate random range display // (this crashes for some reason?) // if (rateRandRangeDisplay) // rateRandRangeDisplay->setDirty(); break; case kPulsewidth: if (pulsewidthFader) pulsewidthFader->setValueTagged(index, value); if (pulsewidthDisplay) pulsewidthDisplay->setValue(value); if (randomMinimumDisplay) randomMinimumDisplay->setValue(effect->getParameter(kPulsewidthRandMin)); if (pulsewidthRandMinDisplay) pulsewidthRandMinDisplay->setValue(effect->getParameter(kPulsewidthRandMin)); // because the regular pulsewidth can affect the random's read-out if (pulsewidthRandMinDisplay) pulsewidthRandMinDisplay->setDirty(); if (randomMinimumDisplay) randomMinimumDisplay->setDirty(); break; case kPulsewidthRandMin: if (pulsewidthFader) pulsewidthFader->setValueTagged(index, value); if (pulsewidthRandMinDisplay) pulsewidthRandMinDisplay->setValue(value); if (randomMinimumDisplay) randomMinimumDisplay->setValue(value); if (pulsewidthDisplay) pulsewidthDisplay->setValue(effect->getParameter(kPulsewidth)); break; case kSlope: if (slopeFader) slopeFader->setValue(value); if (slopeDisplay) slopeDisplay->setValue(value); break; case kFloor: if (floorFader) floorFader->setValueTagged(index, value); if (floorDisplay) floorDisplay->setValue(value); // because the regular floor can affect the random's read-out if (floorRandMinDisplay) floorRandMinDisplay->setDirty(); if (randomMinimum2Display) randomMinimum2Display->setDirty(); break; case kFloorRandMin: if (floorFader) floorFader->setValueTagged(index, value); if (floorRandMinDisplay) floorRandMinDisplay->setValue(value); if (randomMinimum2Display) randomMinimum2Display->setValue(value); break; case kPan: if (panFader) panFader->setValue(value); if (panDisplay) panDisplay->setValue(value); break; case kNoise: if (noiseFader) noiseFader->setValue(value); if (noiseDisplay) noiseDisplay->setValue(value); break; #ifdef MSKIDDER case kMidiMode: if (midiModeButton) midiModeButton->setValue(value); break; case kVelocity: if (velocityButton) velocityButton->setValue(value); break; #ifdef HUNGRY case kConnect: if (connectButton) connectButton->setValue(value); if (connectDisplay) connectDisplay->setValue(value); break; #endif #endif default: return; } postUpdate(); }
void SkidderEditor::idle() { bool somethingChanged = false; if (isOpen) { if ( ((Skidder*)effect)->tempoHasChanged ) { if (rateRandFactorDisplay) { theCycleRate = calculateTheCycleRate(); if (rateRandRangeDisplay) rateRandRangeDisplay->setDirty(); somethingChanged = true; } ((Skidder*)effect)->tempoHasChanged = false; // reset it } // turn off any glowing controls that are no longer learning for (long i=0; i < NUM_PARAMETERS; i++) { if ( (faders[i] != NULL) && (i != chunk->getLearner()) ) { if (faders[i]->getHandle() == gGlowingFaderHandle) { faders[i]->setHandle(gFaderHandle); faders[i]->setDirty(); somethingChanged = true; } } } // if (rateFader) { if ( (chunk->getLearner() != rateFader->getTag()) && (rateFader->getHandle() == gGlowingFaderHandle) ) { rateFader->setHandle(gFaderHandle); rateFader->setDirty(); somethingChanged = true; } else if ( (chunk->getLearner() == rateFader->getTag()) && (rateFader->getHandle() == gFaderHandle) ) { rateFader->setHandle(gGlowingFaderHandle); rateFader->setDirty(); somethingChanged = true; } } // if (pulsewidthFader) { if ( ((chunk->getLearner() != kPulsewidthRandMin) && (pulsewidthFader->getHandle() == gGlowingFaderHandleLeft)) && !((chunk->getLearner() == kPulsewidth) && (chunk->pulsewidthDoubleAutomate != 0)) ) { pulsewidthFader->setHandle(gFaderHandleLeft); pulsewidthFader->setDirty(); somethingChanged = true; } if ( ((chunk->getLearner() != kPulsewidth) && (pulsewidthFader->getHandle2() == gGlowingFaderHandleRight)) && !((chunk->getLearner() == kPulsewidthRandMin) && (chunk->pulsewidthDoubleAutomate != 0)) ) { pulsewidthFader->setHandle2(gFaderHandleRight); pulsewidthFader->setDirty(); somethingChanged = true; } } // if (floorFader) { if ( ((chunk->getLearner() != kFloorRandMin) && (floorFader->getHandle() == gGlowingFaderHandleLeft)) && !((chunk->getLearner() == kFloor) && (chunk->floorDoubleAutomate != 0)) ) { floorFader->setHandle(gFaderHandleLeft); floorFader->setDirty(); somethingChanged = true; } if ( ((chunk->getLearner() != kFloor) && (floorFader->getHandle2() == gGlowingFaderHandleRight)) && !((chunk->getLearner() == kFloorRandMin) && (chunk->floorDoubleAutomate != 0)) ) { floorFader->setHandle2(gFaderHandleRight); floorFader->setDirty(); somethingChanged = true; } } // indicate that changed controls need to be redrawn if (somethingChanged) postUpdate(); } // this is called so that idle() actually happens AEffGUIEditor::idle(); }