| 38 | } |
| 39 | |
| 40 | void FrameBuffer::Initialize() |
| 41 | { |
| 42 | I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext(); |
| 43 | |
| 44 | //Load and compile Shaders |
| 45 | m_pShader = core::ResourceManager::Instance()->GetAssetData<ShaderData>(core::HashString(core::FileUtil::ExtractName(m_ShaderFile).c_str())); |
| 46 | |
| 47 | //GetAccessTo shader attributes |
| 48 | api->SetShader(m_pShader.get()); |
| 49 | AccessShaderAttributes(); |
| 50 | |
| 51 | //FrameBuffer |
| 52 | api->GenFramebuffers(1, &m_GlFrameBuffer); |
| 53 | |
| 54 | GenerateFramebufferTextures(); |
| 55 | |
| 56 | ET_ASSERT(api->IsFramebufferComplete(), "Creating framebuffer failed!"); |
| 57 | |
| 58 | m_VPCallbackId = Viewport::GetCurrentViewport()->GetEventDispatcher().Register(render::E_ViewportEvent::VP_Resized, render::T_ViewportEventCallback( |
| 59 | [this](render::T_ViewportEventFlags const, render::ViewportEventData const* const) -> void |
| 60 | { |
| 61 | ResizeFramebufferTextures(); |
| 62 | })); |
| 63 | } |
| 64 | |
| 65 | void FrameBuffer::AccessShaderAttributes() |
| 66 | { |
nothing calls this directly
no test coverage detected