Example #1
0
  void Graphics::Initialize()
  {

    
    
    WickedSick::Window* window = core_->GetSystem<WickedSick::Window>(ST_Window);
    std::lock_guard<std::mutex> lk(window->GetWindowHandleMutex());

    graphicsAPI->Initialize(options_, window);

    // Setup the projection matrix.
    float fieldOfView = (float)PI / 2.0f;//90 degrees
    float screenAspect = (float)window->GetWindowSize().x / (float)window->GetWindowSize().y;

    // Create the projection matrix for 3D rendering.
    projection_matrix_.DoPerspective(90.0 * PI/180.0, 0.1f, 100000.0f, screenAspect);
    orthographic_matrix_.DoOrthographic(window->GetWindowSize().x, window->GetWindowSize().y, 0.1f, 100000.0f);
    camera_->SetPosition(0.0f, 0.0f, 0.0f);

    mat_stack_->Push(projection_matrix_);
    
    RenderTargetDesc desc;
    desc.size = window->GetWindowSize();
    
    RenderTarget* reflectionTarget = nullptr;
    for(int i = 0; i < ReflectionDirections::Count; ++i)
    {
      reflectionTarget = graphicsAPI->MakeRenderTarget(desc);
      reflectionTarget->Initialize();
      render_targets_.push_back(reflectionTarget);
    }
  }