diff --git a/src/DebugTools/ForceRenderer.h b/src/DebugTools/ForceRenderer.h index 2a947e8aa..d9494a212 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/DebugTools/ForceRenderer.h @@ -47,7 +47,7 @@ class ForceRendererOptions { inline constexpr ForceRendererOptions(): _size(1.0f) {} /** @brief Color of rendered arrow */ - inline constexpr Color3<> color() const { return _color; } + inline constexpr Color4<> color() const { return _color; } /** * @brief Set color of rendered arrow @@ -55,7 +55,7 @@ class ForceRendererOptions { * * Default is black. */ - inline ForceRendererOptions* setColor(const Color3<>& color) { + inline ForceRendererOptions* setColor(const Color4<>& color) { _color = color; return this; } @@ -75,7 +75,7 @@ class ForceRendererOptions { } private: - Color3<> _color; + Color4<> _color; Float _size; }; diff --git a/src/DebugTools/ShapeRenderer.h b/src/DebugTools/ShapeRenderer.h index 354286c02..5a73819d3 100644 --- a/src/DebugTools/ShapeRenderer.h +++ b/src/DebugTools/ShapeRenderer.h @@ -60,7 +60,7 @@ class ShapeRendererOptions { inline constexpr ShapeRendererOptions(): _pointSize(0.25f) {} /** @brief Color of rendered shape */ - inline constexpr Color3<> color() const { return _color; } + inline constexpr Color4<> color() const { return _color; } /** * @brief Set color of rendered shape @@ -68,7 +68,7 @@ class ShapeRendererOptions { * * Default is black. */ - inline ShapeRendererOptions* setColor(const Color3<>& color) { + inline ShapeRendererOptions* setColor(const Color4<>& color) { _color = color; return this; } @@ -89,7 +89,7 @@ class ShapeRendererOptions { } private: - Color3<> _color; + Color4<> _color; Float _pointSize; }; diff --git a/src/Platform/GlutApplication.cpp b/src/Platform/GlutApplication.cpp index ca9765030..38741a3fb 100644 --- a/src/Platform/GlutApplication.cpp +++ b/src/Platform/GlutApplication.cpp @@ -96,7 +96,7 @@ void GlutApplication::staticMouseMoveEvent(int x, int y) { instance->mouseMoveEvent(e); } -GlutApplication::Configuration::Configuration(): _title("Magnum GLUT Application"), _size(800, 600) {} +GlutApplication::Configuration::Configuration(): _title("Magnum GLUT Application"), _size(800, 600), _sampleCount(0) {} GlutApplication::Configuration::~Configuration() = default; }} diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 6e7509b2d..4b82e6e6f 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -49,8 +49,8 @@ void NaClApplication::createContext(NaClApplication::Configuration* configuratio PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, - PP_GRAPHICS3DATTRIB_SAMPLES, 0, - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, + PP_GRAPHICS3DATTRIB_SAMPLES, configuration->sampleCount(), + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, configuration->sampleCount() > 1? 1 : 0, PP_GRAPHICS3DATTRIB_WIDTH, configuration->size().x(), PP_GRAPHICS3DATTRIB_HEIGHT, configuration->size().y(), PP_GRAPHICS3DATTRIB_NONE @@ -223,7 +223,7 @@ void NaClApplication::mouseLockCallback(void* applicationInstance, std::int32_t) instance->flags |= Flag::MouseLocked; } -NaClApplication::Configuration::Configuration(): _size(640, 480) {} +NaClApplication::Configuration::Configuration(): _size(640, 480), _sampleCount(0) {} NaClApplication::Configuration::~Configuration() = default; }} diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index f44ff896e..46419c989 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -271,8 +271,24 @@ class NaClApplication::Configuration { return this; } + /** @brief Sample count */ + inline Int sampleCount() const { return _sampleCount; } + + /** + * @brief Set sample count + * @return Pointer to self (for method chaining) + * + * Default is `0`, thus no multisampling. See also + * @ref Renderer::Feature "Renderer::Feature::Multisampling". + */ + inline Configuration* setSampleCount(Int count) { + _sampleCount = count; + return this; + } + private: Vector2i _size; + Int _sampleCount; }; /** diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index 164f4601e..d5f9a1850 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -167,7 +167,7 @@ void Sdl2Application::setMouseLocked(bool enabled) { SDL_SetRelativeMouseMode(enabled ? SDL_TRUE : SDL_FALSE); } -Sdl2Application::Configuration::Configuration(): _title("Magnum SDL2 Application"), _size(800, 600) {} +Sdl2Application::Configuration::Configuration(): _title("Magnum SDL2 Application"), _size(800, 600), _sampleCount(0) {} Sdl2Application::Configuration::~Configuration() = default; Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() { diff --git a/src/Shaders/FlatShader.frag b/src/Shaders/FlatShader.frag index d27192d22..8f3066029 100644 --- a/src/Shaders/FlatShader.frag +++ b/src/Shaders/FlatShader.frag @@ -27,9 +27,9 @@ #endif #ifdef EXPLICIT_UNIFORM_LOCATION -layout(location = 1) uniform vec3 color; +layout(location = 1) uniform vec4 color; #else -uniform lowp vec3 color; +uniform lowp vec4 color; #endif #ifdef NEW_GLSL @@ -37,5 +37,5 @@ out lowp vec4 fragmentColor; #endif void main() { - fragmentColor = vec4(color, 1.0); + fragmentColor = color; } diff --git a/src/Shaders/FlatShader.h b/src/Shaders/FlatShader.h index e2ff47e63..71f5e7d49 100644 --- a/src/Shaders/FlatShader.h +++ b/src/Shaders/FlatShader.h @@ -64,7 +64,7 @@ template class MAGNUM_SHADERS_EXPORT FlatShader: public * @brief Set color * @return Pointer to self (for method chaining) */ - FlatShader* setColor(const Color3<>& color) { + FlatShader* setColor(const Color4<>& color) { setUniform(colorUniform, color); return this; }