コード例 #1
0
ファイル: Editor.c プロジェクト: pixelmager/rocket
void Editor_update()
{
	bool need_update = internalUpdate();

	if (need_update)
	{
		Editor_updateTrackScroll();
		internalUpdate();
	}
}
コード例 #2
0
ファイル: Light.cpp プロジェクト: newincpp/kaboom
void newin::Light::setShader(ShadeProgram* p) {
    _prgm = p;
    if (!_prgm) {
	throw newin::ShaderException("shader cannot be null");
    }
    internalUpdate();
}
コード例 #3
0
ファイル: dgltextureview.cpp プロジェクト: scygan/debugler
void DGLTextureViewItem::faceComboChanged(int value) {
    uint uvalue = value;
    if (uvalue != m_CurrentFace && uvalue < static_cast<uint>(m_FacesLevelsLayers.size())) {
        m_CurrentFace = uvalue;
        internalUpdate();
    }
}
コード例 #4
0
KstObject::UpdateType KstPrimitive::update(int update_counter) {
  bool force = dirty();
  setDirty(false);

  if (KstObject::checkUpdateCounter(update_counter) && !force) {
    return lastUpdateResult();
  }

  KstObject::UpdateType providerRC = NO_CHANGE;

  if (update_counter > 0) {
    KstObjectPtr prov = KstObjectPtr(_provider);
    if (prov) {
      // provider is already locked
      providerRC = prov->update(update_counter);
      if (!force && providerRC == KstObject::NO_CHANGE) {
        return setLastUpdateResult(providerRC);
      }
    }
  }

  KstObject::UpdateType rc = internalUpdate(providerRC);
  setDirty(false);
  return rc;
}
コード例 #5
0
ファイル: dgltextureview.cpp プロジェクト: scygan/debugler
void DGLTextureViewItem::layerSliderMoved(int value) {
    uint uvalue = value;
    if (uvalue != m_CurrentLayer &&
        uvalue < static_cast<uint>(m_FacesLevelsLayers[m_CurrentFace][m_CurrentLevel].size())) {
            m_CurrentLayer = uvalue;
            internalUpdate();
    }
}
コード例 #6
0
ファイル: dgltextureview.cpp プロジェクト: scygan/debugler
void DGLTextureViewItem::update(const dglnet::DGLResource& res) {
    const dglnet::resource::DGLResourceTexture* resource =
            dynamic_cast<const dglnet::resource::DGLResourceTexture*>(&res);

    m_FacesLevelsLayers = resource->m_FacesLevelsLayers;

    m_CurrentFace = std::min(
        m_CurrentFace, static_cast<uint>(m_FacesLevelsLayers.size() - 1));

    if (m_FacesLevelsLayers.size() && m_FacesLevelsLayers[0].size()) {

        if (m_FacesLevelsLayers.size() > 1) {
            // texture has faces
            m_Ui.labelCM->show();
            m_Ui.comboBoxCM->show();
        } else {
            m_Ui.labelCM->hide();
            m_Ui.comboBoxCM->hide();
        }

        m_Ui.comboBoxCM->setCurrentIndex(m_CurrentFace);


        m_CurrentLevel = std::min(
            m_CurrentFace, static_cast<uint>(m_FacesLevelsLayers[m_CurrentFace].size() - 1));

        m_CurrentLayer = std::min(
            m_CurrentFace, static_cast<uint>(m_FacesLevelsLayers[m_CurrentFace][m_CurrentLevel].size() - 1));


        m_Ui.horizontalSlider_LOD->setRange(
            0, static_cast<int>(m_FacesLevelsLayers[m_CurrentFace].size() - 1));
        m_Ui.horizontalSlider_LOD->setEnabled(true);


        if (resource->m_Target == GL_TEXTURE_3D ||
            resource->m_Target == GL_TEXTURE_2D_ARRAY ||
            resource->m_Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
            resource->m_Target == GL_TEXTURE_CUBE_MAP_ARRAY) {
            
            m_Ui.label_TextureLayer->show();
            m_Ui.verticalSlider_Layer->show();
        } else {
            m_Ui.label_TextureLayer->hide();
            m_Ui.verticalSlider_Layer->hide();
        }

        m_Ui.verticalSlider_Layer->setEnabled(true);
        m_Ui.verticalSlider_Layer->setRange(
            0, static_cast<int>(m_FacesLevelsLayers[m_CurrentFace][m_CurrentLevel].size() - 1));

        internalUpdate();

    } else {
        error("Texture is empty");
    }
}
コード例 #7
0
//------------------------------------------------
void guiTypeLabel::setup(ofParameter<string> & label, bool highlight){
//    cout << " adding label with name " << label.getName() << " and value " << label << endl;
    guiBaseObject::setupNamesFromParams(); 

    textLabel.makeReferenceTo(label);
    bHighlight = highlight;
    
    internalUpdate();
    boundingBox = hitArea;
}
コード例 #8
0
KalziumTip::KalziumTip( QWidget * parent, const char * name, WFlags f ) : QWidget( parent, name, f ) 
{
	setFocusPolicy(NoFocus); //the widget don't get the keyboard focus
	setBackgroundMode(NoBackground); // widget has no background
	resize(0,0);
	hide(); //initailly hide it
	m_richText = 0;
	m_noElemIcon = KGlobal::iconLoader()->loadIcon( "orbits", KIcon::NoGroup, 64 );
	setMouseTracking(true); // receice mouse move events
	
	connect(&m_frameTimer, SIGNAL(timeout()), SLOT(internalUpdate()));
}
コード例 #9
0
//-----------------------------------------------.
void guiTypeLabel::render(){
    internalUpdate();
    
	ofPushStyle();
    
        if( bHighlight ){
            glColor4fv(outlineColor.getColorF());
            ofLine(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.width, boundingBox.y);
            ofLine(boundingBox.x, boundingBox.y + boundingBox.height, boundingBox.x + boundingBox.width, boundingBox.y + boundingBox.height);
        }
    
        guiBaseObject::renderText();
	ofPopStyle();
}
コード例 #10
0
void TextureFilter::update(RenderActionBase *action, const Vec2f& DrawnSize)
{
    if(isDirty())
    {
        for(UInt32 i(0) ; i < getNumInputSlots() ; ++i)
        {
            editInputSlot(i)->getSourceFilter()->update(action, DrawnSize);
        }

        internalUpdate(action, DrawnSize);

        setDirty(false);
    }
}
コード例 #11
0
void LayeredHairMesh::simulate()
{
	auto state = simPts;
	state.insert(state.end(), simVel.begin(), simVel.end());
	externalUpdate(state);
	internalUpdate(state);
	collisionDetect(state);

	int compSize = simPts.size();
	simPts.clear();
	simPts.insert(simPts.end(), state.begin(), state.begin() + compSize);
	simVel.clear();
	simVel.insert(simVel.end(), state.begin() + compSize, state.end());
}
コード例 #12
0
ファイル: animbase.cpp プロジェクト: prwhite/philibs
void base::update ( manager* pManager, TimeType curTime )
{
  xform txform ( mXform );

  if ( mLoopDuration > 0.0f )
  {
    txform.mDuration = mLoopDuration;
    curTime = txform.mStart + fmodf ( curTime - txform.mStart, mLoopDuration );
  }
  
  txform.invert ();
  
  curTime = txform.transform ( curTime );
  
  internalUpdate ( pManager, curTime );
}
nsresult
sbPlayQueueExternalLibraryListener::GenerateUpdates(
        sbIMediaItem* aMediaItem,
        sbIPropertyArray* aProperties,
        Updates& updates)
{
  TRACE(("%s[%p]", __FUNCTION__, this));
  nsresult rv;

  nsCOMPtr<sbILibrary> lib;
  rv = aMediaItem->GetLibrary(getter_AddRefs(lib));
  NS_ENSURE_SUCCESS(rv, rv);

  // This ensures that we have an item that is either in our master library or 
  // is duplicated in the master library.
  nsCOMPtr<sbIMediaItem> internalMediaItem;
  if (lib == mMasterLibrary) {
    internalMediaItem = aMediaItem;
  } else {
    rv = mMasterLibrary->GetDuplicate(aMediaItem,
                                        getter_AddRefs(internalMediaItem));
    NS_ENSURE_SUCCESS(rv, rv);
    if (internalMediaItem) {
      sbPropertyUpdate internalUpdate(internalMediaItem, aProperties);
      updates.push_back(internalUpdate);
    } else {
      // If we can't find a duplicate in our master library, just return.
      return NS_OK;
    }
  }

  // We found an item in our master library - go find duplicates in our external
  // libraries to update.
  for (PRInt32 i = 0; i < mExternalLibraries.Count(); i++)
  {
    if (mExternalLibraries[i] != lib) {
      nsCOMPtr<sbIMediaItem> externalMediaItem;
      rv = mExternalLibraries[i]->GetDuplicate(internalMediaItem,
                                               getter_AddRefs(externalMediaItem));
      if (NS_SUCCEEDED(rv) && externalMediaItem) {
        sbPropertyUpdate externalUpdate(externalMediaItem, aProperties);
        updates.push_back(externalUpdate);
      }
    }
  }
  return NS_OK;
}
コード例 #14
0
ファイル: dgltextureview.cpp プロジェクト: scygan/debugler
void DGLTextureViewItem::levelSliderMoved(int value) {
    uint uvalue = value;
    if (uvalue != m_CurrentLevel &&
        uvalue < static_cast<uint>(m_FacesLevelsLayers[m_CurrentFace].size())) {

        m_CurrentLevel = uvalue;

        m_Ui.verticalSlider_Layer->setRange(
            0, static_cast<int>(m_FacesLevelsLayers[m_CurrentFace][m_CurrentLevel].size() - 1));

        m_CurrentLayer = std::min(
            m_CurrentFace, static_cast<uint>(m_FacesLevelsLayers[m_CurrentFace][m_CurrentLevel].size() - 1));

        internalUpdate();
    }
   
}
コード例 #15
0
KickerTip::KickerTip(QWidget * parent)
    : QWidget(parent, "animtt",WX11BypassWM),
      m_richText(0),
      m_mimeFactory(0),
      m_dissolveSize(0),
      m_dissolveDelta(-1),
      m_direction(KPanelApplet::Up),
      m_dirty(false),
      m_toolTipsEnabled(KickerSettings::showToolTips()),
      m_tippingFor(0)
{
    setFocusPolicy(NoFocus);
    setBackgroundMode(NoBackground);
    resize(0, 0);
    hide();
    connect(&m_frameTimer, SIGNAL(timeout()), SLOT(internalUpdate()));
}
コード例 #16
0
ファイル: Light.cpp プロジェクト: newincpp/kaboom
void newin::Light::initialize(ShadeProgram* prgm, const Vector3D<GLfloat>& p, const Vector3D<GLfloat>& rot, const Vector3D<GLfloat>& c, unsigned int index) {
    _pos = p;
    _rot = rot;
    _col = c;
    _prgm = prgm;
    _sindex = std::to_string(index);
    if (!_prgm) {
	throw newin::ShaderException("cannot use light without shader");
    }
    internalUpdate();
    Shader v("shadowMap_vs.glsl", GL_VERTEX_SHADER);
    Shader f("shadowMap_fs.glsl", GL_FRAGMENT_SHADER);

    _shad = new ShadeProgram(v,f);
    _proj.setShader(_shad);
    _modv.setShader(_shad);
    _proj.setShader(_shad);
    initShadowTex();
}
コード例 #17
0
ファイル: OnOffButtonWidget.cpp プロジェクト: hephaisto/heinz
void OnOffButtonWidget::btnOffClicked()
{
	endpoint->setValue(0);
	internalUpdate();
}
コード例 #18
0
void ParticleTrailGenerator::handleSystemUpdated(ParticleSystemEventDetails* const details)
{
    ParticleSystemRecPtr system = dynamic_cast<ParticleSystem*>(details->getSource());
    Real64 timeStamp = details->getTimeStamp();
    UInt32 numParticles = system->getNumParticles();
    // check for proper init. of last added value
    if(!_mInitialized) 
    {
        _mLastAdded = timeStamp;

        _mInitialized = true;
    }

    // add new trail sections
    if(getTrailResolutionMethod() == TIME_SPACING)
    {
        Time start(_mLastAdded);
        while(_mLastAdded + getTrailResolution() < timeStamp)
        {
            _mLastAdded += getTrailResolution();
            Time fractionalTime = 1 - (timeStamp - _mLastAdded)/(timeStamp - start);
            for(PTMItor it = _mTrails.begin(); it != _mTrails.end(); it++)
            {
                if((*it).second.size() > 0)
                {
                    ParticleTrailGenerator::TrailSection newSection;

                    newSection.pos = lerp((*it).second.back().pos,
                                          system->getPosition((*it).first),fractionalTime);
                    newSection.time = lerp<Time>(_mLastAdded,timeStamp,fractionalTime);
                    newSection.ID = getNextTSID();
                    (*it).second.push_back(newSection);
                    internalTrailSectGenerated(newSection, system->getVelocity((*it).first));
                }
            }// end for(numParticles) 
        }// end while(_mLastAdded + ...)
    } else if(getTrailResolutionMethod() == DISTANCE_SPACING)
    {
        ParticleTrailGenerator::TrailSection newSection;
        Real32 curDist(0.0f), origDist(0.0f);
        for(PTMItor it = _mTrails.begin(); it != _mTrails.end(); it++)
        {
            // we continue to add new sections to the trail as long as the 
            // distance between the last added trail section and the current 
            // position is greater than the trail resolution
            if((*it).second.size() > 0)
            {    // get distance between current position and last added section
                origDist = system->getPosition((*it).first).dist((*it).second.back().pos);
                curDist = origDist;
                while(curDist > getTrailResolution())
                { // generate new trail section
                    ParticleTrailGenerator::TrailSection newSection;
                    Real32 fractionalDistance = 1 - (curDist-getTrailResolution())/origDist;

                    Pnt3f pos = lerp((*it).second.back().pos,
                                     system->getPosition((*it).first),fractionalDistance);

                    newSection.pos = pos;
                    newSection.time = lerp<Time>((*it).second.back().time,timeStamp,fractionalDistance);
                    newSection.ID = getNextTSID();
                    (*it).second.push_back(newSection);
                    internalTrailSectGenerated(newSection, system->getVelocity((*it).first));
                    // update distance
                    curDist = system->getPosition((*it).first).dist(pos);
                }// end while
            }// end if
        }// end for
    } else // 1 trail section/update
    {
        for(PTMItor it = _mTrails.begin(); it != _mTrails.end(); it++)
        {
            ParticleTrailGenerator::TrailSection newSection;
            newSection.time = timeStamp;
            newSection.pos = system->getPosition((*it).first);
            newSection.ID = getNextTSID();
            (*it).second.push_back(newSection);
            internalTrailSectGenerated(newSection, system->getVelocity((*it).first));
        }
    }

    // remove old/outdated trail sections for active particle trails
    for(PTMItor it = _mTrails.begin(); it != _mTrails.end(); it++)
    {
        if(getTrailLengthMethod() == TIME && (*it).second.size() > 0)
        {    
            while(/*sectionAge > getTrailLength() &&*/ (*it).second.size() > 0)
            {
                Real64 sectionAge = timeStamp - (*it).second.front().time;
                if(sectionAge > getTrailLength())
                {
                    internalTrailSectKilled((*it).second.front());
                    (*it).second.pop_front();
                } else break;
            }
        } else if((*it).second.size() > 0) // getTrailLengthMethod() == NUM_POINTS
        {
            UInt32 trailLength = (UInt32)getTrailLength();
            while((*it).second.size() > trailLength)
            {
                internalTrailSectKilled((*it).second.front());
                (*it).second.pop_front();
            }
        }// end if/else if
    }// end for(_mTrails.size())

    // remove old trail sections for killed particles
    for(PTMItor kptItor = _mKilledParticleTrails.begin(); kptItor != _mKilledParticleTrails.end(); kptItor++)
    {
        int numKilledTrails = _mKilledParticleTrails.size();
        if(getTrailLengthMethod() == TIME)
        {
            int thisSize = (*kptItor).second.size();
            while((*kptItor).second.size() > 0)
            {
                thisSize = (*kptItor).second.size();
                Real64 sectionAge = timeStamp - (*kptItor).second.front().time;
                UInt32 myid = (*kptItor).second.front().ID;
                if(sectionAge > getTrailLength())
                {
                    internalTrailSectKilled((*kptItor).second.front());
                    (*kptItor).second.pop_front();
                } else break;

            }
        } else // getTrailLengthMethod() == NUM_POINTS
        { // No more points are being generated, so if these aren't removed, they will stay forever.  
            // So, we just clear the trails. 
            while((*kptItor).second.size() > 0)
            {    
                internalTrailSectKilled((*kptItor).second.front());
                (*kptItor).second.pop_front();
            }
        }
    } // end for(_mKilledParticleTrails.size())

    // fire off internal update for subclasses of trail generators
    internalUpdate(details);
}
コード例 #19
0
ファイル: Light.cpp プロジェクト: newincpp/kaboom
newin::Light::Light(ShadeProgram* prgm, const Vector3D<GLfloat>& p, const Vector3D<GLfloat>& r, const Vector3D<GLfloat>& c, unsigned int index) : AObject(p,r,c), _changed(true), _diff(5), _intensity(0.8), _prgm(prgm), _sindex(std::to_string(index)), _shad(NULL) {
    if (_prgm) {
	internalUpdate();
    }
    _col = c;
}
コード例 #20
0
/*!
 * \fn bool OSG::Animation::update(const Time& ElapsedTime)
 *
 * \brief Update the animation with the time since the last update
 *
 * The result of the animation will also be applied to the
 * object it is connected to.
 *
 * \param[in] ElapsedTime The time, in seconds, since the previous call to
 * update.
 */
bool Animation::update(const Time& ElapsedTime)
{
    if(!_IsPlaying || _IsPaused)
    {
        return false;
    }

    //Increment the updated animations statistic
    StatIntElem *NAnimationsStatElem = StatCollector::getGlobalElem(statNAnimations);
    if(NAnimationsStatElem) { NAnimationsStatElem->inc(); }

    //Start the  animation update time statistic
    StatTimeElem *AnimUpdateTimeStatElem = StatCollector::getGlobalElem(statAnimUpdateTime);
    if(AnimUpdateTimeStatElem) { AnimUpdateTimeStatElem->start(); }

    _CurrentTime += getScale()*ElapsedTime;
    UInt32 PreUpdateCycleCount(getCycles());
    if(getCycling() < 0 || PreUpdateCycleCount < getCycling())
    {
        Real32 CycleLength(getCycleLength() * getScale());

        //Check if the Animation Time is past the end
        if(_CurrentTime >= CycleLength)
        {
            //Update the number of cycles completed
            setCycles( (CycleLength <= 0.0f) ? (0): (static_cast<UInt32>( osgFloor( _CurrentTime / CycleLength ) )) );
            //commitChanges();
        }
        Real32 t(_CurrentTime);

        if(getCycling() > 0 && getCycles() >= getCycling())
        {
            if(getSpan() > 0.0f)
            {
                t = getSpan();
            }
            t -= 0.0001f;
        }
        else
        {
            if(getSpan() > 0.0f)
            {
                t -= osgFloor(_CurrentTime/getSpan())*getSpan();
            }
        }
        t += getOffset();

        //Internal Update
        internalUpdate(t, _PrevTime);


        //If the number of cycles has changed
        if(getCycles() != PreUpdateCycleCount)
        {
            if(getCycling() > 0 && getCycles() >= getCycling())
            {
                //Animation has reached the end
                //Remove the Animation from it's update producer
                _UpdateEventConnection.disconnect();
                _IsPlaying = false;

                //Produce the Ended event
                produceAnimationEnded();
            }
            else
            {
                //Animation hasn't finished yet
                //Produce the Cycled event
                produceAnimationCycled();
            }
        }
    }

    _PrevTime = _CurrentTime;

    //Stp[ the  animation update time statistic
    if(AnimUpdateTimeStatElem) { AnimUpdateTimeStatElem->stop(); }

    //Return true if the animation has completed its number of cycles, false otherwise
    return (getCycling() > 0 && getCycles() >= getCycling());
}