Exemple #1
0
/* \brief update the camera */
GLHCKAPI void glhckCameraUpdate(glhckCamera *object)
{
   CALL(2, "%p", object);

   /* bind none */
   if (!object) {
      GLHCKRD()->camera = NULL;
      return;
   }

   if (GLHCKRD()->camera != object || object->view.updateViewport) {
      glhckRenderViewport(&object->view.viewport);
      object->view.updateViewport = 0;
   }

   if (object->view.update || object->object->view.update) {
      if (object->view.projectionType == GLHCK_PROJECTION_ORTHOGRAPHIC)
	 _glhckCameraProjectionMatrix(object);
      _glhckCameraViewMatrix(object);
      object->view.update = 0;
   }

   /* assign camera to global state */
   glhckRenderFlip(0);
   glhckRenderProjection(&object->view.projection);
   glhckRenderView(&object->view.view);
   GLHCKRD()->camera = object;
}
Exemple #2
0
/* \brief pop render state from stack */
GLHCKAPI void glhckRenderStatePop(void)
{
   __GLHCKrenderState *state, *newState;

   if (!(state = GLHCKR()->stack))
      return;

   glhckRenderResize(state->width, state->height);
   memcpy(&GLHCKR()->pass, &state->pass, sizeof(__GLHCKrenderPass));
   glhckRenderClearColor(&state->pass.clearColor);
   glhckRenderViewport(&state->pass.viewport);

   glhckRenderProjection(&state->view.projection);
   glhckRenderView(&state->view.view);
   GLHCKRA()->setOrthographic(&state->view.orthographic);
   memcpy(&GLHCKRD()->view.orthographic, &state->view.orthographic, sizeof(kmMat4));
   glhckRenderFlip(state->view.flippedProjection);

   newState = (state?state->next:NULL);
   IFDO(_glhckFree, state);
   GLHCKR()->stack = newState;
}
Exemple #3
0
/* \brief set renderer's viewport (int) */
GLHCKAPI void glhckRenderViewporti(int x, int y, int width, int height)
{
   glhckRect viewport = {x, y, width, height};
   glhckRenderViewport(&viewport);
}