summaryrefslogtreecommitdiffstats
path: root/Project/VertexBufferLayout.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-08 00:22:44 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-08 00:22:44 -0300
commitfa58befffe0c0520f50cf9414c3de9949d8c0eed (patch)
tree6a545f2227229ce293c40b9911f1df7bc90dda55 /Project/VertexBufferLayout.h
parentab30228b1a57053323363674fa7f137c0329a180 (diff)
downloadPSP.git-fa58befffe0c0520f50cf9414c3de9949d8c0eed.tar.gz
PSP.git-fa58befffe0c0520f50cf9414c3de9949d8c0eed.tar.xz
PSP.git-fa58befffe0c0520f50cf9414c3de9949d8c0eed.zip
Code fixes to compile in MinGW and MSVC
CMakeLists includes
Diffstat (limited to 'Project/VertexBufferLayout.h')
-rw-r--r--Project/VertexBufferLayout.h46
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