From 0ab546b32c0f81c9e2b320997cea62bb52832b12 Mon Sep 17 00:00:00 2001 From: Stefan Wasilewski Date: Sun, 27 Apr 2014 11:59:59 -0400 Subject: [PATCH 1/6] fixed build on mac --- src/Magnum/Platform/Sdl2Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 14cd04f21..b956010e9 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -183,7 +183,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; From 20c62a20aca7aa229e2250bbd661ff82dc0e0590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 May 2014 23:32:05 +0200 Subject: [PATCH 2/6] Doc++ --- src/Magnum/Mesh.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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}, From 6eb9676604c8395914ac6ad56a5c5bc13c9db33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 2 May 2014 18:27:45 +0200 Subject: [PATCH 3/6] Fix Shader::compile() error output. Because Debug outputs chars as numbers, it displayed the following: compilation of fragment shader321 succeeded ... compilation of vertex shader322 succeeded ... instead of compilation of fragment shader 1 succeeded ... compilation of vertex shader 2 succeeded ... Now I will forever know that ASCII code of space is 32. --- src/Magnum/Shader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index 29d938c81..86d4b8722 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -677,9 +677,9 @@ bool Shader::compile(std::initializer_list> shade << " shader"; if(shaders.size() != 1) { #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) - out << ' ' << std::to_string(i); + out << " " << std::to_string(i); #else - out << ' ' << converter.str(); + out << " " << converter.str(); #endif } out << " failed with the following message:\n" @@ -694,9 +694,9 @@ bool Shader::compile(std::initializer_list> shade << " shader"; if(shaders.size() != 1) { #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) && !defined(__MINGW32__) - out << ' ' << std::to_string(i); + out << " " << std::to_string(i); #else - out << ' ' << converter.str(); + out << " " << converter.str(); #endif } out << " succeeded with the following message:\n" From 069bdbd011ff23d8e9f90c18c1ebe89c5da49ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 4 May 2014 17:44:54 +0200 Subject: [PATCH 4/6] Fixed deprecated header. --- src/Magnum/Shaders/magnumShadersResourceImport.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From f721cc347ec920e53281720b13294c6bc24bcdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 4 May 2014 17:45:38 +0200 Subject: [PATCH 5/6] ObjImporter: who did this?! Inter-project includes should *not* be in angle brackets. --- src/MagnumPlugins/ObjImporter/ObjImporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index 932e509c1..a11ad4c1a 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -32,11 +32,11 @@ #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 namespace Magnum { namespace Trade { From 79c27ef77351019b5fd324eb81a5a17583d7f3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 4 May 2014 17:46:11 +0200 Subject: [PATCH 6/6] ObjImporter: fix compilation on NaCl/newlib. --- src/MagnumPlugins/ObjImporter/ObjImporter.cpp | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index a11ad4c1a..78a866b49 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -38,6 +38,10 @@ #include "Magnum/Math/Vector3.h" #include "Magnum/Trade/MeshData3D.h" +#ifdef CORRADE_TARGET_NACL_NEWLIB +#include +#endif + namespace Magnum { namespace Trade { struct ObjImporter::File { @@ -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; } @@ -355,15 +377,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 */