No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
ec19c25
... +19 ...
dd3ce93
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
26 | 26 | */ |
|
27 | 27 | ||
28 | 28 | /** @file |
|
29 | - | * @brief Class @ref Magnum::DebugTools::FrameProfiler, @ref Magnum::DebugTools::GLFrameProfiler |
|
29 | + | * @brief Class @ref Magnum::DebugTools::FrameProfiler, @ref Magnum::DebugTools::FrameProfilerGL |
|
30 | 30 | * @m_since{2020,06} |
|
31 | 31 | */ |
|
32 | 32 |
46 | 46 | A generic implementation of a frame profiler supporting a moving average over |
|
47 | 47 | a set of frames as well as delayed measurements to avoid stalls when querying |
|
48 | 48 | the results. This class alone doesn't provide any pre-defined measurements, see |
|
49 | - | for example @ref GLFrameProfiler that provides common measurements like CPU and |
|
49 | + | for example @ref FrameProfilerGL that provides common measurements like CPU and |
|
50 | 50 | GPU time. |
|
51 | 51 | ||
52 | 52 | @experimental |
78 | 78 | @snippet MagnumDebugTools.cpp FrameProfiler-usage-console |
|
79 | 79 | ||
80 | 80 | And here's a sample output on the terminal --- using a fully configured |
|
81 | - | @link GLFrameProfiler @endlink: |
|
81 | + | @link FrameProfilerGL @endlink: |
|
82 | 82 | ||
83 | 83 | @include debugtools-frameprofiler.ansi |
|
84 | 84 | ||
85 | 85 | @section DebugTools-FrameProfiler-setup Setting up measurements |
|
86 | 86 | ||
87 | - | Unless you're using this class through @ref GLFrameProfiler, measurements |
|
87 | + | Unless you're using this class through @ref FrameProfilerGL, measurements |
|
88 | 88 | have to be set up by passing @ref Measurement instances to the @ref setup() |
|
89 | 89 | function or to the constructor, together with specifying count of frames for |
|
90 | 90 | the moving average. A CPU duration measurements using the @ref std::chrono APIs |
499 | 499 | desired subset of measured values and then continue the same way as described |
|
500 | 500 | in the @ref DebugTools-FrameProfiler-usage "FrameProfiler usage documentation": |
|
501 | 501 | ||
502 | - | @snippet MagnumDebugTools-gl.cpp GLFrameProfiler-usage |
|
502 | + | @snippet MagnumDebugTools-gl.cpp FrameProfilerGL-usage |
|
503 | 503 | ||
504 | 504 | If none if @ref Value::GpuDuration, @ref Value::VertexFetchRatio and |
|
505 | 505 | @ref Value::PrimitiveClipRatio is not enabled, the class can operate without an |
|
506 | 506 | active OpenGL context. |
|
507 | 507 | ||
508 | 508 | @experimental |
|
509 | 509 | */ |
|
510 | - | class MAGNUM_DEBUGTOOLS_EXPORT GLFrameProfiler: public FrameProfiler { |
|
510 | + | class MAGNUM_DEBUGTOOLS_EXPORT FrameProfilerGL: public FrameProfiler { |
|
511 | 511 | public: |
|
512 | 512 | /** |
|
513 | 513 | * @brief Measured value |
|
514 | 514 | * |
|
515 | - | * @see @ref Values, @ref GLFrameProfiler(Values, UnsignedInt), |
|
515 | + | * @see @ref Values, @ref FrameProfilerGL(Values, UnsignedInt), |
|
516 | 516 | * @ref setup() |
|
517 | 517 | */ |
|
518 | 518 | enum class Value: UnsignedShort { |
572 | 572 | /** |
|
573 | 573 | * @brief Measured values |
|
574 | 574 | * |
|
575 | - | * @see @ref GLFrameProfiler(Values, UnsignedInt), @ref setup() |
|
575 | + | * @see @ref FrameProfilerGL(Values, UnsignedInt), @ref setup() |
|
576 | 576 | */ |
|
577 | 577 | typedef Containers::EnumSet<Value> Values; |
|
578 | 578 |
581 | 581 | * |
|
582 | 582 | * Call @ref setup() to populate the profiler with measurements. |
|
583 | 583 | */ |
|
584 | - | explicit GLFrameProfiler(); |
|
584 | + | explicit FrameProfilerGL(); |
|
585 | 585 | ||
586 | 586 | /** |
|
587 | 587 | * @brief Constructor |
|
588 | 588 | * |
|
589 | 589 | * Equivalent to default-constructing an instance and calling |
|
590 | 590 | * @ref setup() afterwards. |
|
591 | 591 | */ |
|
592 | - | explicit GLFrameProfiler(Values values, UnsignedInt maxFrameCount); |
|
592 | + | explicit FrameProfilerGL(Values values, UnsignedInt maxFrameCount); |
|
593 | 593 | ||
594 | 594 | /** @brief Copying is not allowed */ |
|
595 | - | GLFrameProfiler(const GLFrameProfiler&) = delete; |
|
595 | + | FrameProfilerGL(const FrameProfilerGL&) = delete; |
|
596 | 596 | ||
597 | 597 | /** @brief Move constructor */ |
|
598 | - | GLFrameProfiler(GLFrameProfiler&&) noexcept; |
|
598 | + | FrameProfilerGL(FrameProfilerGL&&) noexcept; |
|
599 | 599 | ||
600 | 600 | /** @brief Copying is not allowed */ |
|
601 | - | GLFrameProfiler& operator=(const GLFrameProfiler&) = delete; |
|
601 | + | FrameProfilerGL& operator=(const FrameProfilerGL&) = delete; |
|
602 | 602 | ||
603 | 603 | /** @brief Move assignment */ |
|
604 | - | GLFrameProfiler& operator=(GLFrameProfiler&&) noexcept; |
|
604 | + | FrameProfilerGL& operator=(FrameProfilerGL&&) noexcept; |
|
605 | 605 | ||
606 | - | ~GLFrameProfiler(); |
|
606 | + | ~FrameProfilerGL(); |
|
607 | 607 | ||
608 | 608 | /** |
|
609 | 609 | * @brief Setup measured values |
621 | 621 | * @brief Measured values |
|
622 | 622 | * |
|
623 | 623 | * Corresponds to the @p values parameter passed to |
|
624 | - | * @ref GLFrameProfiler(Values, UnsignedInt) or @ref setup(). |
|
624 | + | * @ref FrameProfilerGL(Values, UnsignedInt) or @ref setup(). |
|
625 | 625 | */ |
|
626 | 626 | Values values() const; |
|
627 | 627 |
696 | 696 | Containers::Pointer<State> _state; |
|
697 | 697 | }; |
|
698 | 698 | ||
699 | - | CORRADE_ENUMSET_OPERATORS(GLFrameProfiler::Values) |
|
699 | + | CORRADE_ENUMSET_OPERATORS(FrameProfilerGL::Values) |
|
700 | 700 | ||
701 | 701 | /** |
|
702 | - | @debugoperatorclassenum{GLFrameProfiler,GLFrameProfiler::Value} |
|
702 | + | @debugoperatorclassenum{FrameProfilerGL,FrameProfilerGL::Value} |
|
703 | 703 | @m_since{2020,06} |
|
704 | 704 | */ |
|
705 | - | MAGNUM_DEBUGTOOLS_EXPORT Debug& operator<<(Debug& debug, GLFrameProfiler::Value value); |
|
705 | + | MAGNUM_DEBUGTOOLS_EXPORT Debug& operator<<(Debug& debug, FrameProfilerGL::Value value); |
|
706 | 706 | ||
707 | 707 | /** |
|
708 | - | @debugoperatorclassenum{GLFrameProfiler,GLFrameProfiler::Values} |
|
708 | + | @debugoperatorclassenum{FrameProfilerGL,FrameProfilerGL::Values} |
|
709 | 709 | @m_since{2020,06} |
|
710 | 710 | */ |
|
711 | - | MAGNUM_DEBUGTOOLS_EXPORT Debug& operator<<(Debug& debug, GLFrameProfiler::Values value); |
|
711 | + | MAGNUM_DEBUGTOOLS_EXPORT Debug& operator<<(Debug& debug, FrameProfilerGL::Values value); |
|
712 | + | ||
713 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
714 | + | /** @brief @copybrief FrameProfilerGL |
|
715 | + | * @m_deprecated_since_latest Use @ref FrameProfilerGL instead. |
|
716 | + | */ |
|
717 | + | typedef CORRADE_DEPRECATED("use FrameProfilerGL instead") FrameProfilerGL GLFrameProfiler; |
|
718 | + | #endif |
|
712 | 719 | #endif |
|
713 | 720 | ||
714 | 721 | }} |
717 | 724 | ||
718 | 725 | #ifdef MAGNUM_TARGET_GL |
|
719 | 726 | /** |
|
720 | - | @configurationvalue{Magnum::DebugTools::GLFrameProfiler::Value} |
|
727 | + | @configurationvalue{Magnum::DebugTools::FrameProfilerGL::Value} |
|
721 | 728 | @m_since{2020,06} |
|
722 | 729 | */ |
|
723 | - | template<> struct MAGNUM_DEBUGTOOLS_EXPORT ConfigurationValue<Magnum::DebugTools::GLFrameProfiler::Value> { |
|
730 | + | template<> struct MAGNUM_DEBUGTOOLS_EXPORT ConfigurationValue<Magnum::DebugTools::FrameProfilerGL::Value> { |
|
724 | 731 | ConfigurationValue() = delete; |
|
725 | 732 | ||
726 | 733 | /** |
|
727 | 734 | * @brief Writes enum value as a string |
|
728 | 735 | * |
|
729 | 736 | * If the value is invalid, returns an empty string. |
|
730 | 737 | */ |
|
731 | - | static std::string toString(Magnum::DebugTools::GLFrameProfiler::Value value, ConfigurationValueFlags); |
|
738 | + | static std::string toString(Magnum::DebugTools::FrameProfilerGL::Value value, ConfigurationValueFlags); |
|
732 | 739 | ||
733 | 740 | /** |
|
734 | 741 | * @brief Reads enum value as a string |
|
735 | 742 | * |
|
736 | 743 | * If the string is invalid, returns a zero (invalid) value. |
|
737 | 744 | */ |
|
738 | - | static Magnum::DebugTools::GLFrameProfiler::Value fromString(const std::string& stringValue, ConfigurationValueFlags); |
|
745 | + | static Magnum::DebugTools::FrameProfilerGL::Value fromString(const std::string& stringValue, ConfigurationValueFlags); |
|
739 | 746 | }; |
|
740 | 747 | ||
741 | 748 | /** |
|
742 | - | @configurationvalue{Magnum::DebugTools::GLFrameProfiler::Values} |
|
749 | + | @configurationvalue{Magnum::DebugTools::FrameProfilerGL::Values} |
|
743 | 750 | @m_since{2020,06} |
|
744 | 751 | */ |
|
745 | - | template<> struct MAGNUM_DEBUGTOOLS_EXPORT ConfigurationValue<Magnum::DebugTools::GLFrameProfiler::Values> { |
|
752 | + | template<> struct MAGNUM_DEBUGTOOLS_EXPORT ConfigurationValue<Magnum::DebugTools::FrameProfilerGL::Values> { |
|
746 | 753 | ConfigurationValue() = delete; |
|
747 | 754 | ||
748 | 755 | /** |
751 | 758 | * Writes the enum set as a sequence of flag names separated by spaces. If |
|
752 | 759 | * the value is invalid, returns an empty string. |
|
753 | 760 | */ |
|
754 | - | static std::string toString(Magnum::DebugTools::GLFrameProfiler::Values value, ConfigurationValueFlags); |
|
761 | + | static std::string toString(Magnum::DebugTools::FrameProfilerGL::Values value, ConfigurationValueFlags); |
|
755 | 762 | ||
756 | 763 | /** |
|
757 | 764 | * @brief Reads enum set value as a string |
|
758 | 765 | * |
|
759 | 766 | * Assumes the string is a sequence of flag names separated by spaces. If |
|
760 | 767 | * the value is invalid, returns an empty set. |
|
761 | 768 | */ |
|
762 | - | static Magnum::DebugTools::GLFrameProfiler::Values fromString(const std::string& stringValue, ConfigurationValueFlags); |
|
769 | + | static Magnum::DebugTools::FrameProfilerGL::Values fromString(const std::string& stringValue, ConfigurationValueFlags); |
|
763 | 770 | }; |
|
764 | 771 | #endif |
|
765 | 772 |
23 | 23 | DEALINGS IN THE SOFTWARE. |
|
24 | 24 | */ |
|
25 | 25 | ||
26 | - | #include "MeshVisualizer.h" |
|
26 | + | #include "MeshVisualizerGL.h" |
|
27 | 27 | ||
28 | 28 | #include <Corrade/Containers/EnumSet.hpp> |
|
29 | 29 | #include <Corrade/Containers/Optional.h> |
52 | 52 | ||
53 | 53 | namespace Implementation { |
|
54 | 54 | ||
55 | - | MeshVisualizerBase::MeshVisualizerBase(FlagsBase flags): _flags{flags} { |
|
55 | + | MeshVisualizerGLBase::MeshVisualizerGLBase(FlagsBase flags): _flags{flags} { |
|
56 | 56 | #ifndef MAGNUM_TARGET_GLES2 |
|
57 | 57 | #ifndef CORRADE_NO_ASSERT |
|
58 | 58 | Int countMutuallyExclusive = 0; |
61 | 61 | if(flags & FlagBase::PrimitiveIdFromVertexId) ++countMutuallyExclusive; |
|
62 | 62 | #endif |
|
63 | 63 | CORRADE_ASSERT(countMutuallyExclusive <= 1, |
|
64 | - | "Shaders::MeshVisualizer: Flag::InstancedObjectId, Flag::VertexId and Flag::PrimitiveId are mutually exclusive", ); |
|
64 | + | "Shaders::MeshVisualizerGL: Flag::InstancedObjectId, Flag::VertexId and Flag::PrimitiveId are mutually exclusive", ); |
|
65 | 65 | #endif |
|
66 | 66 | ||
67 | 67 | #ifndef MAGNUM_TARGET_GLES2 |
90 | 90 | ||
91 | 91 | #ifdef MAGNUM_BUILD_STATIC |
|
92 | 92 | /* Import resources on static build, if not already */ |
|
93 | - | if(!Utility::Resource::hasGroup("MagnumShaders")) |
|
93 | + | if(!Utility::Resource::hasGroup("MagnumShadersGL")) |
|
94 | 94 | importShaderResources(); |
|
95 | 95 | #endif |
|
96 | 96 | } |
|
97 | 97 | ||
98 | - | GL::Version MeshVisualizerBase::setupShaders(GL::Shader& vert, GL::Shader& frag, const Utility::Resource& rs) const { |
|
98 | + | GL::Version MeshVisualizerGLBase::setupShaders(GL::Shader& vert, GL::Shader& frag, const Utility::Resource& rs) const { |
|
99 | + | GL::Context& context = GL::Context::current(); |
|
100 | + | ||
99 | 101 | #ifndef MAGNUM_TARGET_GLES |
|
100 | - | const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); |
|
102 | + | const GL::Version version = context.supportedVersion({GL::Version::GL320, GL::Version::GL310, GL::Version::GL300, GL::Version::GL210}); |
|
101 | 103 | /* Extended in MeshVisualizer3D for TBN visualization */ |
|
102 | 104 | CORRADE_INTERNAL_ASSERT(!(_flags & FlagBase::Wireframe) || _flags & FlagBase::NoGeometryShader || version >= GL::Version::GL320); |
|
103 | 105 | #elif !defined(MAGNUM_TARGET_WEBGL) |
|
104 | - | const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES310, GL::Version::GLES300, GL::Version::GLES200}); |
|
106 | + | const GL::Version version = context.supportedVersion({GL::Version::GLES310, GL::Version::GLES300, GL::Version::GLES200}); |
|
105 | 107 | /* Extended in MeshVisualizer3D for TBN visualization */ |
|
106 | 108 | CORRADE_INTERNAL_ASSERT(!(_flags & FlagBase::Wireframe) || _flags & FlagBase::NoGeometryShader || version >= GL::Version::GLES310); |
|
107 | 109 | #else |
|
108 | - | const GL::Version version = GL::Context::current().supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); |
|
110 | + | const GL::Version version = context.supportedVersion({GL::Version::GLES300, GL::Version::GLES200}); |
|
109 | 111 | #endif |
|
110 | 112 | ||
111 | 113 | vert = Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); |
120 | 122 | #ifdef MAGNUM_TARGET_WEBGL |
|
121 | 123 | .addSource("#define SUBSCRIPTING_WORKAROUND\n") |
|
122 | 124 | #elif defined(MAGNUM_TARGET_GLES2) |
|
123 | - | .addSource(GL::Context::current().detectedDriver() & GL::Context::DetectedDriver::Angle ? |
|
125 | + | .addSource(context.detectedDriver() & GL::Context::DetectedDriver::Angle ? |
|
124 | 126 | "#define SUBSCRIPTING_WORKAROUND\n" : "") |
|
125 | 127 | #endif |
|
126 | 128 | ; |
138 | 140 | return version; |
|
139 | 141 | } |
|
140 | 142 | ||
141 | - | MeshVisualizerBase& MeshVisualizerBase::setColor(const Color4& color) { |
|
143 | + | MeshVisualizerGLBase& MeshVisualizerGLBase::setColor(const Color4& color) { |
|
142 | 144 | #ifndef MAGNUM_TARGET_GLES2 |
|
143 | 145 | CORRADE_ASSERT(_flags & (FlagBase::Wireframe|FlagBase::InstancedObjectId|FlagBase::VertexId|FlagBase::PrimitiveId), |
|
144 | - | "Shaders::MeshVisualizer::setColor(): the shader was not created with wireframe or object/vertex/primitive ID enabled", *this); |
|
146 | + | "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe or object/vertex/primitive ID enabled", *this); |
|
145 | 147 | #else |
|
146 | 148 | CORRADE_ASSERT(_flags & FlagBase::Wireframe, |
|
147 | - | "Shaders::MeshVisualizer::setColor(): the shader was not created with wireframe enabled", *this); |
|
149 | + | "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe enabled", *this); |
|
148 | 150 | #endif |
|
149 | 151 | setUniform(_colorUniform, color); |
|
150 | 152 | return *this; |
|
151 | 153 | } |
|
152 | 154 | ||
153 | - | MeshVisualizerBase& MeshVisualizerBase::setWireframeColor(const Color4& color) { |
|
155 | + | MeshVisualizerGLBase& MeshVisualizerGLBase::setWireframeColor(const Color4& color) { |
|
154 | 156 | CORRADE_ASSERT(_flags & FlagBase::Wireframe, |
|
155 | - | "Shaders::MeshVisualizer::setWireframeColor(): the shader was not created with wireframe enabled", *this); |
|
157 | + | "Shaders::MeshVisualizerGL::setWireframeColor(): the shader was not created with wireframe enabled", *this); |
|
156 | 158 | setUniform(_wireframeColorUniform, color); |
|
157 | 159 | return *this; |
|
158 | 160 | } |
|
159 | 161 | ||
160 | - | MeshVisualizerBase& MeshVisualizerBase::setWireframeWidth(const Float width) { |
|
162 | + | MeshVisualizerGLBase& MeshVisualizerGLBase::setWireframeWidth(const Float width) { |
|
161 | 163 | CORRADE_ASSERT(_flags & FlagBase::Wireframe, |
|
162 | - | "Shaders::MeshVisualizer::setWireframeWidth(): the shader was not created with wireframe enabled", *this); |
|
164 | + | "Shaders::MeshVisualizerGL::setWireframeWidth(): the shader was not created with wireframe enabled", *this); |
|
163 | 165 | setUniform(_wireframeWidthUniform, width); |
|
164 | 166 | return *this; |
|
165 | 167 | } |
|
166 | 168 | ||
167 | 169 | #ifndef MAGNUM_TARGET_GLES2 |
|
168 | - | MeshVisualizerBase& MeshVisualizerBase::setColorMapTransformation(const Float offset, const Float scale) { |
|
170 | + | MeshVisualizerGLBase& MeshVisualizerGLBase::setColorMapTransformation(const Float offset, const Float scale) { |
|
169 | 171 | CORRADE_ASSERT(_flags & (FlagBase::InstancedObjectId|FlagBase::VertexId|FlagBase::PrimitiveId), |
|
170 | - | "Shaders::MeshVisualizer::setColorMapTransformation(): the shader was not created with object/vertex/primitive ID enabled", *this); |
|
172 | + | "Shaders::MeshVisualizerGL::setColorMapTransformation(): the shader was not created with object/vertex/primitive ID enabled", *this); |
|
171 | 173 | setUniform(_colorMapOffsetScaleUniform, Vector2{offset, scale}); |
|
172 | 174 | return *this; |
|
173 | 175 | } |
|
174 | 176 | ||
175 | - | MeshVisualizerBase& MeshVisualizerBase::bindColorMapTexture(GL::Texture2D& texture) { |
|
177 | + | MeshVisualizerGLBase& MeshVisualizerGLBase::bindColorMapTexture(GL::Texture2D& texture) { |
|
176 | 178 | CORRADE_ASSERT(_flags & (FlagBase::InstancedObjectId|FlagBase::VertexId|FlagBase::PrimitiveId), |
|
177 | - | "Shaders::MeshVisualizer::bindColorMapTexture(): the shader was not created with object/vertex/primitive ID enabled", *this); |
|
179 | + | "Shaders::MeshVisualizerGL::bindColorMapTexture(): the shader was not created with object/vertex/primitive ID enabled", *this); |
|
178 | 180 | texture.bind(ColorMapTextureUnit); |
|
179 | 181 | return *this; |
|
180 | 182 | } |
|
181 | 183 | #endif |
|
182 | 184 | ||
183 | 185 | } |
|
184 | 186 | ||
185 | - | MeshVisualizer2D::MeshVisualizer2D(const Flags flags): Implementation::MeshVisualizerBase{Implementation::MeshVisualizerBase::FlagBase(UnsignedShort(flags))} { |
|
187 | + | MeshVisualizerGL2D::MeshVisualizerGL2D(const Flags flags): Implementation::MeshVisualizerGLBase{Implementation::MeshVisualizerGLBase::FlagBase(UnsignedShort(flags))} { |
|
186 | 188 | #ifndef MAGNUM_TARGET_GLES2 |
|
187 | 189 | CORRADE_ASSERT(flags & ((Flag::Wireframe|Flag::InstancedObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId) & ~Flag::NoGeometryShader), |
|
188 | - | "Shaders::MeshVisualizer2D: at least one visualization feature has to be enabled", ); |
|
190 | + | "Shaders::MeshVisualizerGL2D: at least one visualization feature has to be enabled", ); |
|
189 | 191 | #else |
|
190 | 192 | CORRADE_ASSERT(flags & (Flag::Wireframe & ~Flag::NoGeometryShader), |
|
191 | - | "Shaders::MeshVisualizer2D: at least Flag::Wireframe has to be enabled", ); |
|
193 | + | "Shaders::MeshVisualizerGL2D: at least Flag::Wireframe has to be enabled", ); |
|
194 | + | #endif |
|
195 | + | ||
196 | + | #ifndef MAGNUM_TARGET_GLES |
|
197 | + | const GL::Context& context = GL::Context::current(); |
|
192 | 198 | #endif |
|
193 | 199 | ||
194 | - | Utility::Resource rs{"MagnumShaders"}; |
|
200 | + | Utility::Resource rs{"MagnumShadersGL"}; |
|
195 | 201 | GL::Shader vert{NoCreate}; |
|
196 | 202 | GL::Shader frag{NoCreate}; |
|
197 | 203 | const GL::Version version = setupShaders(vert, frag, rs); |
245 | 251 | /* ES3 has this done in the shader directly */ |
|
246 | 252 | #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) |
|
247 | 253 | #ifndef MAGNUM_TARGET_GLES |
|
248 | - | if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version)) |
|
254 | + | if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version)) |
|
249 | 255 | #endif |
|
250 | 256 | { |
|
251 | 257 | bindAttributeLocation(Position::Location, "position"); |
255 | 261 | #endif |
|
256 | 262 | #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) |
|
257 | 263 | #ifndef MAGNUM_TARGET_GLES |
|
258 | - | if(!GL::Context::current().isVersionSupported(GL::Version::GL310)) |
|
264 | + | if(!context.isVersionSupported(GL::Version::GL310)) |
|
259 | 265 | #endif |
|
260 | 266 | { |
|
261 | 267 | bindAttributeLocation(VertexIndex::Location, "vertexIndex"); |
267 | 273 | CORRADE_INTERNAL_ASSERT_OUTPUT(link()); |
|
268 | 274 | ||
269 | 275 | #ifndef MAGNUM_TARGET_GLES |
|
270 | - | if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version)) |
|
276 | + | if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version)) |
|
271 | 277 | #endif |
|
272 | 278 | { |
|
273 | 279 | _transformationProjectionMatrixUniform = uniformLocation("transformationProjectionMatrix"); |
314 | 320 | #endif |
|
315 | 321 | } |
|
316 | 322 | ||
317 | - | MeshVisualizer2D& MeshVisualizer2D::setViewportSize(const Vector2& size) { |
|
323 | + | MeshVisualizerGL2D& MeshVisualizerGL2D::setViewportSize(const Vector2& size) { |
|
318 | 324 | /* Not asserting here, since the relation to wireframe is a bit vague. |
|
319 | 325 | Also it's an ugly hack that should be removed, ideally. */ |
|
320 | 326 | if(flags() & Flag::Wireframe && !(flags() & Flag::NoGeometryShader)) |
|
321 | 327 | setUniform(_viewportSizeUniform, size); |
|
322 | 328 | return *this; |
|
323 | 329 | } |
|
324 | 330 | ||
325 | - | MeshVisualizer2D& MeshVisualizer2D::setTransformationProjectionMatrix(const Matrix3& matrix) { |
|
331 | + | MeshVisualizerGL2D& MeshVisualizerGL2D::setTransformationProjectionMatrix(const Matrix3& matrix) { |
|
326 | 332 | setUniform(_transformationProjectionMatrixUniform, matrix); |
|
327 | 333 | return *this; |
|
328 | 334 | } |
|
329 | 335 | ||
330 | - | MeshVisualizer2D& MeshVisualizer2D::setSmoothness(const Float smoothness) { |
|
336 | + | MeshVisualizerGL2D& MeshVisualizerGL2D::setSmoothness(const Float smoothness) { |
|
331 | 337 | /* This is a bit vaguely related but less vague than setViewportSize() so |
|
332 | 338 | asserting in this case. */ |
|
333 | 339 | CORRADE_ASSERT(flags() & Flag::Wireframe, |
|
334 | - | "Shaders::MeshVisualizer2D::setSmoothness(): the shader was not created with wireframe enabled", *this); |
|
340 | + | "Shaders::MeshVisualizerGL2D::setSmoothness(): the shader was not created with wireframe enabled", *this); |
|
335 | 341 | setUniform(_smoothnessUniform, smoothness); |
|
336 | 342 | return *this; |
|
337 | 343 | } |
|
338 | 344 | ||
339 | - | MeshVisualizer3D::MeshVisualizer3D(const Flags flags): Implementation::MeshVisualizerBase{Implementation::MeshVisualizerBase::FlagBase(UnsignedShort(flags))} { |
|
345 | + | MeshVisualizerGL3D::MeshVisualizerGL3D(const Flags flags): Implementation::MeshVisualizerGLBase{Implementation::MeshVisualizerGLBase::FlagBase(UnsignedShort(flags))} { |
|
340 | 346 | #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) |
|
341 | 347 | CORRADE_ASSERT(flags & ((Flag::Wireframe|Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection|Flag::InstancedObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId) & ~Flag::NoGeometryShader), |
|
342 | - | "Shaders::MeshVisualizer3D: at least one visualization feature has to be enabled", ); |
|
348 | + | "Shaders::MeshVisualizerGL3D: at least one visualization feature has to be enabled", ); |
|
343 | 349 | CORRADE_ASSERT(!(flags & Flag::NoGeometryShader && flags & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection)), |
|
344 | - | "Shaders::MeshVisualizer3D: geometry shader has to be enabled when rendering TBN direction", ); |
|
350 | + | "Shaders::MeshVisualizerGL3D: geometry shader has to be enabled when rendering TBN direction", ); |
|
345 | 351 | CORRADE_ASSERT(!(flags & Flag::BitangentDirection && flags & Flag::BitangentFromTangentDirection), |
|
346 | - | "Shaders::MeshVisualizer3D: Flag::BitangentDirection and Flag::BitangentFromTangentDirection are mutually exclusive", ); |
|
352 | + | "Shaders::MeshVisualizerGL3D: Flag::BitangentDirection and Flag::BitangentFromTangentDirection are mutually exclusive", ); |
|
347 | 353 | #elif !defined(MAGNUM_TARGET_GLES2) |
|
348 | 354 | CORRADE_ASSERT(flags & ((Flag::Wireframe|Flag::InstancedObjectId|Flag::VertexId|Flag::PrimitiveIdFromVertexId) & ~Flag::NoGeometryShader), |
|
349 | - | "Shaders::MeshVisualizer3D: at least one visualization feature has to be enabled", ); |
|
355 | + | "Shaders::MeshVisualizerGL3D: at least one visualization feature has to be enabled", ); |
|
350 | 356 | #else |
|
351 | 357 | CORRADE_ASSERT(flags & (Flag::Wireframe & ~Flag::NoGeometryShader), |
|
352 | - | "Shaders::MeshVisualizer3D: at least Flag::Wireframe has to be enabled", ); |
|
358 | + | "Shaders::MeshVisualizerGL3D: at least Flag::Wireframe has to be enabled", ); |
|
359 | + | #endif |
|
360 | + | ||
361 | + | #ifndef MAGNUM_TARGET_GLES |
|
362 | + | const GL::Context& context = GL::Context::current(); |
|
353 | 363 | #endif |
|
354 | 364 | ||
355 | - | Utility::Resource rs{"MagnumShaders"}; |
|
365 | + | Utility::Resource rs{"MagnumShadersGL"}; |
|
356 | 366 | GL::Shader vert{NoCreate}; |
|
357 | 367 | GL::Shader frag{NoCreate}; |
|
358 | 368 | const GL::Version version = setupShaders(vert, frag, rs); |
439 | 449 | /* ES3 has this done in the shader directly */ |
|
440 | 450 | #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) |
|
441 | 451 | #ifndef MAGNUM_TARGET_GLES |
|
442 | - | if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version)) |
|
452 | + | if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_attrib_location>(version)) |
|
443 | 453 | #endif |
|
444 | 454 | { |
|
445 | 455 | bindAttributeLocation(Position::Location, "position"); |
460 | 470 | ||
461 | 471 | #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) |
|
462 | 472 | #ifndef MAGNUM_TARGET_GLES |
|
463 | - | if(!GL::Context::current().isVersionSupported(GL::Version::GL310)) |
|
473 | + | if(!context.isVersionSupported(GL::Version::GL310)) |
|
464 | 474 | #endif |
|
465 | 475 | { |
|
466 | 476 | bindAttributeLocation(VertexIndex::Location, "vertexIndex"); |
472 | 482 | CORRADE_INTERNAL_ASSERT_OUTPUT(link()); |
|
473 | 483 | ||
474 | 484 | #ifndef MAGNUM_TARGET_GLES |
|
475 | - | if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version)) |
|
485 | + | if(!context.isExtensionSupported<GL::Extensions::ARB::explicit_uniform_location>(version)) |
|
476 | 486 | #endif |
|
477 | 487 | { |
|
478 | 488 | _transformationMatrixUniform = uniformLocation("transformationMatrix"); |
547 | 557 | #endif |
|
548 | 558 | } |
|
549 | 559 | ||
550 | - | MeshVisualizer3D& MeshVisualizer3D::setTransformationMatrix(const Matrix4& matrix) { |
|
560 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setTransformationMatrix(const Matrix4& matrix) { |
|
551 | 561 | setUniform(_transformationMatrixUniform, matrix); |
|
552 | 562 | return *this; |
|
553 | 563 | } |
|
554 | 564 | ||
555 | - | MeshVisualizer3D& MeshVisualizer3D::setProjectionMatrix(const Matrix4& matrix) { |
|
565 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setProjectionMatrix(const Matrix4& matrix) { |
|
556 | 566 | setUniform(_projectionMatrixUniform, matrix); |
|
557 | 567 | return *this; |
|
558 | 568 | } |
|
559 | 569 | ||
560 | 570 | #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) |
|
561 | - | MeshVisualizer3D& MeshVisualizer3D::setNormalMatrix(const Matrix3x3& matrix) { |
|
571 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setNormalMatrix(const Matrix3x3& matrix) { |
|
562 | 572 | CORRADE_ASSERT(flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection), |
|
563 | - | "Shaders::MeshVisualizer3D::setNormalMatrix(): the shader was not created with TBN direction enabled", *this); |
|
573 | + | "Shaders::MeshVisualizerGL3D::setNormalMatrix(): the shader was not created with TBN direction enabled", *this); |
|
564 | 574 | setUniform(_normalMatrixUniform, matrix); |
|
565 | 575 | return *this; |
|
566 | 576 | } |
|
567 | 577 | #endif |
|
568 | 578 | ||
569 | - | MeshVisualizer3D& MeshVisualizer3D::setViewportSize(const Vector2& size) { |
|
579 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setViewportSize(const Vector2& size) { |
|
570 | 580 | /* Not asserting here, since the relation to wireframe is a bit vague. |
|
571 | 581 | Also it's an ugly hack that should be removed, ideally. */ |
|
572 | 582 | if((flags() & Flag::Wireframe && !(flags() & Flag::NoGeometryShader)) |
579 | 589 | } |
|
580 | 590 | ||
581 | 591 | #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) |
|
582 | - | MeshVisualizer3D& MeshVisualizer3D::setLineWidth(const Float width) { |
|
592 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setLineWidth(const Float width) { |
|
583 | 593 | CORRADE_ASSERT(flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection), |
|
584 | - | "Shaders::MeshVisualizer3D::setLineWidth(): the shader was not created with TBN direction enabled", *this); |
|
594 | + | "Shaders::MeshVisualizerGL3D::setLineWidth(): the shader was not created with TBN direction enabled", *this); |
|
585 | 595 | setUniform(_lineWidthUniform, width); |
|
586 | 596 | return *this; |
|
587 | 597 | } |
|
588 | 598 | ||
589 | - | MeshVisualizer3D& MeshVisualizer3D::setLineLength(const Float length) { |
|
599 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setLineLength(const Float length) { |
|
590 | 600 | CORRADE_ASSERT(flags() & (Flag::TangentDirection|Flag::BitangentFromTangentDirection|Flag::BitangentDirection|Flag::NormalDirection), |
|
591 | - | "Shaders::MeshVisualizer3D::setLineLength(): the shader was not created with TBN direction enabled", *this); |
|
601 | + | "Shaders::MeshVisualizerGL3D::setLineLength(): the shader was not created with TBN direction enabled", *this); |
|
592 | 602 | setUniform(_lineLengthUniform, length); |
|
593 | 603 | return *this; |
|
594 | 604 | } |
|
595 | 605 | #endif |
|
596 | 606 | ||
597 | - | MeshVisualizer3D& MeshVisualizer3D::setSmoothness(const Float smoothness) { |
|
607 | + | MeshVisualizerGL3D& MeshVisualizerGL3D::setSmoothness(const Float smoothness) { |
|
598 | 608 | #ifndef CORRADE_NO_ASSERT |
|
599 | 609 | /* This is a bit vaguely related but less vague than setViewportSize() so |
|
600 | 610 | asserting in this case. */ |
604 | 614 | constexpr Flags allowed = Flag::Wireframe; |
|
605 | 615 | #endif |
|
606 | 616 | CORRADE_ASSERT(flags() & allowed, |
|
607 | - | "Shaders::MeshVisualizer3D::setSmoothness(): the shader was not created with wireframe or TBN direction enabled", *this); |
|
617 | + | "Shaders::MeshVisualizerGL3D::setSmoothness(): the shader was not created with wireframe or TBN direction enabled", *this); |
|
608 | 618 | #endif |
|
609 | 619 | setUniform(_smoothnessUniform, smoothness); |
|
610 | 620 | return *this; |
|
611 | 621 | } |
|
612 | 622 | ||
613 | - | Debug& operator<<(Debug& debug, const MeshVisualizer2D::Flag value) { |
|
614 | - | debug << "Shaders::MeshVisualizer2D::Flag" << Debug::nospace; |
|
623 | + | Debug& operator<<(Debug& debug, const MeshVisualizerGL2D::Flag value) { |
|
624 | + | debug << "Shaders::MeshVisualizerGL2D::Flag" << Debug::nospace; |
|
615 | 625 | ||
616 | 626 | switch(value) { |
|
617 | 627 | /* LCOV_EXCL_START */ |
|
618 | - | #define _c(v) case MeshVisualizer2D::Flag::v: return debug << "::" #v; |
|
628 | + | #define _c(v) case MeshVisualizerGL2D::Flag::v: return debug << "::" #v; |
|
619 | 629 | _c(NoGeometryShader) |
|
620 | 630 | _c(Wireframe) |
|
621 | 631 | #ifndef MAGNUM_TARGET_GLES2 |
633 | 643 | return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")"; |
|
634 | 644 | } |
|
635 | 645 | ||
636 | - | Debug& operator<<(Debug& debug, const MeshVisualizer3D::Flag value) { |
|
637 | - | debug << "Shaders::MeshVisualizer3D::Flag" << Debug::nospace; |
|
646 | + | Debug& operator<<(Debug& debug, const MeshVisualizerGL3D::Flag value) { |
|
647 | + | debug << "Shaders::MeshVisualizerGL3D::Flag" << Debug::nospace; |
|
638 | 648 | ||
639 | 649 | switch(value) { |
|
640 | 650 | /* LCOV_EXCL_START */ |
|
641 | - | #define _c(v) case MeshVisualizer3D::Flag::v: return debug << "::" #v; |
|
651 | + | #define _c(v) case MeshVisualizerGL3D::Flag::v: return debug << "::" #v; |
|
642 | 652 | _c(NoGeometryShader) |
|
643 | 653 | _c(Wireframe) |
|
644 | 654 | #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) |
662 | 672 | return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")"; |
|
663 | 673 | } |
|
664 | 674 | ||
665 | - | Debug& operator<<(Debug& debug, const MeshVisualizer2D::Flags value) { |
|
666 | - | return Containers::enumSetDebugOutput(debug, value, "Shaders::MeshVisualizer2D::Flags{}", { |
|
667 | - | MeshVisualizer2D::Flag::Wireframe, |
|
675 | + | Debug& operator<<(Debug& debug, const MeshVisualizerGL2D::Flags value) { |
|
676 | + | return Containers::enumSetDebugOutput(debug, value, "Shaders::MeshVisualizerGL2D::Flags{}", { |
|
677 | + | MeshVisualizerGL2D::Flag::Wireframe, |
|
668 | 678 | /* Wireframe contains this on ES2 and WebGL 1 so it's not reported |
|
669 | 679 | there */ |
|
670 | - | MeshVisualizer2D::Flag::NoGeometryShader, |
|
680 | + | MeshVisualizerGL2D::Flag::NoGeometryShader, |
|
671 | 681 | #ifndef MAGNUM_TARGET_GLES2 |
|
672 | - | MeshVisualizer2D::Flag::InstancedObjectId, |
|
673 | - | MeshVisualizer2D::Flag::VertexId, |
|
674 | - | MeshVisualizer2D::Flag::PrimitiveIdFromVertexId, /* Superset of PrimitiveId */ |
|
682 | + | MeshVisualizerGL2D::Flag::InstancedObjectId, |
|
683 | + | MeshVisualizerGL2D::Flag::VertexId, |
|
684 | + | MeshVisualizerGL2D::Flag::PrimitiveIdFromVertexId, /* Superset of PrimitiveId */ |
|
675 | 685 | #ifndef MAGNUM_TARGET_WEBGL |
|
676 | - | MeshVisualizer2D::Flag::PrimitiveId |
|
686 | + | MeshVisualizerGL2D::Flag::PrimitiveId |
|
677 | 687 | #endif |
|
678 | 688 | #endif |
|
679 | 689 | }); |
|
680 | 690 | } |
|
681 | 691 | ||
682 | - | Debug& operator<<(Debug& debug, const MeshVisualizer3D::Flags value) { |
|
683 | - | return Containers::enumSetDebugOutput(debug, value, "Shaders::MeshVisualizer3D::Flags{}", { |
|
684 | - | MeshVisualizer3D::Flag::Wireframe, |
|
692 | + | Debug& operator<<(Debug& debug, const MeshVisualizerGL3D::Flags value) { |
|
693 | + | return Containers::enumSetDebugOutput(debug, value, "Shaders::MeshVisualizerGL3D::Flags{}", { |
|
694 | + | MeshVisualizerGL3D::Flag::Wireframe, |
|
685 | 695 | /* Wireframe contains this on ES2 and WebGL 1 so it's not reported |
|
686 | 696 | there */ |
|
687 | - | MeshVisualizer3D::Flag::NoGeometryShader, |
|
697 | + | MeshVisualizerGL3D::Flag::NoGeometryShader, |
|
688 | 698 | #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) |
|
689 | - | MeshVisualizer3D::Flag::TangentDirection, |
|
690 | - | MeshVisualizer3D::Flag::BitangentFromTangentDirection, |
|
691 | - | MeshVisualizer3D::Flag::BitangentDirection, |
|
692 | - | MeshVisualizer3D::Flag::NormalDirection, |
|
699 | + | MeshVisualizerGL3D::Flag::TangentDirection, |
|
700 | + | MeshVisualizerGL3D::Flag::BitangentFromTangentDirection, |
|
701 | + | MeshVisualizerGL3D::Flag::BitangentDirection, |
|
702 | + | MeshVisualizerGL3D::Flag::NormalDirection, |
|
693 | 703 | #endif |
|
694 | 704 | #ifndef MAGNUM_TARGET_GLES2 |
|
695 | - | MeshVisualizer3D::Flag::InstancedObjectId, |
|
696 | - | MeshVisualizer3D::Flag::VertexId, |
|
697 | - | MeshVisualizer3D::Flag::PrimitiveIdFromVertexId, /* Superset of PrimitiveId */ |
|
705 | + | MeshVisualizerGL3D::Flag::InstancedObjectId, |
|
706 | + | MeshVisualizerGL3D::Flag::VertexId, |
|
707 | + | MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId, /* Superset of PrimitiveId */ |
|
698 | 708 | #ifndef MAGNUM_TARGET_WEBGL |
|
699 | - | MeshVisualizer3D::Flag::PrimitiveId |
|
709 | + | MeshVisualizerGL3D::Flag::PrimitiveId |
|
700 | 710 | #endif |
|
701 | 711 | #endif |
|
702 | 712 | }); |
162 | 162 | const VectorTypeFor<dimensions, Float>& _force; |
|
163 | 163 | ||
164 | 164 | Resource<ForceRendererOptions> _options; |
|
165 | - | Resource<GL::AbstractShaderProgram, Shaders::Flat<dimensions>> _shader; |
|
165 | + | Resource<GL::AbstractShaderProgram, Shaders::FlatGL<dimensions>> _shader; |
|
166 | 166 | Resource<GL::Mesh> _mesh; |
|
167 | 167 | }; |
|
168 | 168 |
38 | 38 | namespace Magnum { namespace Shaders { |
|
39 | 39 | ||
40 | 40 | #ifndef DOXYGEN_GENERATING_OUTPUT |
|
41 | - | template<UnsignedInt> class DistanceFieldVector; |
|
42 | - | typedef DistanceFieldVector<2> DistanceFieldVector2D; |
|
43 | - | typedef DistanceFieldVector<3> DistanceFieldVector3D; |
|
41 | + | template<UnsignedInt> class AbstractVectorGL; |
|
42 | + | typedef AbstractVectorGL<2> AbstractVectorGL2D; |
|
43 | + | typedef AbstractVectorGL<3> AbstractVectorGL3D; |
|
44 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
45 | + | template<UnsignedInt dimensions> using AbstractVector CORRADE_DEPRECATED_ALIAS("use AbstractVectorGL instead") = AbstractVectorGL<dimensions>; |
|
46 | + | typedef CORRADE_DEPRECATED("use AbstractVectorGL2D instead") AbstractVectorGL2D AbstractVector2D; |
|
47 | + | typedef CORRADE_DEPRECATED("use AbstractVectorGL3D instead") AbstractVectorGL3D AbstractVector3D; |
|
48 | + | #endif |
|
44 | 49 | ||
45 | - | template<UnsignedInt> class AbstractVector; |
|
46 | - | typedef AbstractVector<2> AbstractVector2D; |
|
47 | - | typedef AbstractVector<3> AbstractVector3D; |
|
50 | + | template<UnsignedInt> class DistanceFieldVectorGL; |
|
51 | + | typedef DistanceFieldVectorGL<2> DistanceFieldVectorGL2D; |
|
52 | + | typedef DistanceFieldVectorGL<3> DistanceFieldVectorGL3D; |
|
53 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
54 | + | template<UnsignedInt dimensions> using DistanceFieldVector CORRADE_DEPRECATED_ALIAS("use DistanceFieldVectorGL instead") = DistanceFieldVectorGL<dimensions>; |
|
55 | + | typedef CORRADE_DEPRECATED("use DistanceFieldVectorGL2D instead") DistanceFieldVectorGL2D DistanceFieldVector2D; |
|
56 | + | typedef CORRADE_DEPRECATED("use DistanceFieldVectorGL3D instead") DistanceFieldVectorGL3D DistanceFieldVector3D; |
|
57 | + | #endif |
|
48 | 58 | ||
49 | - | template<UnsignedInt> class Flat; |
|
50 | - | typedef Flat<2> Flat2D; |
|
51 | - | typedef Flat<3> Flat3D; |
|
59 | + | template<UnsignedInt> class FlatGL; |
|
60 | + | typedef FlatGL<2> FlatGL2D; |
|
61 | + | typedef FlatGL<3> FlatGL3D; |
|
62 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
63 | + | template<UnsignedInt dimensions> using Flat CORRADE_DEPRECATED_ALIAS("use FlatGL instead") = FlatGL<dimensions>; |
|
64 | + | typedef CORRADE_DEPRECATED("use FlatGL2D instead") FlatGL2D Flat2D; |
|
65 | + | typedef CORRADE_DEPRECATED("use FlatGL3D instead") FlatGL3D Flat3D; |
|
66 | + | #endif |
|
52 | 67 | ||
53 | 68 | /* Generic is used only statically */ |
|
54 | 69 | ||
55 | - | class MeshVisualizer2D; |
|
56 | - | class MeshVisualizer3D; |
|
70 | + | class MeshVisualizerGL2D; |
|
71 | + | class MeshVisualizerGL3D; |
|
57 | 72 | #ifdef MAGNUM_BUILD_DEPRECATED |
|
58 | - | typedef CORRADE_DEPRECATED("use MeshVisualizer3D instead") MeshVisualizer3D MeshVisualizer; |
|
73 | + | typedef CORRADE_DEPRECATED("use MeshVisualizerGL2D instead") MeshVisualizerGL2D MeshVisualizer2D; |
|
74 | + | typedef CORRADE_DEPRECATED("use MeshVisualizerGL3D instead") MeshVisualizerGL3D MeshVisualizer3D; |
|
75 | + | typedef CORRADE_DEPRECATED("use MeshVisualizerGL3D instead") MeshVisualizerGL3D MeshVisualizer; |
|
59 | 76 | #endif |
|
60 | 77 | ||
61 | - | class Phong; |
|
78 | + | class PhongGL; |
|
79 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
80 | + | typedef CORRADE_DEPRECATED("use PhongGL instead") PhongGL Phong; |
|
81 | + | #endif |
|
62 | 82 | ||
63 | - | template<UnsignedInt> class Vector; |
|
64 | - | typedef Vector<2> Vector2D; |
|
65 | - | typedef Vector<3> Vector3D; |
|
83 | + | template<UnsignedInt> class VectorGL; |
|
84 | + | typedef VectorGL<2> VectorGL2D; |
|
85 | + | typedef VectorGL<3> VectorGL3D; |
|
86 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
87 | + | template<UnsignedInt dimensions> using Vector CORRADE_DEPRECATED_ALIAS("use VectorGL instead") = VectorGL<dimensions>; |
|
88 | + | typedef CORRADE_DEPRECATED("use VectorGL2D instead") VectorGL2D Vector2D; |
|
89 | + | typedef CORRADE_DEPRECATED("use VectorGL3D instead") VectorGL3D Vector3D; |
|
90 | + | #endif |
|
66 | 91 | ||
67 | - | template<UnsignedInt> class VertexColor; |
|
68 | - | typedef VertexColor<2> VertexColor2D; |
|
69 | - | typedef VertexColor<3> VertexColor3D; |
|
92 | + | template<UnsignedInt> class VertexColorGL; |
|
93 | + | typedef VertexColorGL<2> VertexColorGL2D; |
|
94 | + | typedef VertexColorGL<3> VertexColorGL3D; |
|
95 | + | #ifdef MAGNUM_BUILD_DEPRECATED |
|
96 | + | template<UnsignedInt dimensions> using VertexColor CORRADE_DEPRECATED_ALIAS("use VertexColorGL instead") = VertexColorGL<dimensions>; |
|
97 | + | typedef CORRADE_DEPRECATED("use VertexColorGL2D instead") VertexColorGL2D VertexColor2D; |
|
98 | + | typedef CORRADE_DEPRECATED("use VertexColorGL3D instead") VertexColorGL3D VertexColor3D; |
|
99 | + | #endif |
|
70 | 100 | #endif |
|
71 | 101 | ||
72 | 102 | }} |
35 | 35 | ||
36 | 36 | namespace Implementation { |
|
37 | 37 | template<std::size_t, class> struct MatrixDeterminant; |
|
38 | - | ||
39 | - | template<std::size_t size, std::size_t col, std::size_t otherSize, class T, std::size_t ...row> constexpr Vector<size, T> valueOrIdentityVector(Corrade::Containers::Implementation::Sequence<row...>, const RectangularMatrix<otherSize, otherSize, T>& other) { |
|
40 | - | return {(col < otherSize && row < otherSize ? other[col][row] : |
|
41 | - | col == row ? T{1} : T{0})...}; |
|
42 | - | } |
|
43 | - | ||
44 | - | template<std::size_t size, std::size_t col, std::size_t otherSize, class T> constexpr Vector<size, T> valueOrIdentityVector(const RectangularMatrix<otherSize, otherSize, T>& other) { |
|
45 | - | return valueOrIdentityVector<size, col>(typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, other); |
|
46 | - | } |
|
47 | 38 | } |
|
48 | 39 | ||
49 | 40 | /** |
78 | 69 | * @brief Construct an identity matrix |
|
79 | 70 | * |
|
80 | 71 | * The @p value allows you to specify a value on diagonal. |
|
81 | - | * @see @ref fromDiagonal() |
|
72 | + | * @see @ref Matrix(ZeroInitT), @ref fromDiagonal() |
|
82 | 73 | */ |
|
83 | - | constexpr explicit Matrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, Vector<size, T>(value)} {} |
|
74 | + | constexpr explicit Matrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{IdentityInit, value} {} |
|
84 | 75 | ||
85 | 76 | /** @copydoc RectangularMatrix::RectangularMatrix(ZeroInitT) */ |
|
86 | 77 | constexpr explicit Matrix(ZeroInitT) noexcept: RectangularMatrix<size, size, T>{ZeroInit} {} |
92 | 83 | template<class ...U> constexpr /*implicit*/ Matrix(const Vector<size, T>& first, const U&... next) noexcept: RectangularMatrix<size, size, T>(first, next...) {} |
|
93 | 84 | ||
94 | 85 | /** @brief Construct with one value for all elements */ |
|
95 | - | constexpr explicit Matrix(T value) noexcept: RectangularMatrix<size, size, T>{typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, value} {} |
|
86 | + | constexpr explicit Matrix(T value) noexcept: RectangularMatrix<size, size, T>{value} {} |
|
96 | 87 | ||
97 | 88 | /** |
|
98 | - | * @brief Construct from a matrix of adifferent type |
|
89 | + | * @brief Construct from a matrix of a different type |
|
99 | 90 | * |
|
100 | 91 | * Performs only default casting on the values, no rounding or |
|
101 | 92 | * anything else. Example usage: |
107 | 98 | /** @brief Construct matrix from external representation */ |
|
108 | 99 | template<class U, class V = decltype(Implementation::RectangularMatrixConverter<size, size, T, U>::from(std::declval<U>()))> constexpr explicit Matrix(const U& other): RectangularMatrix<size, size, T>(Implementation::RectangularMatrixConverter<size, size, T, U>::from(other)) {} |
|
109 | 100 | ||
101 | + | /** @copydoc RectangularMatrix::RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&, T) */ |
|
102 | + | template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{IdentityInit, other, value} {} |
|
103 | + | ||
104 | + | /** @copydoc RectangularMatrix::RectangularMatrix(ZeroInitT, const RectangularMatrix<otherCols, otherRows, T>&) */ |
|
105 | + | template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix(ZeroInitT, const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<size, size, T>{ZeroInit, other} {} |
|
106 | + | ||
110 | 107 | /** |
|
111 | 108 | * @brief Construct by slicing or expanding a matrix of different size |
|
109 | + | * @m_since_latest |
|
112 | 110 | * |
|
113 | - | * If the other matrix is larger, takes only the first @cpp size @ce |
|
114 | - | * columns and rows from it; if the other matrix is smaller, it's |
|
115 | - | * expanded to an identity (ones on diagonal, zeros elsewhere). |
|
111 | + | * Equivalent to @ref Matrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&, T). |
|
112 | + | * Note that this default is different from @ref RectangularMatrix, |
|
113 | + | * where it's equivalent to the @ref ZeroInit variant instead. |
|
116 | 114 | */ |
|
117 | - | template<std::size_t otherSize> constexpr explicit Matrix(const RectangularMatrix<otherSize, otherSize, T>& other) noexcept: Matrix<size, T>{typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, other} {} |
|
115 | + | template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix(const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{IdentityInit, other, value} {} |
|
118 | 116 | ||
119 | 117 | /** @brief Copy constructor */ |
|
120 | 118 | constexpr /*implicit*/ Matrix(const RectangularMatrix<size, size, T>& other) noexcept: RectangularMatrix<size, size, T>(other) {} |
300 | 298 | ||
301 | 299 | private: |
|
302 | 300 | friend struct Implementation::MatrixDeterminant<size, T>; |
|
303 | - | ||
304 | - | /* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(const RectangularMatrix<cols, rows, U>&) */ |
|
305 | - | template<std::size_t otherSize, std::size_t ...col> constexpr explicit Matrix(Corrade::Containers::Implementation::Sequence<col...>, const RectangularMatrix<otherSize, otherSize, T>& other) noexcept: RectangularMatrix<size, size, T>{Implementation::valueOrIdentityVector<size, col>(other)...} {} |
|
306 | 301 | }; |
|
307 | 302 | ||
308 | 303 | /** |
Learn more Showing 14 files with coverage changes found.
src/Magnum/Shaders/MeshVisualizerGL.cpp
src/Magnum/Shaders/VectorGL.cpp
src/Magnum/Shaders/VertexColorGL.cpp
src/Magnum/Shaders/PhongGL.cpp
src/Magnum/Shaders/DistanceFieldVectorGL.cpp
src/Magnum/Shaders/FlatGL.cpp
src/Magnum/Shaders/DistanceFieldVectorGL.h
src/Magnum/Shaders/MeshVisualizerGL.h
src/Magnum/Shaders/FlatGL.h
src/Magnum/Shaders/VertexColorGL.h
src/Magnum/Shaders/PhongGL.h
src/Magnum/Shaders/Shaders.h
src/Magnum/Shaders/AbstractVectorGL.h
src/Magnum/Shaders/VectorGL.h
Files | Coverage |
---|---|
Project Totals (505 files) | 79.98% |
dd3ce93
d03cc34
6f8ad66
047e8e6
57ae596
08a6e7d
7072bef
a347a2b
7413d20
3cd1813
c8ccd8b
1506c92
d683e26
faed96b
f74942f
9f0a61e
f70bbef
e26f909
2066d82
a90e67e
ec19c25