示例#1
0
uint32_t Config::startFrame()
{
    _updateData();
    const eq::uint128_t& version = _frameData.commit();

    _redraw = false;
    return eq::Config::startFrame( version );
}
void EDS_2x3PlaneFingers::UpdateHand()
{
	_updateData();

	for (unsigned int i=0; i<2; i++)
	{
		for (unsigned int j=0; j<3; j++)
		{
			mHand->getFingerFromVector(i)->getKnuckleAt(j)->setAttitude(osg::Vec3(mTheta[i][j],0,0));
			mHand->getFingerFromVector(i)->getKnuckleAt(j)->makeTransform();
		}
	}
}
示例#3
0
bool Config::handleEvent( eq::EventICommand command )
{
    switch( command.getEventType( ))
    {
        case DATA_CHANGED:
        {
            _registerData( command );
            if( _readyToCommit() )
                _frameData.commit();    // broadcast changed data to all clients
            return false;
        }

        case PROXY_CHANGED:
        {
            _updateData( command );
            if( _readyToCommit() )
            {
                _updateSimulation();    // update the simulation every nth frame
                _frameData.commit();    // broadcast changed data to all clients
            }
            return false;
        }

        case eq::Event::KEY_PRESS:
        {
            const eq::Event& event = command.get< eq::Event >();
            if( _handleKeyEvent( event.keyPress ))
            {
                _redraw = true;
                return true;
            }
            break;
        }

        case eq::Event::WINDOW_EXPOSE:
        case eq::Event::WINDOW_RESIZE:
        case eq::Event::WINDOW_CLOSE:
        case eq::Event::VIEW_RESIZE:
            _redraw = true;
            break;

        default:
            break;
    }

    _redraw |= eq::Config::handleEvent( command );
    return _redraw;
}
示例#4
0
bool Config::handleEvent( const eq::ConfigEvent* event )
{               
    switch( event->data.type )
    {
      case ConfigEvent::DATA_CHANGED:
          _registerData(static_cast< const ConfigEvent* >( event ));
          if( _readyToCommit() ) {
              _frameData.commit();        // broadcast changed data to all clients
          }
          break;

      case ConfigEvent::PROXY_CHANGED:
      {
          _updateData(static_cast< const ConfigEvent* >( event ));
          if( _readyToCommit() ) {
              _updateSimulation();    // update the simulation every nth frame
              _frameData.commit();    // broadcast changed data to all clients
          }
      }
      break;
                
      case eq::Event::KEY_PRESS:
          if( _handleKeyEvent( event->data.keyPress ))
          {
              _redraw = true;
              return true;
          }
          break;
                                
      case eq::Event::WINDOW_EXPOSE:
      case eq::Event::WINDOW_RESIZE:
      case eq::Event::WINDOW_CLOSE:
      case eq::Event::VIEW_RESIZE:
          _redraw = true;
          break;
                
      default:
          break;
    }
        
    _redraw |= eq::Config::handleEvent( event );
    return _redraw;
}
示例#5
0
	void Lightning::update(Ogre::Real timeSinceLastFrame)
	{
		if (!mCreated)
		{
			return;
		}

		timeSinceLastFrame *= mTimeMultiplier;

		// mTime timeline: (Note: Time multipliers are random)
		// 0.0 -> 1.2 : Ray creation(fordward effect) + Big flash
		// 1.2 -> 2.0 : Sinus flashing pattern
		// 2.0 -> 3.0 Ray fading

		Ogre::Real alpha = 0.5f;
		Ogre::Real maxAlpha = 1.5f;

		if (mTime < 1)
		{
			mTime += timeSinceLastFrame*mTimeMultipliers.x;

			if (mTime > 2) mTime = 1.5f; // Prevent big changes

			if (mTime > 0.8f) // Big flash start
			{
				alpha += (mTime-0.8f)*(maxAlpha/0.2f);
			}
		}
		else if (mTime > 1 && mTime < 2)
		{
			mTime += timeSinceLastFrame*mTimeMultipliers.y;

			if (mTime > 3) mTime = 2.5f; // Prevent big changes

			if (mTime < 1.2f) // Big flash end
			{
				alpha += (0.2f-(mTime-1.0f))*(maxAlpha/0.2f);
			}
			else // Sinus flashing pattern
			{
				alpha += Ogre::Math::Abs(Ogre::Math::Sin((mTime-1.2f)*1.5f*mTimeMultipliers.x));
			}
		}
		else if (mTime > 2) // Ray fading
		{
			mTime += timeSinceLastFrame*mTimeMultipliers.z;

			 if (mTime > 3) 
			 {
				 mTime = 3; // Prevent big changes
				 mFinished = true;
			 }

			alpha += Ogre::Math::Abs(Ogre::Math::Sin((2-1.2f)*1.5f*mTimeMultipliers.x));
			alpha *= 3.0f-mTime;
		}

		mIntensity = alpha;

		_updateData(alpha, mTime > 1 ? 1 : mTime, mTime);
	}