diff --git a/src/Magnum/GL/Mesh.cpp b/src/Magnum/GL/Mesh.cpp index 0b8cf8291..d0237b5ae 100644 --- a/src/Magnum/GL/Mesh.cpp +++ b/src/Magnum/GL/Mesh.cpp @@ -204,26 +204,11 @@ std::size_t Mesh::indexSize(Magnum::MeshIndexType type) { } #endif -Mesh::Mesh(const MeshPrimitive primitive): _primitive{primitive}, _flags{ObjectFlag::DeleteOnDestruction}, _count{0}, _baseVertex{0}, _instanceCount{1}, - #ifndef MAGNUM_TARGET_GLES - _baseInstance{0}, - #endif - #ifndef MAGNUM_TARGET_GLES2 - _indexStart(0), _indexEnd(0), - #endif - _indexOffset(0), _indexType(MeshIndexType::UnsignedInt), _indexBuffer(nullptr) -{ +Mesh::Mesh(const MeshPrimitive primitive): _primitive{primitive}, _flags{ObjectFlag::DeleteOnDestruction} { (this->*Context::current().state().mesh->createImplementation)(); } -Mesh::Mesh(NoCreateT) noexcept: _id{0}, _primitive{MeshPrimitive::Triangles}, _flags{ObjectFlag::DeleteOnDestruction}, _count{0}, _baseVertex{0}, _instanceCount{1}, - #ifndef MAGNUM_TARGET_GLES - _baseInstance{0}, - #endif - #ifndef MAGNUM_TARGET_GLES2 - _indexStart(0), _indexEnd(0), - #endif - _indexOffset(0), _indexType(MeshIndexType::UnsignedInt), _indexBuffer(nullptr) {} +Mesh::Mesh(NoCreateT) noexcept: _id{0}, _primitive{MeshPrimitive::Triangles}, _flags{ObjectFlag::DeleteOnDestruction} {} Mesh::~Mesh() { /* Moved out or not deleting on destruction, nothing to do */ diff --git a/src/Magnum/GL/Mesh.h b/src/Magnum/GL/Mesh.h index 97ed299ee..8aab32ed6 100644 --- a/src/Magnum/GL/Mesh.h +++ b/src/Magnum/GL/Mesh.h @@ -1031,19 +1031,20 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject { #endif #endif + /* _id, _primitive, _flags set from constructors */ GLuint _id; MeshPrimitive _primitive; ObjectFlags _flags; - Int _count, _baseVertex, _instanceCount; + Int _count{}, _baseVertex{}, _instanceCount{1}; #ifndef MAGNUM_TARGET_GLES - UnsignedInt _baseInstance; + UnsignedInt _baseInstance{}; #endif #ifndef MAGNUM_TARGET_GLES2 - UnsignedInt _indexStart, _indexEnd; + UnsignedInt _indexStart{}, _indexEnd{}; #endif - GLintptr _indexOffset; - MeshIndexType _indexType; - Buffer* _indexBuffer; + GLintptr _indexOffset{}; + MeshIndexType _indexType{}; + Buffer* _indexBuffer{}; /* Storage for std::vector with attribute layout / attribute buffer instances. 4 pointers should be one pointer more than enough. */ diff --git a/src/Magnum/GL/MeshView.h b/src/Magnum/GL/MeshView.h index ef3c40318..f77bf3966 100644 --- a/src/Magnum/GL/MeshView.h +++ b/src/Magnum/GL/MeshView.h @@ -286,25 +286,17 @@ class MAGNUM_GL_EXPORT MeshView { std::reference_wrapper _original; - Int _count, _baseVertex, _instanceCount; + Int _count{}, _baseVertex{}, _instanceCount{1}; #ifndef MAGNUM_TARGET_GLES - UnsignedInt _baseInstance; + UnsignedInt _baseInstance{}; #endif - GLintptr _indexOffset; + GLintptr _indexOffset{}; #ifndef MAGNUM_TARGET_GLES2 - UnsignedInt _indexStart, _indexEnd; + UnsignedInt _indexStart{}, _indexEnd{}; #endif }; -inline MeshView::MeshView(Mesh& original): _original(original), _count(0), _baseVertex(0), _instanceCount{1}, - #ifndef MAGNUM_TARGET_GLES - _baseInstance{0}, - #endif - _indexOffset(0) - #ifndef MAGNUM_TARGET_GLES2 - , _indexStart(0), _indexEnd(0) - #endif - {} +inline MeshView::MeshView(Mesh& original): _original{original} {} inline MeshView& MeshView::setIndexRange(Int first, UnsignedInt start, UnsignedInt end) { setIndexRange(first);