MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Attribute

Method Attribute

Source/Engine/Graphics/Models/MeshBase.cpp:384–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384MeshAccessor::Stream MeshAccessor::Attribute(VertexElement::Types attribute)
385{
386 Span<byte> data;
387 PixelFormat format = PixelFormat::Unknown;
388 int32 stride = 0, count = 0;
389 for (int32 vbIndex = 0; vbIndex < 3 && format == PixelFormat::Unknown; vbIndex++)
390 {
391 static_assert((int32)MeshBufferType::Vertex0 == 1, "Update code.");
392 const int32 idx = vbIndex + 1;
393 auto layout = _layouts[idx];
394 if (!layout)
395 continue;
396 for (const VertexElement& e : layout->GetElements())
397 {
398 auto& vb = _data[idx];
399 if (e.Type == attribute && vb.IsValid())
400 {
401 data = vb.Slice(e.Offset);
402 format = e.Format;
403 stride = layout->GetStride();
404 count = vb.Length() / stride;
405 break;
406 }
407 }
408 }
409 return Stream(data, format, stride, count);
410}
411
412MeshBase::~MeshBase()
413{

Callers 1

DeployNuGetPackageMethod · 0.45

Calls 5

SliceMethod · 0.80
GetStrideMethod · 0.80
StreamClass · 0.70
IsValidMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected