Give native types initial value

This commit is contained in:
Riyyi
2021-03-11 16:52:47 +01:00
parent f63bd4ab6d
commit c8cea7bf45
2 changed files with 9 additions and 11 deletions
+1 -3
View File
@@ -13,7 +13,6 @@ namespace Inferno {
m_type(type),
m_name(name),
m_size(BufferElement::getTypeSize(type)),
m_offset(0),
m_normalized(normalized)
{
}
@@ -144,14 +143,13 @@ namespace Inferno {
// -----------------------------------------
BufferLayout::BufferLayout(const std::initializer_list<BufferElement>& elements)
: m_elements(elements), m_stride(0)
: m_elements(elements)
{
calculateOffsetsAndStride();
}
void BufferLayout::calculateOffsetsAndStride()
{
m_stride = 0;
for (auto& element : m_elements) {
element.setOffset(m_stride);
m_stride += element.getSize();
+8 -8
View File
@@ -50,9 +50,9 @@ namespace Inferno {
private:
BufferElementType m_type;
std::string m_name;
uint32_t m_size;
uint32_t m_offset;
bool m_normalized;
uint32_t m_size { 0 };
uint32_t m_offset { 0 };
bool m_normalized { false };
};
// -----------------------------------------
@@ -77,7 +77,7 @@ namespace Inferno {
private:
std::vector<BufferElement> m_elements;
uint32_t m_stride;
uint32_t m_stride { 0 };
};
// -----------------------------------------
@@ -99,7 +99,7 @@ namespace Inferno {
inline void setLayout(const BufferLayout& layout) { m_layout = layout; }
private:
uint32_t m_id;
uint32_t m_id { 0 };
BufferLayout m_layout;
};
@@ -117,8 +117,8 @@ namespace Inferno {
inline uint32_t getCount() const { return m_count; }
private:
uint32_t m_id;
uint32_t m_count;
uint32_t m_id { 0 };
uint32_t m_count { 0 };
};
// -----------------------------------------
@@ -139,7 +139,7 @@ namespace Inferno {
inline std::shared_ptr<IndexBuffer> getIndexBuffer() const { return m_indexBuffer; }
private:
uint32_t m_id;
uint32_t m_id { 0 };
std::vector<std::shared_ptr<VertexBuffer>> m_vertexBuffers;
std::shared_ptr<IndexBuffer> m_indexBuffer;
};