| 22 | } |
| 23 | |
| 24 | void DebugRenderer::Initialize() |
| 25 | { |
| 26 | I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext(); |
| 27 | |
| 28 | m_pShader = core::ResourceManager::Instance()->GetAssetData<ShaderData>(core::HashString("DebugRenderer.glsl")); |
| 29 | |
| 30 | api->SetShader(m_pShader.get()); |
| 31 | |
| 32 | //Generate buffers and arrays |
| 33 | m_VAO = api->CreateVertexArray(); |
| 34 | m_VBO = api->CreateBuffer(); |
| 35 | |
| 36 | //bind |
| 37 | api->BindVertexArray(m_VAO); |
| 38 | api->BindBuffer(E_BufferType::Vertex, m_VBO); |
| 39 | |
| 40 | //set data and attributes |
| 41 | api->SetBufferData(E_BufferType::Vertex, m_BufferSize, nullptr, E_UsageHint::Dynamic); |
| 42 | |
| 43 | //input layout |
| 44 | api->SetVertexAttributeArrayEnabled(0, true); |
| 45 | api->SetVertexAttributeArrayEnabled(1, true); |
| 46 | |
| 47 | api->DefineVertexAttributePointer(0, 3, E_DataType::Float, false, sizeof(LineVertex), offsetof(LineVertex, pos)); |
| 48 | api->DefineVertexAttributePointer(1, 4, E_DataType::Float, false, sizeof(LineVertex), offsetof(LineVertex, col)); |
| 49 | |
| 50 | //unbind |
| 51 | api->BindBuffer(E_BufferType::Vertex, 0); |
| 52 | api->BindVertexArray(0); |
| 53 | } |
| 54 | |
| 55 | void DebugRenderer::UpdateBuffer() |
| 56 | { |
nothing calls this directly
no test coverage detected