void IndexTextureController::updateCoords(const std::string& _value) { MyGUI::IntCoord coord; if (MyGUI::utility::parseComplex(_value, coord.left, coord.top, coord.width, coord.height)) mSize = coord.size(); else mSize.clear(); updateFrames(); }
void TFDisplay::update( float dt ) { update_timer_ += dt; if ( update_timer_ > update_rate_ ) { updateFrames(); update_timer_ = 0.0f; } }
void ComponentLayoutEditor::bindWithTarget () { if (target != NULL) { Component* t = (Component*) target.getComponent (); Component* p = t->getParentComponent (); p->addAndMakeVisible (this); setBounds (t->getBounds ()); updateFrames (); } }
void ComponentLayoutManager::bindWithTarget () { if (target && !target->hasBeenDeleted ()) { Component* t = (Component*) target->getComponent (); Component* p = t->getParentComponent (); p->addAndMakeVisible (this); setBounds (t->getBounds ()); updateFrames (); } }
void IndexTextureController::notifyChangeProperty(PropertyPtr _sender) { if (!mActivated || !PropertyUtility::isDataSelected(_sender->getOwner())) return; if (_sender->getOwner()->getType()->getName() == "Group") { if (_sender->getType()->getName() == "Texture") mControl->setTextureValue(_sender->getValue()); else if (_sender->getType()->getName() == "Size") updateCoords(_sender->getValue()); } else if (_sender->getOwner()->getType()->getName() == "Frame") { if (_sender->getType()->getName() == "Point") updateFrames(); } }
bool Call::mixData(float *buf, int len, float balance) { #ifdef REN_DEBUG qWarning(QString("Call::mixData() - Balance: %1").arg(balance, 2, 'f', 1 )); #endif bool ret = false; // renyang - 目前準備好的音訊檔的frames個數大於len if (readyFrames >= len) { if (!mutePlay) { for (int i=0; i<len; i++) buf[i] = (buf[i]*(1.f-balance)) + (soundBuffer[i]*balance); ret = true; } updateFrames(len); } return ret; }
//THIS MAKES THREAD DATA INCONSISTENT! Careful when using void ThreadPiece::offset_and_update_locally(const Vector3d& offset) { //offset this vertex (call it vertex i) _vertex += offset; #ifdef ISOTROPIC updateFrames(); #else //calculate the locally changed edges and bishop frames (from i-1 to i+1) if (_prev_piece != NULL) { _prev_piece->update_edge(); if (_prev_piece->_prev_piece != NULL) { _prev_piece->update_bishop_frame(); _prev_piece->update_material_frame(); } } if (_next_piece != NULL) { update_edge(); if (_prev_piece != NULL) { update_bishop_frame(); } if (_next_piece->_next_piece != NULL) { _next_piece->update_bishop_frame(); //find how the change in bishop frame affects the angle change update_material_frame(); double angle_twist_diff = _next_piece->twist_angle_error(); // std::cout << "angle twist diff: " << angle_twist_diff << std::endl; _next_piece->_angle_twist += angle_twist_diff; //_next_piece->update_material_frame(); } } #endif }
// renyang - 播放響鈴或是對方的語音 bool Call::playData(float *buf, int len) { #ifdef REN_DEBUG // qWarning(QString("Call::playData() - readyFrames: %1 len %2").arg(readyFrames).arg(len));; qWarning(QString("Call::playData(float %1, int %2)").arg(*buf).arg(len)); #endif bool ret = false; // renyang - 只有當真的有資料可以撥放時, 回傳才會是true if (readyFrames >= len) { if (!mutePlay) { for (int i=0; i<len; i++) { // renyang - 撥放是由Phone去撥放的 buf[i] = soundBuffer[i]; } ret = true; } // renyang - 由readyBuffer扣掉len長度 updateFrames(len); } return ret; }
void VisualizationManager::onUpdate() { ros::WallDuration wall_diff = ros::WallTime::now() - last_update_wall_time_; ros::Duration ros_diff = ros::Time::now() - last_update_ros_time_; float wall_dt = wall_diff.toSec(); float ros_dt = ros_diff.toSec(); last_update_ros_time_ = ros::Time::now(); last_update_wall_time_ = ros::WallTime::now(); //ROS_INFO("time since last update: %fs", wall_dt); if(ros_dt < 0.0) { resetTime(); } ros::spinOnce(); Q_EMIT preUpdate(); frame_manager_->update(); root_display_group_->update( wall_dt, ros_dt ); view_manager_->update(wall_dt, ros_dt); time_update_timer_ += wall_dt; if( time_update_timer_ > 0.1f ) { time_update_timer_ = 0.0f; updateTime(); } frame_update_timer_ += wall_dt; if(frame_update_timer_ > 1.0f) { frame_update_timer_ = 0.0f; updateFrames(); } selection_manager_->update(); if( tool_manager_->getCurrentTool() ) { tool_manager_->getCurrentTool()->update(wall_dt, ros_dt); } if ( view_manager_ && view_manager_->getCurrent() && view_manager_->getCurrent()->getCamera() ) { directional_light_->setDirection(view_manager_->getCurrent()->getCamera()->getDerivedDirection()); } frame_count_++; //ROS_INFO("rviz/scenegraph update completed"); if ( render_requested_ || wall_dt > 0.01 ) { render_requested_ = 0; boost::mutex::scoped_lock lock(private_->render_mutex_); if ( render_panel_list_.size() == 0 ) ogre_root_->renderOneFrame(); for ( int i = 0; i < render_panel_list_.size(); i++ ) { if( render_panel_render_mask_[i] ) { active_view_id_ = i; render_panel_list_[i]->getRenderWindow()->update(true); } } } //ROS_INFO("finished rendering one frame"); }
void ParticlesGame::controlEvent(Control* control, EventType evt) { std::string id = control->getId(); // Handle UI events. ParticleEmitter* emitter = _particleEmitterNode->getParticleEmitter(); switch(evt) { case Listener::VALUE_CHANGED: if (control == _startRed) { Vector4 startColor = emitter->getColorStart(); startColor.x = _startRed->getValue(); emitter->setColor(startColor, emitter->getColorStartVariance(), emitter->getColorEnd(), emitter->getColorEndVariance()); } else if (control == _startGreen) { Vector4 startColor = emitter->getColorStart(); startColor.y = _startGreen->getValue(); emitter->setColor(startColor, emitter->getColorStartVariance(), emitter->getColorEnd(), emitter->getColorEndVariance()); } else if (control == _startBlue) { Vector4 startColor = emitter->getColorStart(); startColor.z = _startBlue->getValue(); emitter->setColor(startColor, emitter->getColorStartVariance(), emitter->getColorEnd(), emitter->getColorEndVariance()); } else if (control == _startAlpha) { Vector4 startColor = emitter->getColorStart(); startColor.w = _startAlpha->getValue(); emitter->setColor(startColor, emitter->getColorStartVariance(), emitter->getColorEnd(), emitter->getColorEndVariance()); } else if (control == _endRed) { Vector4 endColor = emitter->getColorEnd(); endColor.x = _endRed->getValue(); emitter->setColor(emitter->getColorStart(), emitter->getColorStartVariance(), endColor, emitter->getColorEndVariance()); } else if (control == _endGreen) { Vector4 endColor = emitter->getColorEnd(); endColor.y = _endGreen->getValue(); emitter->setColor(emitter->getColorStart(), emitter->getColorStartVariance(), endColor, emitter->getColorEndVariance()); } else if (control == _endBlue) { Vector4 endColor = emitter->getColorEnd(); endColor.z = _endBlue->getValue(); emitter->setColor(emitter->getColorStart(), emitter->getColorStartVariance(), endColor, emitter->getColorEndVariance()); } else if (control == _endAlpha) { Vector4 endColor = emitter->getColorEnd(); endColor.w = _endAlpha->getValue(); emitter->setColor(emitter->getColorStart(), emitter->getColorStartVariance(), endColor, emitter->getColorEndVariance()); } else if (control == _startMin) { emitter->setSize(_startMin->getValue(), emitter->getSizeStartMax(), emitter->getSizeEndMin(), emitter->getSizeEndMax()); } else if (control == _startMax) { emitter->setSize(emitter->getSizeStartMin(), _startMax->getValue(), emitter->getSizeEndMin(), emitter->getSizeEndMax()); } else if (control == _endMin) { emitter->setSize(emitter->getSizeStartMin(), emitter->getSizeStartMax(), _endMin->getValue(), emitter->getSizeEndMax()); } else if (control == _endMax) { emitter->setSize(emitter->getSizeStartMin(), emitter->getSizeStartMax(), emitter->getSizeEndMin(), _endMax->getValue()); } else if (control == _energyMin) { emitter->setEnergy(_energyMin->getValue(), emitter->getEnergyMax()); } else if (control == _energyMax) { emitter->setEnergy(emitter->getEnergyMin(), _energyMax->getValue()); } else if (control == _emissionRate) { emitter->setEmissionRate(_emissionRate->getValue()); } else if (id == "posX") { Vector3 pos(emitter->getPosition()); pos.x = ((Slider*)control)->getValue(); emitter->setPosition(pos, emitter->getPositionVariance()); } else if (id == "posY") { Vector3 pos(emitter->getPosition()); pos.y = ((Slider*)control)->getValue(); emitter->setPosition(pos, emitter->getPositionVariance()); } else if (id == "posZ") { Vector3 pos(emitter->getPosition()); pos.z = ((Slider*)control)->getValue(); emitter->setPosition(pos, emitter->getPositionVariance()); } else if (control == _posVarX) { Vector3 posVar = emitter->getPositionVariance(); posVar.x = _posVarX->getValue(); emitter->setPosition(emitter->getPosition(), posVar); } else if (control == _posVarY) { Vector3 posVar = emitter->getPositionVariance(); posVar.y = _posVarY->getValue(); emitter->setPosition(emitter->getPosition(), posVar); } else if (control == _posVarZ) { Vector3 posVar = emitter->getPositionVariance(); posVar.z = _posVarZ->getValue(); emitter->setPosition(emitter->getPosition(), posVar); } else if (control == _velX) { Vector3 vel = emitter->getVelocity(); vel.x = _velX->getValue(); emitter->setVelocity(vel, emitter->getVelocityVariance()); } else if (control == _velY) { Vector3 vel = emitter->getVelocity(); vel.y = _velY->getValue(); emitter->setVelocity(vel, emitter->getVelocityVariance()); } else if (control == _velZ) { Vector3 vel = emitter->getVelocity(); vel.z = _velZ->getValue(); emitter->setVelocity(vel, emitter->getVelocityVariance()); } else if (control == _velVarX) { Vector3 velVar = emitter->getVelocityVariance(); velVar.x = _velVarX->getValue(); emitter->setVelocity(emitter->getVelocity(), velVar); } else if (control == _velVarY) { Vector3 velVar = emitter->getVelocityVariance(); velVar.y = _velVarY->getValue(); emitter->setVelocity(emitter->getVelocity(), velVar); } else if (control == _velVarZ) { Vector3 velVar = emitter->getVelocityVariance(); velVar.z = _velVarZ->getValue(); emitter->setVelocity(emitter->getVelocity(), velVar); } else if (control == _accelX) { Vector3 accel = emitter->getAcceleration(); accel.x = _accelX->getValue(); emitter->setAcceleration(accel, emitter->getAccelerationVariance()); } else if (control == _accelY) { Vector3 accel = emitter->getAcceleration(); accel.y = _accelY->getValue(); emitter->setAcceleration(accel, emitter->getAccelerationVariance()); } else if (control == _accelZ) { Vector3 accel = emitter->getAcceleration(); accel.z = _accelZ->getValue(); emitter->setAcceleration(accel, emitter->getAccelerationVariance()); } else if (control == _accelVarX) { Vector3 accelVar = emitter->getAccelerationVariance(); accelVar.x = _accelVarX->getValue(); emitter->setAcceleration(emitter->getAcceleration(), accelVar); } else if (control == _accelVarY) { Vector3 accelVar = emitter->getAccelerationVariance(); accelVar.y = _accelVarY->getValue(); emitter->setAcceleration(emitter->getAcceleration(), accelVar); } else if (control == _accelVarZ) { Vector3 accelVar = emitter->getAccelerationVariance(); accelVar.z = _accelVarZ->getValue(); emitter->setAcceleration(emitter->getAcceleration(), accelVar); } else if (control == _spinSpeedMin) { emitter->setRotationPerParticle(_spinSpeedMin->getValue(), emitter->getRotationPerParticleSpeedMax()); } else if (control == _spinSpeedMax) { emitter->setRotationPerParticle(emitter->getRotationPerParticleSpeedMin(), _spinSpeedMax->getValue()); } else if (control == _axisX) { Vector3 axis = emitter->getRotationAxis(); axis.x = _axisX->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance()); } else if (control == _axisY) { Vector3 axis = emitter->getRotationAxis(); axis.y = _axisY->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance()); } else if (control == _axisZ) { Vector3 axis = emitter->getRotationAxis(); axis.z = _axisZ->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), axis, emitter->getRotationAxisVariance()); } else if (control == _axisVarX) { Vector3 axisVar = emitter->getRotationAxisVariance(); axisVar.x = _axisVarX->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), emitter->getRotationAxis(), axisVar); } else if (control == _axisVarY) { Vector3 axisVar = emitter->getRotationAxisVariance(); axisVar.y = _axisVarY->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), emitter->getRotationAxis(), axisVar); } else if (control == _axisVarZ) { Vector3 axisVar = emitter->getRotationAxisVariance(); axisVar.z = _axisVarZ->getValue(); emitter->setRotation(emitter->getRotationSpeedMin(), emitter->getRotationSpeedMax(), emitter->getRotationAxis(), axisVar); } else if (control == _rotationSpeedMin) { emitter->setRotation(_rotationSpeedMin->getValue(), emitter->getRotationSpeedMax(), emitter->getRotationAxis(), emitter->getRotationAxisVariance()); } else if (control == _rotationSpeedMax) { emitter->setRotation(emitter->getRotationSpeedMin(), _rotationSpeedMax->getValue(), emitter->getRotationAxis(), emitter->getRotationAxisVariance()); } else if (control == _started) { if (_started->isChecked()) { emitter->start(); } else { emitter->stop(); } } else if (control == _vsync) { Game::getInstance()->setVsync(_vsync->isChecked()); } else if (id == "additive") { if (((RadioButton*)control)->isSelected()) emitter->setTextureBlending(ParticleEmitter::BLEND_ADDITIVE); } else if (id == "transparent") { if (((RadioButton*)control)->isSelected()) emitter->setTextureBlending(ParticleEmitter::BLEND_TRANSPARENT); } else if (id == "multiply") { if (((RadioButton*)control)->isSelected()) emitter->setTextureBlending(ParticleEmitter::BLEND_MULTIPLIED); } else if (id == "opaque") { if (((RadioButton*)control)->isSelected()) emitter->setTextureBlending(ParticleEmitter::BLEND_OPAQUE); } break; case Listener::CLICK: if (control == _reset) { // Re-load the current emitter and reset the view _particleEmitter = ParticleEmitter::create(_url.c_str()); emitterChanged(); } else if (control == _emit) { // Emit a burst of particles. unsigned int burstSize = (unsigned int)_burstSize->getValue(); emitter->emitOnce(burstSize); } else if (id == "sprite") { updateTexture(); } else if (id == "updateFrames") { updateFrames(); } break; case Listener::PRESS: if (control == _zoomIn) { _wDown = true; } else if (control == _zoomOut) { _sDown = true; } break; case Listener::RELEASE: if (control == _zoomIn) { _wDown = false; } else if (control == _zoomOut) { _sDown = false; } else if (control == _save) { Game::getInstance()->pause(); saveFile(); Game::getInstance()->resume(); } else if (control == _load) { Game::getInstance()->pause(); std::string filename = FileSystem::displayFileDialog(FileSystem::OPEN, "Select Particle File", "Particle Files", "particle", "res"); if (filename.length() > 0) { _url = filename; _particleEmitter = ParticleEmitter::create(_url.c_str()); emitterChanged(); } Game::getInstance()->resume(); } break; } }
void ThreadPiece::offset_and_update(const Vector3d& offset) { //offset this vertex _vertex += offset; updateFrames(); }