From 58270fe9f08114418a66c363989e43764f590991 Mon Sep 17 00:00:00 2001 From: Alice Margatroid Date: Fri, 31 Mar 2017 10:11:33 -0400 Subject: [PATCH] push_back -> emplace_back --- src/Magnum/Context.cpp | 4 +-- src/Magnum/Implementation/BufferState.cpp | 10 +++---- src/Magnum/Implementation/DebugState.cpp | 8 +++--- .../Implementation/FramebufferState.cpp | 8 +++--- src/Magnum/Implementation/MeshState.cpp | 6 ++-- src/Magnum/Implementation/QueryState.cpp | 2 +- src/Magnum/Implementation/RendererState.cpp | 4 +-- .../Implementation/ShaderProgramState.cpp | 4 +-- src/Magnum/Implementation/TextureState.cpp | 20 ++++++------- .../Implementation/TransformFeedbackState.cpp | 2 +- .../Primitives/Implementation/Spheroid.cpp | 28 +++++++++---------- src/Magnum/Shader.cpp | 28 +++++++++---------- src/MagnumPlugins/ObjImporter/ObjImporter.cpp | 14 +++++----- 13 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index 0e74a549a..1fc54918a 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -736,7 +736,7 @@ std::vector Context::shadingLanguageVersionStrings() const { std::vector versions; versions.reserve(versionCount); for(GLint i = 0; i != versionCount; ++i) - versions.push_back(reinterpret_cast(glGetStringi(GL_SHADING_LANGUAGE_VERSION, i))); + versions.emplace_back(reinterpret_cast(glGetStringi(GL_SHADING_LANGUAGE_VERSION, i))); return versions; #else return {shadingLanguageVersionString()}; @@ -755,7 +755,7 @@ std::vector Context::extensionStrings() const { { extensions.reserve(extensionCount); for(GLint i = 0; i != extensionCount; ++i) - extensions.push_back(reinterpret_cast(glGetStringi(GL_EXTENSIONS, i))); + extensions.emplace_back(reinterpret_cast(glGetStringi(GL_EXTENSIONS, i))); } #ifndef MAGNUM_TARGET_GLES3 else diff --git a/src/Magnum/Implementation/BufferState.cpp b/src/Magnum/Implementation/BufferState.cpp index b578c6ef5..1bc239bae 100644 --- a/src/Magnum/Implementation/BufferState.cpp +++ b/src/Magnum/Implementation/BufferState.cpp @@ -96,7 +96,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) /* Create implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &Buffer::createImplementationDSA; } else @@ -107,7 +107,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); copyImplementation = &Buffer::copyImplementationDSA; getParameterImplementation = &Buffer::getParameterImplementationDSA; @@ -119,7 +119,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) flushMappedRangeImplementation = &Buffer::flushMappedRangeImplementationDSA; unmapImplementation = &Buffer::unmapImplementationDSA; } else if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::EXT::direct_state_access::string()); copyImplementation = &Buffer::copyImplementationDSAEXT; getParameterImplementation = &Buffer::getParameterImplementationDSAEXT; @@ -152,7 +152,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::invalidate_subdata::string()); + extensions.emplace_back(Extensions::GL::ARB::invalidate_subdata::string()); invalidateImplementation = &Buffer::invalidateImplementationARB; invalidateSubImplementation = &Buffer::invalidateSubImplementationARB; @@ -166,7 +166,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::multi_bind::string()); + extensions.emplace_back(Extensions::GL::ARB::multi_bind::string()); bindBasesImplementation = &Buffer::bindImplementationMulti; bindRangesImplementation = &Buffer::bindImplementationMulti; diff --git a/src/Magnum/Implementation/DebugState.cpp b/src/Magnum/Implementation/DebugState.cpp index c882e8b01..b3d30d1ff 100644 --- a/src/Magnum/Implementation/DebugState.cpp +++ b/src/Magnum/Implementation/DebugState.cpp @@ -39,7 +39,7 @@ DebugState::DebugState(Context& context, std::vector& extensions): messageCallback(nullptr) { if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::KHR::debug::string()); + extensions.emplace_back(Extensions::GL::KHR::debug::string()); getLabelImplementation = &AbstractObject::getLabelImplementationKhr; labelImplementation = &AbstractObject::labelImplementationKhr; @@ -51,7 +51,7 @@ DebugState::DebugState(Context& context, std::vector& extensions): } else { if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::debug_label::string()); + extensions.emplace_back(Extensions::GL::EXT::debug_label::string()); getLabelImplementation = &AbstractObject::getLabelImplementationExt; labelImplementation = &AbstractObject::labelImplementationExt; @@ -61,14 +61,14 @@ DebugState::DebugState(Context& context, std::vector& extensions): } if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::debug_marker::string()); + extensions.emplace_back(Extensions::GL::EXT::debug_marker::string()); pushGroupImplementation = &DebugGroup::pushImplementationExt; popGroupImplementation = &DebugGroup::popImplementationExt; messageInsertImplementation = &DebugMessage::insertImplementationExt; #ifndef MAGNUM_TARGET_GLES } else if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::GREMEDY::string_marker::string()); + extensions.emplace_back(Extensions::GL::GREMEDY::string_marker::string()); pushGroupImplementation = &DebugGroup::pushImplementationNoOp; popGroupImplementation = &DebugGroup::popImplementationNoOp; diff --git a/src/Magnum/Implementation/FramebufferState.cpp b/src/Magnum/Implementation/FramebufferState.cpp index f8f7d57e5..96adf3a54 100644 --- a/src/Magnum/Implementation/FramebufferState.cpp +++ b/src/Magnum/Implementation/FramebufferState.cpp @@ -47,7 +47,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e /* Create implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &Framebuffer::createImplementationDSA; createRenderbufferImplementation = &Renderbuffer::createImplementationDSA; @@ -86,7 +86,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e renderbufferStorageImplementation = &Renderbuffer::storageImplementationDSA; } else if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::EXT::direct_state_access::string()); checkStatusImplementation = &AbstractFramebuffer::checkStatusImplementationDSAEXT; drawBuffersImplementation = &AbstractFramebuffer::drawBuffersImplementationDSAEXT; @@ -211,7 +211,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e #endif { #ifndef MAGNUM_TARGET_GLES - extensions.push_back(Extensions::GL::ARB::robustness::string()); + extensions.emplace_back(Extensions::GL::ARB::robustness::string()); #else extensions.push_back(Extensions::GL::EXT::robustness::string()); #endif @@ -256,7 +256,7 @@ FramebufferState::FramebufferState(Context& context, std::vector& e /* Framebuffer invalidation implementation on desktop GL */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::invalidate_subdata::string()); + extensions.emplace_back(Extensions::GL::ARB::invalidate_subdata::string()); if(context.isExtensionSupported()) { /* Extension added above */ diff --git a/src/Magnum/Implementation/MeshState.cpp b/src/Magnum/Implementation/MeshState.cpp index 5b7528828..826f6c9b1 100644 --- a/src/Magnum/Implementation/MeshState.cpp +++ b/src/Magnum/Implementation/MeshState.cpp @@ -48,7 +48,7 @@ MeshState::MeshState(Context& context, std::vector& extensions): cu #endif { #ifndef MAGNUM_TARGET_GLES - extensions.push_back(Extensions::GL::ARB::vertex_array_object::string()); + extensions.emplace_back(Extensions::GL::ARB::vertex_array_object::string()); #elif defined(MAGNUM_TARGET_GLES2) extensions.push_back(Extensions::GL::OES::vertex_array_object::string()); #endif @@ -58,7 +58,7 @@ MeshState::MeshState(Context& context, std::vector& extensions): cu #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::EXT::direct_state_access::string()); attributePointerImplementation = &Mesh::attributePointerImplementationDSAEXT; } else @@ -85,7 +85,7 @@ MeshState::MeshState(Context& context, std::vector& extensions): cu #ifndef MAGNUM_TARGET_GLES /* DSA create implementation (other cases handled above) */ if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &Mesh::createImplementationVAODSA; } #endif diff --git a/src/Magnum/Implementation/QueryState.cpp b/src/Magnum/Implementation/QueryState.cpp index 71bc4ee0b..542a482a2 100644 --- a/src/Magnum/Implementation/QueryState.cpp +++ b/src/Magnum/Implementation/QueryState.cpp @@ -35,7 +35,7 @@ QueryState::QueryState(Context& context, std::vector& extensions) { /* Create implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &AbstractQuery::createImplementationDSA; } else diff --git a/src/Magnum/Implementation/RendererState.cpp b/src/Magnum/Implementation/RendererState.cpp index 193549620..ec1ee683a 100644 --- a/src/Magnum/Implementation/RendererState.cpp +++ b/src/Magnum/Implementation/RendererState.cpp @@ -41,7 +41,7 @@ RendererState::RendererState(Context& context, std::vector& extensi #endif { #ifndef MAGNUM_TARGET_GLES - extensions.push_back(Extensions::GL::ARB::ES2_compatibility::string()); + extensions.emplace_back(Extensions::GL::ARB::ES2_compatibility::string()); #endif clearDepthfImplementation = &Renderer::clearDepthfImplementationES; @@ -59,7 +59,7 @@ RendererState::RendererState(Context& context, std::vector& extensi #endif { #ifndef MAGNUM_TARGET_GLES - extensions.push_back(Extensions::GL::ARB::robustness::string()); + extensions.emplace_back(Extensions::GL::ARB::robustness::string()); #else extensions.push_back(Extensions::GL::EXT::robustness::string()); #endif diff --git a/src/Magnum/Implementation/ShaderProgramState.cpp b/src/Magnum/Implementation/ShaderProgramState.cpp index 3c84b442e..edea4fa51 100644 --- a/src/Magnum/Implementation/ShaderProgramState.cpp +++ b/src/Magnum/Implementation/ShaderProgramState.cpp @@ -68,7 +68,7 @@ ShaderProgramState::ShaderProgramState(Context& context, std::vector& extension /* Create implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &AbstractTexture::createImplementationDSA; } else @@ -103,7 +103,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* Multi bind implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::multi_bind::string()); + extensions.emplace_back(Extensions::GL::ARB::multi_bind::string()); bindMultiImplementation = &AbstractTexture::bindImplementationMulti; @@ -116,7 +116,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* DSA/non-DSA implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); parameteriImplementation = &AbstractTexture::parameterImplementationDSA; parameterfImplementation = &AbstractTexture::parameterImplementationDSA; @@ -141,7 +141,7 @@ TextureState::TextureState(Context& context, std::vector& extension cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDSA; } else if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::EXT::direct_state_access::string()); parameteriImplementation = &AbstractTexture::parameterImplementationDSAEXT; parameterfImplementation = &AbstractTexture::parameterImplementationDSAEXT; @@ -208,7 +208,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* Data invalidation implementation */ #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::invalidate_subdata::string()); + extensions.emplace_back(Extensions::GL::ARB::invalidate_subdata::string()); invalidateImageImplementation = &AbstractTexture::invalidateImageImplementationARB; invalidateSubImageImplementation = &AbstractTexture::invalidateSubImageImplementationARB; @@ -244,7 +244,7 @@ TextureState::TextureState(Context& context, std::vector& extension getCompressedImageImplementation = &AbstractTexture::getCompressedImageImplementationDSA; } else if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::robustness::string()); + extensions.emplace_back(Extensions::GL::ARB::robustness::string()); getImageImplementation = &AbstractTexture::getImageImplementationRobustness; getCompressedImageImplementation = &AbstractTexture::getCompressedImageImplementationRobustness; @@ -260,7 +260,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* Image retrieval implementation for cube map */ if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::get_texture_sub_image::string()); + extensions.emplace_back(Extensions::GL::ARB::get_texture_sub_image::string()); getCubeImageImplementation = &CubeMapTexture::getImageImplementationDSA; getCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA; @@ -298,7 +298,7 @@ TextureState::TextureState(Context& context, std::vector& extension #endif { #ifndef MAGNUM_TARGET_GLES - extensions.push_back(Extensions::GL::ARB::texture_storage::string()); + extensions.emplace_back(Extensions::GL::ARB::texture_storage::string()); #elif defined(MAGNUM_TARGET_GLES2) extensions.push_back(Extensions::GL::EXT::texture_storage::string()); #endif @@ -347,7 +347,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* Storage implementation for multisample textures. The fallback doesn't have DSA alternative, so it must be handled specially. */ if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::ARB::texture_storage_multisample::string()); + extensions.emplace_back(Extensions::GL::ARB::texture_storage_multisample::string()); if(context.isExtensionSupported()) { storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationDSA; @@ -370,7 +370,7 @@ TextureState::TextureState(Context& context, std::vector& extension /* Anisotropic filter implementation */ if(context.isExtensionSupported()) { - extensions.push_back(Extensions::GL::EXT::texture_filter_anisotropic::string()); + extensions.emplace_back(Extensions::GL::EXT::texture_filter_anisotropic::string()); setMaxAnisotropyImplementation = &AbstractTexture::setMaxAnisotropyImplementationExt; } else setMaxAnisotropyImplementation = &AbstractTexture::setMaxAnisotropyImplementationNoOp; diff --git a/src/Magnum/Implementation/TransformFeedbackState.cpp b/src/Magnum/Implementation/TransformFeedbackState.cpp index 4484cb837..060566c54 100644 --- a/src/Magnum/Implementation/TransformFeedbackState.cpp +++ b/src/Magnum/Implementation/TransformFeedbackState.cpp @@ -15,7 +15,7 @@ TransformFeedbackState::TransformFeedbackState(Context& context, std::vector()) { - extensions.push_back(Extensions::GL::ARB::direct_state_access::string()); + extensions.emplace_back(Extensions::GL::ARB::direct_state_access::string()); createImplementation = &TransformFeedback::createImplementationDSA; attachRangeImplementation = &TransformFeedback::attachImplementationDSA; diff --git a/src/Magnum/Primitives/Implementation/Spheroid.cpp b/src/Magnum/Primitives/Implementation/Spheroid.cpp index 1da8dfc79..ba8b92433 100644 --- a/src/Magnum/Primitives/Implementation/Spheroid.cpp +++ b/src/Magnum/Primitives/Implementation/Spheroid.cpp @@ -35,11 +35,11 @@ namespace Magnum { namespace Primitives { namespace Implementation { Spheroid::Spheroid(UnsignedInt segments, TextureCoords textureCoords): segments(segments), textureCoords(textureCoords) {} void Spheroid::capVertex(Float y, Float normalY, Float textureCoordsV) { - positions.push_back({0.0f, y, 0.0f}); - normals.push_back({0.0f, normalY, 0.0f}); + positions.emplace_back(0.0f, y, 0.0f); + normals.emplace_back(0.0f, normalY, 0.0f); if(textureCoords == TextureCoords::Generate) - textureCoords2D.push_back({0.5, textureCoordsV}); + textureCoords2D.emplace_back(0.5, textureCoordsV); } void Spheroid::hemisphereVertexRings(UnsignedInt count, Float centerY, Rad startRingAngle, Rad ringAngleIncrement, Float startTextureCoordsV, Float textureCoordsVIncrement) { @@ -52,18 +52,18 @@ void Spheroid::hemisphereVertexRings(UnsignedInt count, Float centerY, Rad start for(UnsignedInt j = 0; j != segments; ++j) { Rad segmentAngle = Float(j)*segmentAngleIncrement; - positions.push_back({x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)}); - normals.push_back({x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)}); + positions.emplace_back(x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)); + normals.emplace_back(x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)); if(textureCoords == TextureCoords::Generate) - textureCoords2D.push_back({j*1.0f/segments, startTextureCoordsV + i*textureCoordsVIncrement}); + textureCoords2D.emplace_back(j*1.0f/segments, startTextureCoordsV + i*textureCoordsVIncrement); } /* Duplicate first segment in the ring for additional vertex for texture coordinate */ if(textureCoords == TextureCoords::Generate) { positions.push_back(positions[positions.size()-segments]); normals.push_back(normals[normals.size()-segments]); - textureCoords2D.push_back({1.0f, startTextureCoordsV + i*textureCoordsVIncrement}); + textureCoords2D.emplace_back(1.0f, startTextureCoordsV + i*textureCoordsVIncrement); } } } @@ -73,18 +73,18 @@ void Spheroid::cylinderVertexRings(UnsignedInt count, Float startY, Float yIncre for(UnsignedInt i = 0; i != count; ++i) { for(UnsignedInt j = 0; j != segments; ++j) { Rad segmentAngle = Float(j)*segmentAngleIncrement; - positions.push_back({Math::sin(segmentAngle), startY, Math::cos(segmentAngle)}); - normals.push_back({Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)}); + positions.emplace_back(Math::sin(segmentAngle), startY, Math::cos(segmentAngle)); + normals.emplace_back(Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)); if(textureCoords == TextureCoords::Generate) - textureCoords2D.push_back({j*1.0f/segments, startTextureCoordsV + i*textureCoordsVIncrement}); + textureCoords2D.emplace_back(j*1.0f/segments, startTextureCoordsV + i*textureCoordsVIncrement); } /* Duplicate first segment in the ring for additional vertex for texture coordinate */ if(textureCoords == TextureCoords::Generate) { positions.push_back(positions[positions.size()-segments]); normals.push_back(normals[normals.size()-segments]); - textureCoords2D.push_back({1.0f, startTextureCoordsV + i*textureCoordsVIncrement}); + textureCoords2D.emplace_back(1.0f, startTextureCoordsV + i*textureCoordsVIncrement); } startY += yIncrement; @@ -147,18 +147,18 @@ void Spheroid::capVertexRing(Float y, Float textureCoordsV, const Vector3& norma for(UnsignedInt i = 0; i != segments; ++i) { Rad segmentAngle = Float(i)*segmentAngleIncrement; - positions.push_back({Math::sin(segmentAngle), y, Math::cos(segmentAngle)}); + positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle)); normals.push_back(normal); if(textureCoords == TextureCoords::Generate) - textureCoords2D.push_back({i*1.0f/segments, textureCoordsV}); + textureCoords2D.emplace_back(i*1.0f/segments, textureCoordsV); } /* Duplicate first segment in the ring for additional vertex for texture coordinate */ if(textureCoords == TextureCoords::Generate) { positions.push_back(positions[positions.size()-segments]); normals.push_back(normal); - textureCoords2D.push_back({1.0f, textureCoordsV}); + textureCoords2D.emplace_back(1.0f, textureCoordsV); } } diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index a848beac0..78193d8f0 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -722,23 +722,23 @@ Shader::Shader(const Version version, const Type type): _type(type), _id(0) { switch(version) { #ifndef MAGNUM_TARGET_GLES - case Version::GL210: _sources.push_back("#version 120\n"); return; - case Version::GL300: _sources.push_back("#version 130\n"); return; - case Version::GL310: _sources.push_back("#version 140\n"); return; - case Version::GL320: _sources.push_back("#version 150\n"); return; - case Version::GL330: _sources.push_back("#version 330\n"); return; - case Version::GL400: _sources.push_back("#version 400\n"); return; - case Version::GL410: _sources.push_back("#version 410\n"); return; - case Version::GL420: _sources.push_back("#version 420\n"); return; - case Version::GL430: _sources.push_back("#version 430\n"); return; - case Version::GL440: _sources.push_back("#version 440\n"); return; - case Version::GL450: _sources.push_back("#version 450\n"); return; + case Version::GL210: _sources.emplace_back("#version 120\n"); return; + case Version::GL300: _sources.emplace_back("#version 130\n"); return; + case Version::GL310: _sources.emplace_back("#version 140\n"); return; + case Version::GL320: _sources.emplace_back("#version 150\n"); return; + case Version::GL330: _sources.emplace_back("#version 330\n"); return; + case Version::GL400: _sources.emplace_back("#version 400\n"); return; + case Version::GL410: _sources.emplace_back("#version 410\n"); return; + case Version::GL420: _sources.emplace_back("#version 420\n"); return; + case Version::GL430: _sources.emplace_back("#version 430\n"); return; + case Version::GL440: _sources.emplace_back("#version 440\n"); return; + case Version::GL450: _sources.emplace_back("#version 450\n"); return; #endif /* `#version 100` really is GLSL ES 1.00 and *not* GLSL 1.00. What a mess. */ - case Version::GLES200: _sources.push_back("#version 100\n"); return; - case Version::GLES300: _sources.push_back("#version 300 es\n"); return; + case Version::GLES200: _sources.emplace_back("#version 100\n"); return; + case Version::GLES300: _sources.emplace_back("#version 300 es\n"); return; #ifndef MAGNUM_TARGET_WEBGL - case Version::GLES310: _sources.push_back("#version 310 es\n"); return; + case Version::GLES310: _sources.emplace_back("#version 310 es\n"); return; #endif /* The user is responsible for (not) adding #version directive */ diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index 668c41bac..98e32d500 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -298,13 +298,13 @@ std::optional ObjImporter::doMesh3D(UnsignedInt id) { return std::nullopt; } - if(textureCoordinates.empty()) textureCoordinates.push_back({}); - textureCoordinates.front().push_back(data); + if(textureCoordinates.empty()) textureCoordinates.emplace_back(); + textureCoordinates.front().emplace_back(data); /* Normal */ } else if(keyword == "vn") { - if(normals.empty()) normals.push_back({}); - normals.front().push_back(extractFloatData<3>(contents)); + if(normals.empty()) normals.emplace_back(); + normals.front().emplace_back(extractFloatData<3>(contents)); /* Indices */ } else if(keyword == "p" || keyword == "l" || keyword == "f") { @@ -470,9 +470,9 @@ std::optional ObjImporter::doMesh3D(UnsignedInt id) { if(!normalIndices.empty() || !textureCoordinateIndices.empty()) { std::vector>> arrays; arrays.reserve(3); - arrays.push_back(positionIndices); - if(!normalIndices.empty()) arrays.push_back(normalIndices); - if(!textureCoordinateIndices.empty()) arrays.push_back(textureCoordinateIndices); + arrays.emplace_back(positionIndices); + if(!normalIndices.empty()) arrays.emplace_back(normalIndices); + if(!textureCoordinateIndices.empty()) arrays.emplace_back(textureCoordinateIndices); indices = MeshTools::combineIndexArrays(arrays); /* Reindex data arrays */