Add VertexDeclaration::Find to return type from ptr
This commit is contained in:
parent
8c3e8956ca
commit
4d15cbcc2b
|
|
@ -53,6 +53,7 @@ namespace Nz
|
|||
VertexDeclaration& operator=(VertexDeclaration&&) = delete;
|
||||
|
||||
static inline const std::shared_ptr<VertexDeclaration>& Get(VertexLayout layout);
|
||||
static inline const VertexLayout Find(const std::shared_ptr<VertexDeclaration>& declaration);
|
||||
static bool IsTypeSupported(ComponentType type);
|
||||
|
||||
struct Component
|
||||
|
|
|
|||
|
|
@ -75,5 +75,15 @@ namespace Nz
|
|||
NazaraAssert(layout <= VertexLayout::Max, "Vertex layout out of enum");
|
||||
return s_declarations[layout];
|
||||
}
|
||||
|
||||
inline const VertexLayout VertexDeclaration::Find(const std::shared_ptr<VertexDeclaration>& declaration)
|
||||
{
|
||||
for (size_t i = 0; i < (size_t)VertexLayout::Max; ++i)
|
||||
if (s_declarations[(VertexLayout)i].get() == declaration.get())
|
||||
return (VertexLayout)i;
|
||||
|
||||
NazaraAssert(declaration, "Invalid declaration");
|
||||
return VertexLayout::Max;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue