diff options
Diffstat (limited to 'Project/VertexBufferLayout.h')
-rw-r--r-- | Project/VertexBufferLayout.h | 46 |
1 files changed, 25 insertions, 21 deletions
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<typename T> void Push(unsigned int count) { +#ifdef _MSC_VER static_assert(false); - } - - template<> - void Push<float>(unsigned int count) - { - m_elements.push_back({ GL_FLOAT, count, GL_FALSE }); - m_stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT); - } - - template<> - void Push<unsigned int>(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 char>(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<VertexBufferElement> GetElements() const& { return m_elements; } @@ -69,4 +52,25 @@ private: unsigned int m_stride; }; +template<> inline +void VertexBufferLayout::Push<float>(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>(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 char>(unsigned int count) +{ + m_elements.push_back({ GL_UNSIGNED_BYTE, count, GL_TRUE }); + m_stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE); +} + #endif // VERTEXBUFFERLAYOUT_H |