MCPcopy Create free account
hub / github.com/Illation/ETEngine / MeshSurface

Method MeshSurface

Engine/source/EtRendering/GraphicsTypes/Mesh.cpp:179–199  ·  view source on GitHub ↗

--------------------------------- MeshSurface::c-tor Construct a surface from a mesh and material combination

Source from the content-addressed store, hash-verified

177// Construct a surface from a mesh and material combination
178//
179MeshSurface::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

Callers

nothing calls this directly

Calls 7

CreateVertexArrayMethod · 0.80
BindVertexArrayMethod · 0.80
BindBufferMethod · 0.80
GetVertexBufferMethod · 0.80
GetIndexBufferMethod · 0.80
GetSupportedFlagsMethod · 0.80
GetLayoutFlagsMethod · 0.80

Tested by

no test coverage detected