Optimized VertexDeclaration::GetElement
Former-commit-id: a56498837ae2f6101e0641aab23b2d1d0f9130f3
This commit is contained in:
parent
8132812c23
commit
93a1738c55
|
|
@ -244,7 +244,6 @@ const NzVertexElement* NzVertexDeclaration::GetElement(nzElementStream stream, n
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int elementPos = m_sharedImpl->elementPos[stream][usage];
|
int elementPos = m_sharedImpl->elementPos[stream][usage];
|
||||||
|
|
||||||
#if NAZARA_UTILITY_SAFE
|
#if NAZARA_UTILITY_SAFE
|
||||||
if (elementPos == -1)
|
if (elementPos == -1)
|
||||||
{
|
{
|
||||||
|
|
@ -253,27 +252,32 @@ const NzVertexElement* NzVertexDeclaration::GetElement(nzElementStream stream, n
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
elementPos += usageIndex;
|
if (usageIndex == 0) // Si l'usage index vaut zéro, alors nous sommes certains d'être sur le bon élément (Majorité des cas)
|
||||||
|
return &m_sharedImpl->elements[elementPos];
|
||||||
#if NAZARA_UTILITY_SAFE
|
else
|
||||||
if (static_cast<unsigned int>(elementPos) >= m_sharedImpl->elements.size())
|
|
||||||
{
|
{
|
||||||
NazaraError("Element not found");
|
elementPos += usageIndex;
|
||||||
return nullptr;
|
|
||||||
|
#if NAZARA_UTILITY_SAFE
|
||||||
|
if (static_cast<unsigned int>(elementPos) >= m_sharedImpl->elements.size())
|
||||||
|
{
|
||||||
|
NazaraError("Element not found");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NzVertexElement& element = m_sharedImpl->elements[elementPos];
|
||||||
|
|
||||||
|
#if NAZARA_UTILITY_SAFE
|
||||||
|
if (element.stream != stream || element.usage != usage || element.usageIndex != usageIndex)
|
||||||
|
{
|
||||||
|
NazaraError("Element not found");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return &element;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NzVertexElement& element = m_sharedImpl->elements[elementPos];
|
|
||||||
|
|
||||||
#if NAZARA_UTILITY_SAFE
|
|
||||||
if (element.stream != stream || element.usage != usage || element.usageIndex != usageIndex)
|
|
||||||
{
|
|
||||||
NazaraError("Element not found");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return &element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int NzVertexDeclaration::GetElementCount() const
|
unsigned int NzVertexDeclaration::GetElementCount() const
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue