Add VertexDeclaration::Find to return type from ptr
This commit is contained in:
@@ -53,6 +53,7 @@ namespace Nz
|
|||||||
VertexDeclaration& operator=(VertexDeclaration&&) = delete;
|
VertexDeclaration& operator=(VertexDeclaration&&) = delete;
|
||||||
|
|
||||||
static inline const std::shared_ptr<VertexDeclaration>& Get(VertexLayout layout);
|
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);
|
static bool IsTypeSupported(ComponentType type);
|
||||||
|
|
||||||
struct Component
|
struct Component
|
||||||
|
|||||||
@@ -75,5 +75,15 @@ namespace Nz
|
|||||||
NazaraAssert(layout <= VertexLayout::Max, "Vertex layout out of enum");
|
NazaraAssert(layout <= VertexLayout::Max, "Vertex layout out of enum");
|
||||||
return s_declarations[layout];
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user