示例#1
0
OpenGLViewAdapter::OpenGLViewAdapter(View &view) try : ViewAdapter(view),
                                                       Observer(),
                                                       scene_settings_(),
                                                       scene_renderer_(scene_settings_),
                                                       lights_handler_(scene_renderer_, camera_),
                                                       selection_set_(view.GetSelectionSet()),
                                                       model_handler_(nullptr)
{
    view_.Observe(
        ViewEvent::ATTACH_MODEL, std::bind(&OpenGLViewAdapter::AttachModel, this, std::placeholders::_1), this);

    view_.Observe(
        ViewEvent::DETACH_MODEL, std::bind(&OpenGLViewAdapter::DetachModel, this, std::placeholders::_1), this);

    view_.Observe(
        ViewEvent::WINDOW_RESIZE, std::bind(&OpenGLViewAdapter::WindowResize, this, std::placeholders::_1), this);

    // View settings changes
    view_.Observe(ViewEvent::VIEWER_SETTINGS_CHANGE,
                  std::bind(&OpenGLViewAdapter::ViewerSettingsChange, this, std::placeholders::_1),
                  this);

    // Selections
    selection_set_.Observe(SelectionSetEvent::CALCULATE_SELECTION,
                           std::bind(&OpenGLViewAdapter::CalculateSelection, this, std::placeholders::_1),
                           this);
}
catch(CustomExp e)
{
    throw e;
}