diff --git a/src/Math/Vector.h b/src/Math/Vector.h index b698f88df..5beb7e22c 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -56,7 +56,7 @@ template class Vector: public RectangularMatrix<1, si * @brief Angle between normalized vectors * * @f[ - * \phi = \frac{a \cdot b}{|a| \cdot |b|} + * \phi = acos \left(\frac{a \cdot b}{|a| \cdot |b|} \right) * @f] * @attention Assertion fails on non-normalized vectors and NaN is * returned. diff --git a/src/Physics/Implementation/BoxRenderer.cpp b/src/Physics/Implementation/BoxRenderer.cpp index 472af6781..31b609e73 100644 --- a/src/Physics/Implementation/BoxRenderer.cpp +++ b/src/Physics/Implementation/BoxRenderer.cpp @@ -28,8 +28,8 @@ namespace { template struct BoxMesh {}; template<> struct BoxMesh<2> { - constexpr static char shader[] = "shader2d"; - constexpr static char key[] = "box2d"; + constexpr static ResourceKey shader() { return {"shader2d"}; } + constexpr static ResourceKey key() { return {"box2d"}; } static Mesh* mesh(Buffer* buffer) { Primitives::Square square; @@ -42,8 +42,8 @@ namespace { }; template<> struct BoxMesh<3> { - constexpr static char shader[] = "shader3d"; - constexpr static char key[] = "box3d"; + constexpr static ResourceKey shader() { return {"shader3d"}; } + constexpr static ResourceKey key() { return {"box3d"}; } static Mesh* mesh(Buffer* buffer) { Primitives::Cube cube; @@ -56,12 +56,7 @@ namespace { }; } -constexpr char BoxMesh<2>::shader[]; -constexpr char BoxMesh<2>::key[]; -constexpr char BoxMesh<3>::shader[]; -constexpr char BoxMesh<3>::key[]; - -template BoxRenderer::BoxRenderer(Box& box, ResourceKey options, typename SceneGraph::AbstractObject::ObjectType* parent): AbstractDebugRenderer(BoxMesh::shader, BoxMesh::key, options, parent), buffer(DebugDrawResourceManager::instance()->get(BoxMesh::key)), box(box) { +template BoxRenderer::BoxRenderer(Box& box, ResourceKey options, typename SceneGraph::AbstractObject::ObjectType* parent): AbstractDebugRenderer(BoxMesh::shader(), BoxMesh::key(), options, parent), buffer(DebugDrawResourceManager::instance()->get(BoxMesh::key())), box(box) { if(!this->mesh) { DebugDrawResourceManager::instance()->set(this->buffer.key(), new Buffer, ResourceDataState::Final, ResourcePolicy::Manual); DebugDrawResourceManager::instance()->set(this->mesh.key(), BoxMesh::mesh(buffer), ResourceDataState::Final, ResourcePolicy::Manual); diff --git a/src/Physics/ShapedObjectGroup.h b/src/Physics/ShapedObjectGroup.h index acd5fb96a..1934ef19c 100644 --- a/src/Physics/ShapedObjectGroup.h +++ b/src/Physics/ShapedObjectGroup.h @@ -45,7 +45,7 @@ template class PHYSICS_EXPORT ShapedObjectGroup { * * Marks the group as dirty. */ - inline constexpr ShapedObjectGroup(): dirty(true) {} + inline ShapedObjectGroup(): dirty(true) {} /** * @brief Destructor diff --git a/src/Shader.cpp b/src/Shader.cpp index ea4004814..5695b383a 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -48,7 +48,8 @@ Shader::Shader(Version version, Type type): _type(type), _state(State::Initializ case Version::GLES300: addSource("#version 300\n"); break; #endif - default: break; + default: + CORRADE_ASSERT(false, "Shader::Shader(): unsupported version" << GLint(version), ); } } diff --git a/src/Shaders/FlatShader.cpp b/src/Shaders/FlatShader.cpp index 69d15c3a0..78ad7a450 100644 --- a/src/Shaders/FlatShader.cpp +++ b/src/Shaders/FlatShader.cpp @@ -26,13 +26,13 @@ namespace { template struct ShaderName {}; template<> struct ShaderName<2> { - constexpr static const char* Vertex = "FlatShader2D.vert"; - constexpr static const char* Fragment = "FlatShader2D.frag"; + constexpr static const char* vertex() { return "FlatShader2D.vert"; } + constexpr static const char* fragment() { return "FlatShader2D.frag"; } }; template<> struct ShaderName<3> { - constexpr static const char* Vertex = "FlatShader3D.vert"; - constexpr static const char* Fragment = "FlatShader3D.frag"; + constexpr static const char* vertex() { return "FlatShader3D.vert"; } + constexpr static const char* fragment() { return "FlatShader3D.frag"; } }; } @@ -40,19 +40,19 @@ template FlatShader::FlatShader() { Corrade::Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES - Version v = Context::current()->supportedVersion({/*Version::GL320, */Version::GL210}); + Version v = Context::current()->supportedVersion({Version::GL320, Version::GL210}); #else Version v = Context::current()->supportedVersion({Version::GLES300, Version::GLES200}); #endif Shader vertexShader(v, Shader::Type::Vertex); vertexShader.addSource(rs.get("compatibility.glsl")); - vertexShader.addSource(rs.get(ShaderName::Vertex)); + vertexShader.addSource(rs.get(ShaderName::vertex())); attachShader(vertexShader); Shader fragmentShader(v, Shader::Type::Fragment); fragmentShader.addSource(rs.get("compatibility.glsl")); - fragmentShader.addSource(rs.get(ShaderName::Fragment)); + fragmentShader.addSource(rs.get(ShaderName::fragment())); attachShader(fragmentShader); #ifndef MAGNUM_TARGET_GLES