Example #1
0
void Matatas(double time){
   static double prev_time = 0.0;
   GLuint loc;
   float tmatrix[16];
   float rmatrix[16];
   float mmatrix[16];

   translate(tmatrix, -0.4, 3.0, -7.0);
   rotate(rmatrix, 0.0, 0.0, 4.1);
   matrixMultiply4x4(rmatrix, tmatrix, mmatrix);
   /* 30fps video playback */
   if(time - prev_time > 0.03){
      getNextFrame(matat);
      updateFace(matat.buffer, armface);
      prev_time = time;
      matatpos++;
   }

   glUseProgram(armface->shader);
   loc = glGetUniformLocation(armface->shader, "pmatrix");
   glUniformMatrix4fv(loc, 1, GL_FALSE, pmatrix);
   loc = glGetUniformLocation(armface->shader, "mmatrix");
   glUniformMatrix4fv(loc, 1, GL_FALSE, mmatrix);
   drawFace(armface);

   if(matatpos > 55){
      rewindDepthVideo(matat);
      matatpos = 1;
   }
}
Example #2
0
/* The last scene. I have made it first. :-)*/
void Headbreak(double time){
   static int i = 0;
   static float rot = 0.0;
   static double prev_time;
   GLuint loc;
   float tmatrix[16];
   float rmatrix[16];
   float mmatrix[16];

   translate(tmatrix, -0.4, 3.0, -7.0);
   rotate(rmatrix, 0.0, 0.0, 4.1);
   matrixMultiply4x4(rmatrix, tmatrix, mmatrix);
   /* 30fps video playback */
   if(time - prev_time > 0.03){
      getNextFrame(head);
      updateFace(head.buffer, face);
      prev_time = time;
      i++;
   }

   glUseProgram(face->shader);
   loc = glGetUniformLocation(face->shader, "pmatrix");
   glUniformMatrix4fv(loc, 1, GL_FALSE, pmatrix);
   loc = glGetUniformLocation(face->shader, "mmatrix");
   glUniformMatrix4fv(loc, 1, GL_FALSE, mmatrix);
   drawFace(face);

   rot += 0.05;
   if(i > 87){
      rewindDepthVideo(head);
      i = 1;
   }
}
   /** Cycle to the next family in the set of available font families. */
   void goToNextFamily()
   {
      mFamilyName = mFamilies[mNextFamily];
      mNextFamily += 1;
      if(mNextFamily >= mFamilies.size())
      { mNextFamily = 0; }

      std::cout << "New family: " << mFamilyName << std::endl;
      updateFace();
      updateScene();
   }
   void incFaceSize(bool inc=true)
   {
      if(inc)
         mFaceSize += 1;
      else if(0 != mFaceSize)
         mFaceSize -= 1;

      std::cout << "Set face size to: " << mFaceSize << std::endl;
      updateFace();
      updateScene();
   }
Example #5
0
void CubeReflector::updateReflection( const ReflectParams &params )
{
   GFXDEBUGEVENT_SCOPE( CubeReflector_UpdateReflection, ColorI::WHITE );

   mIsRendering = true;

   // Setup textures and targets...
   S32 texDim = mDesc->texSize;
   texDim = getMax( texDim, 32 );

   // Protect against the reflection texture being bigger
   // than the current game back buffer.
   texDim = getMin( texDim, params.viewportExtent.x );
   texDim = getMin( texDim, params.viewportExtent.y );

   bool texResize = ( texDim != mLastTexSize );  

   const GFXFormat reflectFormat = REFLECTMGR->getReflectFormat();

   if (  texResize || 
         cubemap.isNull() ||
         cubemap->getFormat() != reflectFormat )
   {
      cubemap = GFX->createCubemap();
      cubemap->initDynamic( texDim, reflectFormat );
   }
   
   GFXTexHandle depthBuff = LightShadowMap::_getDepthTarget( texDim, texDim );

   if ( renderTarget.isNull() )
      renderTarget = GFX->allocRenderToTextureTarget();   

   GFX->pushActiveRenderTarget();
   renderTarget->attachTexture( GFXTextureTarget::DepthStencil, depthBuff );

  
   F32 oldVisibleDist = gClientSceneGraph->getVisibleDistance();
   gClientSceneGraph->setVisibleDistance( mDesc->farDist );   


   for ( U32 i = 0; i < 6; i++ )
      updateFace( params, i );
   

   GFX->popActiveRenderTarget();

   gClientSceneGraph->setVisibleDistance(oldVisibleDist);

   mIsRendering = false;
   mLastTexSize = texDim;
}
Example #6
0
// Update Data
void Kinect::update()
{
    // Update Color
    updateColor();

    // Update Body
    updateBody();

    // Update Face
    updateFace();

    // Update Recognition
    updateRecognition();
}
Example #7
0
void AssignNameOverlay::showOnIndex(const QModelIndex& index)
{
    PersistentWidgetDelegateOverlay::showOnIndex(index);

/*
    // TODO: add again when fading in
    // see bug 228810, this is a small workaround
    if (m_widget && m_widget->isVisible() && index().isValid() && index == index())
        addTagsLineEdit()->setVisibleImmediately;
*/

    updatePosition();
    updateFace();
}
   /** Increment/decrement current texture size and regen face. */
   void incTextureSize(bool dec=false)
   {
      switch (mTextureWidth)
      {
      case 0:  mTextureWidth = (dec?0:16);  break;
      case 16:  mTextureWidth = (dec?0:32);  break;
      case 32:  mTextureWidth = (dec?16:64);  break;
      case 64:  mTextureWidth = (dec?32:128);  break;
      case 128:  mTextureWidth = (dec?64:256);  break;
      case 256:  mTextureWidth = (dec?128:512);  break;
      case 512:  mTextureWidth = (dec?256:1024);  break;
      case 1024:  mTextureWidth = (dec?512:1024);  break;
      }

      std::cout << "Setting mTextureWidth: " << mTextureWidth << std::endl;

      updateFace();
      updateScene();
   }