Ejemplo n.º 1
0
void Renderer::render(const RenderQueue& queue, const Camera& camera)
{
  ProfileNodeCall call("Renderer::render");

  m_context.setCurrentSharedProgramState(m_state);

  const Recti& viewportArea = m_context.viewportArea();
  m_state->setViewportSize(float(viewportArea.size.x),
                           float(viewportArea.size.y));

  m_state->setProjectionMatrix(camera.projectionMatrix());
  m_state->setViewMatrix(camera.viewTransform());

  if (camera.isPerspective())
  {
    m_state->setCameraProperties(camera.transform().position,
                                 camera.FOV(),
                                 camera.aspectRatio(),
                                 camera.nearZ(),
                                 camera.farZ());
  }

  renderOperations(queue.opaqueBucket());
  renderOperations(queue.blendedBucket());

  m_context.setCurrentSharedProgramState(nullptr);
}
Ejemplo n.º 2
0
void Renderer::render(const render::Scene& scene, const Camera& camera)
{
  ProfileNodeCall call("forward::Renderer::render");

  GL::Context& context = getContext();
  context.setCurrentSharedProgramState(state);

  const Recti& viewportArea = context.getViewportArea();
  state->setViewportSize(float(viewportArea.size.x),
                         float(viewportArea.size.y));

  state->setProjectionMatrix(camera.getProjectionMatrix());
  state->setViewMatrix(camera.getViewTransform());

  if (camera.isPerspective())
  {
    state->setCameraProperties(camera.getTransform().position,
                               camera.getFOV(),
                               camera.getAspectRatio(),
                               camera.getNearZ(),
                               camera.getFarZ());
  }

  renderOperations(scene.getOpaqueQueue());
  renderOperations(scene.getBlendedQueue());

  context.setCurrentSharedProgramState(NULL);

  releaseObjects();
}