From fa58befffe0c0520f50cf9414c3de9949d8c0eed Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Wed, 8 Jul 2020 00:22:44 -0300 Subject: Code fixes to compile in MinGW and MSVC CMakeLists includes --- Project/VertexBufferLayout.h | 46 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'Project/VertexBufferLayout.h') diff --git a/Project/VertexBufferLayout.h b/Project/VertexBufferLayout.h index d50b19c..7d527d1 100644 --- a/Project/VertexBufferLayout.h +++ b/Project/VertexBufferLayout.h @@ -21,7 +21,9 @@ struct VertexBufferElement case GL_UNSIGNED_BYTE: return 1; default: break; } +#ifdef _MSC_VER ASSERT(false); +#endif return(0); } }; @@ -37,28 +39,9 @@ public: template void Push(unsigned int count) { +#ifdef _MSC_VER static_assert(false); - } - - template<> - void Push(unsigned int count) - { - m_elements.push_back({ GL_FLOAT, count, GL_FALSE }); - m_stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT); - } - - template<> - void Push(unsigned int count) - { - m_elements.push_back({ GL_UNSIGNED_INT, count, GL_FALSE }); - m_stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_INT); - } - - template<> - void Push(unsigned int count) - { - m_elements.push_back({ GL_UNSIGNED_BYTE, count, GL_TRUE }); - m_stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE); +#endif } inline const std::vector GetElements() const& { return m_elements; } @@ -69,4 +52,25 @@ private: unsigned int m_stride; }; +template<> inline +void VertexBufferLayout::Push(unsigned int count) +{ + m_elements.push_back({ GL_FLOAT, count, GL_FALSE }); + m_stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT); +} + +template<> inline +void VertexBufferLayout::Push(unsigned int count) +{ + m_elements.push_back({ GL_UNSIGNED_INT, count, GL_FALSE }); + m_stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_INT); +} + +template<> inline +void VertexBufferLayout::Push(unsigned int count) +{ + m_elements.push_back({ GL_UNSIGNED_BYTE, count, GL_TRUE }); + m_stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE); +} + #endif // VERTEXBUFFERLAYOUT_H -- cgit