--------------------------------- MeshSurface::c-tor Construct a surface from a mesh and material combination
| 177 | // Construct a surface from a mesh and material combination |
| 178 | // |
| 179 | MeshSurface::MeshSurface(MeshData const* const mesh, render::Material const* const material) |
| 180 | : m_Material(material) |
| 181 | { |
| 182 | ET_ASSERT(mesh != nullptr); |
| 183 | ET_ASSERT(m_Material != nullptr); |
| 184 | |
| 185 | I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext(); |
| 186 | |
| 187 | // create a new vertex array |
| 188 | m_VertexArray = api->CreateVertexArray(); |
| 189 | api->BindVertexArray(m_VertexArray); |
| 190 | |
| 191 | // link it to the mesh's buffer |
| 192 | api->BindBuffer(E_BufferType::Vertex, mesh->GetVertexBuffer()); |
| 193 | api->BindBuffer(E_BufferType::Index, mesh->GetIndexBuffer()); |
| 194 | |
| 195 | //Specify Input Layout |
| 196 | AttributeDescriptor::DefineAttributeArray(mesh->GetSupportedFlags(), m_Material->GetLayoutFlags(), m_Material->GetAttributeLocations()); |
| 197 | |
| 198 | api->BindVertexArray(0u); |
| 199 | } |
| 200 | |
| 201 | //--------------------------------- |
| 202 | // MeshSurface::d-tor |
nothing calls this directly
no test coverage detected