//----------------------------------------------------------------------------
bool vesKiwiImageWidgetRepresentation::handleDoubleTap(int displayX, int displayY)
{
  vesNotUsed(displayX);
  vesNotUsed(displayY);

  return false;
}
//----------------------------------------------------------------------------
bool vesKiwiStreamingDataRepresentation::handleSingleTouchTap(int displayX, int displayY)
{
  vesNotUsed(displayX);
  vesNotUsed(displayY);

  return false;
}
Example #3
0
void vesActor::ascend(vesVisitor &visitor)
{
  assert(this->m_mapper);

  // \todo: Implement this.
  vesNotUsed(visitor);
}
void vesKiwiCameraTransition::didEnd(bool finishedEarly)
{
  vesNotUsed(finishedEarly);
  // Reset the duration so that if we're called again
  // things don't go increasingly quickly.
  this->mDuration = this->mUnmodulatedDuration;
}
Example #5
0
void vesViewport::render(vesRenderState &renderState)
{
  vesNotUsed(renderState);

  glViewport(static_cast<GLint>(this->m_x), static_cast<GLint>(this->m_y),
             static_cast<GLsizei>(this->m_width), static_cast<GLsizei>(this->m_height));
}
Example #6
0
//----------------------------------------------------------------------------
void vesKiwiViewerApp::setBackgroundTexture(const std::string& filename)
{
  vesNotUsed(filename);
  //vtkSmartPointer<vtkImageData> image =
  // vtkImageData::SafeDownCast(this->Internal->DataLoader.loadDataset(filename));
  //vesTexture* backgroundTexture = this->newTextureFromImage(image);
  //this->renderer()->SetBackground(backgroundTexture);
}
//----------------------------------------------------------------------------
bool vesKiwiBrainAtlasRepresentation::handleLongPress(int displayX, int displayY)
{
  vesNotUsed(displayX);
  vesNotUsed(displayY);

  this->deselectModel();

  // show all models
  for (size_t i = 0; i < this->Internal->AnatomicalModels.size(); ++i) {
    if (!this->Internal->ModelStatus[i]) {
      this->Internal->AnatomicalModels[i]->addSelfToRenderer(this->renderer());
      this->Internal->ModelStatus[i] = true;
      this->Internal->ModelSceneStatus[i] = true;
    }
  }

  return true;
}
//----------------------------------------------------------------------------
void vesKiwiStreamingDataRepresentation::willRender(vesSharedPtr<vesRenderer> renderer)
{
  vesNotUsed(renderer);

  this->Internal->Lock->Lock();

  if (this->Internal->HaveNew) {
    this->Internal->PolyDataRep->mapper()->setGeometryData(this->Internal->GeometryData);
    this->Internal->HaveNew = false;
  }

  this->Internal->Lock->Unlock();
}
//----------------------------------------------------------------------------
bool vesKiwiAnimationRepresentation::handleSingleTouchDown(int displayX, int displayY)
{
  vesNotUsed(displayY);

  int cornerSize = 50;
  if (displayX < cornerSize) {

    this->Internal->InteractionDelta = 0;
    this->interactionOn();
    return true;
  }

  return false;
}
Example #10
0
bool vesActor::computeLocalToWorldMatrix(vesMatrix4x4f &matrix,
                                         vesVisitor &visitor)
{
  vesNotUsed(visitor);

  if (this->m_referenceFrame == Absolute) {
    matrix = this->modelViewMatrix();
  }
  else  {
    matrix = matrix * this->modelViewMatrix();
  }

  return true;
}
Example #11
0
void vesMapper::setupDrawObjects(const vesRenderState &renderState)
{
  vesNotUsed(renderState);

  // Delete buffer objects from past if any.
  this->deleteVertexBufferObjects();

  // Now clean up any cache related to draw objects.
  this->m_internal->cleanUpDrawObjects();

  // Now construct the new ones.
  this->createVertexBufferObjects();

  this->m_initialized = true;
}
Example #12
0
bool vesActor::computeWorldToLocalMatrix(vesMatrix4x4f &matrix,
                                         vesVisitor &visitor)
{
  vesNotUsed(visitor);

  vesMatrix4x4f inverseMatrix = this->modelViewMatrix().inverse();

  if (this->m_referenceFrame == Absolute) {
    matrix  = inverseMatrix;
  }
  else {
    matrix = inverseMatrix * matrix;
  }

  return true;
}
//----------------------------------------------------------------------------
bool vesKiwiAnimationRepresentation::handleSingleTouchPanGesture(double deltaX, double deltaY)
{
  vesNotUsed(deltaX);

  if (!this->interactionIsActive()) {
    return false;
  }


  if (this->Internal->PlayMode) {

    double delta = deltaY *= -1;
    this->Internal->AnimationFramesPerSecond += delta * 0.1;

    if (this->Internal->AnimationFramesPerSecond > 120) {
      this->Internal->AnimationFramesPerSecond = 120;
    }
    else if (this->Internal->AnimationFramesPerSecond <= 1) {
      this->Internal->AnimationFramesPerSecond = 1;
    }

  }
  else {

    double delta = deltaY;
    int currentFrame = this->Internal->CurrentFrame;
    if (currentFrame >= this->Internal->NumberOfFrames-1 && delta > 0) {
      return true;
    }
    else if (currentFrame <= 0 && delta < 0) {
      return true;
    }

    this->Internal->InteractionDelta += delta * 0.1;
    int deltaFrames = static_cast<int>(this->Internal->InteractionDelta);
    if (deltaFrames != 0) {
      this->Internal->InteractionDelta = 0;
      currentFrame += deltaFrames;
      int maxFrameIndex = this->Internal->NumberOfFrames - 1;
      currentFrame = currentFrame > maxFrameIndex ? maxFrameIndex : (currentFrame < 0 ? 0 : currentFrame);
      this->Internal->CurrentFrame = currentFrame;
    }
  }


  return true;
}
//----------------------------------------------------------------------------
void vesKiwiAnimationRepresentation::willRender(vesSharedPtr<vesRenderer> renderer)
{
  vesNotUsed(renderer);

  if (this->Internal->PlayMode) {

    double currentTime = vtkTimerLog::GetUniversalTime();
    double elapsedTime = currentTime - this->Internal->AnimationT0;

    double animationFramesPerSecond = this->Internal->AnimationFramesPerSecond;

    int elapsedFrames = static_cast<int>(elapsedTime * animationFramesPerSecond);

    if (elapsedFrames != 0) {
      this->Internal->CurrentFrame += elapsedFrames;
      this->Internal->CurrentFrame = this->Internal->CurrentFrame % this->Internal->NumberOfFrames;
      this->Internal->AnimationT0 = currentTime;
    }
  }

  int screenHeight = this->renderer()->height();
  double margin = 10;
  vesVector2f textSize = this->Internal->PlayRep->textureSize();
  this->Internal->PlayRep->setDisplayPosition(vesVector2f(margin, screenHeight - (margin + textSize[1])));


  if (this->Internal->LastFrame != this->Internal->CurrentFrame) {

    std::stringstream str;
    str.precision(4);
    str << "Time: " << std::fixed << 0.0001*this->Internal->CurrentFrame << " s";
    this->Internal->TextRep->setText(str.str());

    this->Internal->FrameReps[this->Internal->LastFrame]->removeSelfFromRenderer(this->renderer());
    this->Internal->FrameReps[this->Internal->CurrentFrame]->addSelfToRenderer(this->renderer());
    this->Internal->LastFrame = this->Internal->CurrentFrame;
  }
}
//----------------------------------------------------------------------------
void vesKiwiImageWidgetRepresentation::willRender(vesSharedPtr<vesRenderer> renderer)
{
  vesNotUsed(renderer);

  if (this->Internal->TargetSliceIndex.size()) {

    std::map<int, int>::const_iterator itr;
    for (itr = this->Internal->TargetSliceIndex.begin(); itr != this->Internal->TargetSliceIndex.end(); ++itr) {
      this->setSliceIndex(itr->first, itr->second);
    }

    this->Internal->TargetSliceIndex.clear();
  }

  if (this->Internal->RefreshTextures) {
    for (int i = 0; i < 3; ++i) {
      vtkImageData* imageData = this->Internal->SliceReps[i]->imageData();
      if (imageData && this->planeVisibility(i)) {
        this->Internal->SliceReps[i]->setImageData(imageData);
      }
    }
    this->Internal->RefreshTextures = false;
  }
}
Example #16
0
static void
event_loop(Display *dpy, Window win,
           EGLDisplay egl_dpy, EGLSurface egl_surf)
{
  vesNotUsed(win);

   while (1) {
      int redraw = 0;
      XEvent event;

      XNextEvent(dpy, &event);

      switch (event.type) {
      case Expose:
         redraw = 1;
         break;
      case ConfigureNotify:
         testHelper->app()->resizeView(event.xconfigure.width, event.xconfigure.height);
         break;

      case ButtonPress:
        testHelper->app()->handleSingleTouchDown(event.xbutton.x, event.xbutton.y);

        haveLastMotion = true;
        lastMotionX = event.xbutton.x;
        lastMotionY = event.xbutton.y;
        redraw = 1;
        break;

      case ButtonRelease:
        testHelper->app()->handleSingleTouchUp();
        haveLastMotion = false;
        redraw = 1;
        break;

      case MotionNotify:

        if (haveLastMotion) {
          currentX = event.xmotion.x;
          currentY = event.xmotion.y;
          testHelper->app()->handleSingleTouchPanGesture(currentX - lastMotionX, currentY - lastMotionY);
          lastMotionX = currentX;
          lastMotionY = currentY;
          redraw = 1;
        }
        break;

      case KeyPress:
         {
            int panDelta = 100;
            char buffer[10];
            int r, code;
            code = XLookupKeysym(&event.xkey, 0);
            if (code == XK_Left) {
              testHelper->app()->handleSingleTouchPanGesture(-panDelta, 0);
            }
            else if (code == XK_Right) {
              testHelper->app()->handleSingleTouchPanGesture(panDelta, 0);
            }
            else if (code == XK_Up) {
              testHelper->app()->handleSingleTouchPanGesture(0, -panDelta);
            }
            else if (code == XK_Down) {
              testHelper->app()->handleSingleTouchPanGesture(0, panDelta);
            }
            else {
               r = XLookupString(&event.xkey, buffer, sizeof(buffer),
                                 NULL, NULL);
               if (buffer[0] == 27) {
                  /* escape */
                  return;
               }
               if (buffer[0] == 't') {
                 static int currentShadingModelIndex =
                   testHelper->app()->getNumberOfShadingModels() - 1;

                 currentShadingModelIndex = (currentShadingModelIndex + 1) %
                   testHelper->app()->getNumberOfShadingModels();

                 testHelper->app()->setShadingModel(testHelper->app()->getShadingModel(
                    currentShadingModelIndex));
               }
               else if (buffer[0] == 'n') {
                 static int currentDataset = 0;
                 currentDataset = (currentDataset + 1) % testHelper->app()->numberOfBuiltinDatasets();
                 LoadData(currentDataset);
               }
               else if (buffer[0] == 'r') {
                 testHelper->app()->resetView();
               }
            }
         }
         redraw = 1;
         break;
      default:
         ; /*no-op*/
      }

      if (redraw) {
         testHelper->app()->render();
         eglSwapBuffers(egl_dpy, egl_surf);
      }
   }
}
Example #17
0
void vesUniform::update(const vesRenderState   &renderState,
                        const vesShaderProgram &program)
{
  vesNotUsed(renderState);
  vesNotUsed(program);
}
Example #18
0
void vesShaderProgram::setup(const vesRenderState &renderState)
{
    vesNotUsed(renderState);
}
//----------------------------------------------------------------------------
bool vesKiwiWidgetRepresentation::handleSingleTouchDown(int displayX, int displayY)
{
  vesNotUsed(displayX);
  vesNotUsed(displayY);
  return false;
}
//----------------------------------------------------------------------------
void vesKiwiViewerApp::checkForAdditionalData(const std::string& dirname)
{
  vesNotUsed(dirname);
}
//----------------------------------------------------------------------------
bool vesKiwiWidgetRepresentation::handleAction(const std::string& action)
{
  vesNotUsed(action);
  return false;
}
//----------------------------------------------------------------------------
void vesKiwiWidgetRepresentation::removeSelfFromRenderer(vesSharedPtr<vesRenderer> renderer)
{
  vesNotUsed(renderer);
  this->m_renderer.reset();
}
//----------------------------------------------------------------------------
bool vesKiwiStreamingDataRepresentation::handleSingleTouchPanGesture(double deltaX, double deltaY)
{
  vesNotUsed(deltaX);
  vesNotUsed(deltaY);
  return false;
}
Example #24
0
void vesShaderProgram::unbind(const vesRenderState &renderState)
{
    // \todo: Implement this.
    vesNotUsed(renderState);
}
//----------------------------------------------------------------------------
bool vesKiwiWidgetRepresentation::handleLongPress(int displayX, int displayY)
{
  vesNotUsed(displayX);
  vesNotUsed(displayY);
  return false;
}