diff --git a/src/Magnum/Mesh.h b/src/Magnum/Mesh.h index 50c5d7d3b..1ddf868b7 100644 --- a/src/Magnum/Mesh.h +++ b/src/Magnum/Mesh.h @@ -489,7 +489,6 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @return Reference to self (for method chaining) * * Default is @ref MeshPrimitive::Triangles. - * @see @ref setCount() */ Mesh& setPrimitive(MeshPrimitive primitive) { _primitive = primitive; @@ -506,7 +505,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * If the mesh is indexed, the value is treated as index count, * otherwise the value is vertex count. If set to `0`, no draw commands * are issued when calling @ref draw(). Default is `0`. - * @see @ref isIndexed() + * @see @ref isIndexed(), @ref setBaseVertex(), @ref setInstanceCount() */ Mesh& setCount(Int count) { _count = count; @@ -522,6 +521,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * * Sets number of vertices of which the vertex buffer will be offset * when drawing. Default is `0`. + * @see @ref setCount(), @ref setBaseInstance() * @requires_gl32 %Extension @extension{ARB,draw_elements_base_vertex} * for indexed meshes * @requires_gl Base vertex cannot be specified for indexed meshes in @@ -575,6 +575,8 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * If set to `1`, non-instanced draw commands are issued when calling * @ref draw(). If set to `0`, no draw commands are issued altogether. * Default is `1`. + * @see @ref setBaseInstance(), @ref setCount(), + * @ref addVertexBufferInstanced() * @requires_gl31 %Extension @extension{ARB,draw_instanced} * @requires_gles30 %Extension @es_extension{ANGLE,instanced_arrays}, * @es_extension2{EXT,draw_instanced,draw_instanced} or @@ -594,6 +596,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @return Reference to self (for method chaining) * * Default is `0`. + * @see @ref setInstanceCount(), @ref setBaseVertex() * @requires_gl42 %Extension @extension{ARB,base_instance} * @requires_gl Base instance cannot be specified in OpenGL ES. */ @@ -660,8 +663,8 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * must be at most 255 bytes. This is not required anywhere else, * but doing so may have performance benefits. * - * @see @ref maxVertexAttributes(), @ref setPrimitive(), - * @ref setCount(), @fn_gl{BindVertexArray}, + * @see @ref addVertexBufferInstanced(), @ref maxVertexAttributes(), + * @ref setPrimitive(), @ref setCount(), @fn_gl{BindVertexArray}, * @fn_gl{EnableVertexAttribArray}, @fn_gl{BindBuffer}, * @fn_gl{VertexAttribPointer} or * @fn_gl_extension{EnableVertexArrayAttrib,EXT,direct_state_access}, diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 35e626c67..a34d5ce12 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -189,7 +189,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { if(!(window = SDL_CreateWindow(configuration.title().data(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, configuration.size().x(), configuration.size().y(), - SDL_WINDOW_OPENGL|flags))) + SDL_WINDOW_OPENGL|windowFlags))) { Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError(); return false; diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index 1298ed2a4..506908b0d 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -688,12 +688,12 @@ bool Shader::compile(std::initializer_list> shade if(shaders.size() != 1) { #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) #ifndef CORRADE_GCC44_COMPATIBILITY - out << ' ' << std::to_string(i); + out << " " << std::to_string(i); #else - out << ' ' << std::to_string(static_cast(i)); + out << " " << std::to_string(static_cast(i)); #endif #else - out << ' ' << converter.str(); + out << " " << converter.str(); #endif } out << " failed with the following message:\n" @@ -709,12 +709,12 @@ bool Shader::compile(std::initializer_list> shade if(shaders.size() != 1) { #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) #ifndef CORRADE_GCC44_COMPATIBILITY - out << ' ' << std::to_string(i); + out << " " << std::to_string(i); #else - out << ' ' << std::to_string(static_cast(i)); + out << " " << std::to_string(static_cast(i)); #endif #else - out << ' ' << converter.str(); + out << " " << converter.str(); #endif } out << " succeeded with the following message:\n" diff --git a/src/Magnum/Shaders/magnumShadersResourceImport.hpp b/src/Magnum/Shaders/magnumShadersResourceImport.hpp index 504ee401d..af4e3262b 100644 --- a/src/Magnum/Shaders/magnumShadersResourceImport.hpp +++ b/src/Magnum/Shaders/magnumShadersResourceImport.hpp @@ -29,9 +29,9 @@ #ifdef MAGNUM_BUILD_STATIC #ifdef MAGNUM_BUILD_DEPRECATED -#include "Magnum/Shaders/resourceImport.h" +#include "Magnum/Shaders/resourceImport.hpp" #else -#error use Magnum/Shaders/resourceImport.h instead +#error use Magnum/Shaders/resourceImport.hpp instead #endif #else #error this header is available only in static build diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index 85e13b65f..603033f2e 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -32,11 +32,15 @@ #include #include +#include "Magnum/Mesh.h" +#include "Magnum/MeshTools/CombineIndexedArrays.h" +#include "Magnum/MeshTools/Duplicate.h" #include "Magnum/Math/Vector3.h" #include "Magnum/Trade/MeshData3D.h" -#include -#include -#include + +#ifdef CORRADE_TARGET_NACL_NEWLIB +#include +#endif namespace Magnum { namespace Trade { @@ -61,10 +65,28 @@ template Math::Vector extractFloatData(std::strin } Math::Vector output; - for(std::size_t i = 0; i != size; ++i) + + #ifdef CORRADE_TARGET_NACL_NEWLIB + std::istringstream in; + #endif + + for(std::size_t i = 0; i != size; ++i) { + #ifndef CORRADE_TARGET_NACL_NEWLIB output[i] = std::stof(data[i]); + #else + in.str(data[i]); + in >> output[i]; + #endif + } - if(data.size() == size+1) *extra = std::stof(data.back()); + if(data.size() == size+1) { + #ifndef CORRADE_TARGET_NACL_NEWLIB + *extra = std::stof(data.back()); + #else + in.str(data.back()); + in >> *extra; + #endif + } return output; } @@ -359,15 +381,36 @@ std::optional ObjImporter::doMesh3D(UnsignedInt id) { } /* Position indices */ + #ifndef CORRADE_TARGET_NACL_NEWLIB positionIndices.push_back(std::stoul(indices[0]) - positionIndexOffset); + #else + std::istringstream in(indices[0]); + UnsignedInt index; + in >> index; + positionIndices.push_back(index - positionIndexOffset); + #endif /* Texture coordinates */ - if(indices.size() == 2 || (indices.size() == 3 && !indices[1].empty())) + if(indices.size() == 2 || (indices.size() == 3 && !indices[1].empty())) { + #ifndef CORRADE_TARGET_NACL_NEWLIB textureCoordinateIndices.push_back(std::stoul(indices[1]) - textureCoordinateIndexOffset); + #else + in.str(indices[1]); + in >> index; + textureCoordinateIndices.push_back(index - textureCoordinateIndexOffset); + #endif + } /* Normal indices */ - if(indices.size() == 3) + if(indices.size() == 3) { + #ifndef CORRADE_TARGET_NACL_NEWLIB normalIndices.push_back(std::stoul(indices[2]) - normalIndexOffset); + #else + in.str(indices[2]); + in >> index; + normalIndices.push_back(index - normalIndexOffset); + #endif + } } /* Ignore unsupported keywords, error out on unknown keywords */