From 5787d66d45b5da1b64324b63df249d49faaa6212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 11 Jul 2013 14:25:55 +0200 Subject: [PATCH 01/90] Math: test also vector as interpolation phase in Math::lerp(). --- src/Math/Test/FunctionsTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Math/Test/FunctionsTest.cpp b/src/Math/Test/FunctionsTest.cpp index 3f48d5ff3..bc23f09ea 100644 --- a/src/Math/Test/FunctionsTest.cpp +++ b/src/Math/Test/FunctionsTest.cpp @@ -166,6 +166,9 @@ void FunctionsTest::lerp() { Vector3ub c(0, 128, 64); Vector3ub d(16, 0, 32); CORRADE_COMPARE(Math::lerp(c, d, 0.25f), Vector3ub(4, 96, 56)); + + /* Vector as interpolation phase */ + CORRADE_COMPARE(Math::lerp(a, b, Vector3(0.25f, 0.5f, 0.75f)), Vector3(0.0f, 0.0f, 9.0f)); } void FunctionsTest::fma() { From 186c522fe5f26e283209d1084f3eff5b79311470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 11 Jul 2013 14:40:39 +0200 Subject: [PATCH 02/90] Math: added lerpInverted(). --- src/Math/Functions.h | 24 +++++++++++++++++++++++- src/Math/Test/FunctionsTest.cpp | 12 ++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Math/Functions.h b/src/Math/Functions.h index bb1947d38..cef9fde4e 100644 --- a/src/Math/Functions.h +++ b/src/Math/Functions.h @@ -279,7 +279,7 @@ template Vector clamp(const Vector& The interpolation for vectors is done as in following, similarly for scalars: @f[ \boldsymbol v_{LERP} = (1 - t) \boldsymbol v_A + t \boldsymbol v_B @f] -@see Quaternion::lerp() +@see lerpInverted(), Quaternion::lerp() @todo http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/ (when SIMD is in place) */ @@ -294,6 +294,28 @@ template inline Vector lerp(const V } #endif +/** +@brief Inverse linear interpolation of two values +@param a First value +@param b Second value +@param lerp Interpolated value + +Returns interpolation phase *t*: @f[ + t = \frac{\boldsymbol v_{LERP} - \boldsymbol v_A}{\boldsymbol v_B - \boldsymbol v_A} +@f] +@see lerp() +*/ +#ifdef DOXYGEN_GENERATING_OUTPUT +template inline T lerpInverted(const T& a, const T& b, const T& lerp); +#else +template inline T lerpInverted(T a, T b, T lerp) { + return (lerp - a)/(b - a); +} +template inline Vector lerpInverted(const Vector& a, const Vector& b, const Vector& lerp) { + return (lerp - a)/(b - a); +} +#endif + /** @brief Fused multiply-add diff --git a/src/Math/Test/FunctionsTest.cpp b/src/Math/Test/FunctionsTest.cpp index bc23f09ea..2d83cf349 100644 --- a/src/Math/Test/FunctionsTest.cpp +++ b/src/Math/Test/FunctionsTest.cpp @@ -43,6 +43,7 @@ class FunctionsTest: public Corrade::TestSuite::Tester { void sqrtInverted(); void clamp(); void lerp(); + void lerpInverted(); void fma(); void normalizeUnsigned(); void normalizeSigned(); @@ -79,6 +80,7 @@ FunctionsTest::FunctionsTest() { &FunctionsTest::sqrtInverted, &FunctionsTest::clamp, &FunctionsTest::lerp, + &FunctionsTest::lerpInverted, &FunctionsTest::fma, &FunctionsTest::normalizeUnsigned, &FunctionsTest::normalizeSigned, @@ -171,6 +173,16 @@ void FunctionsTest::lerp() { CORRADE_COMPARE(Math::lerp(a, b, Vector3(0.25f, 0.5f, 0.75f)), Vector3(0.0f, 0.0f, 9.0f)); } +void FunctionsTest::lerpInverted() { + /* Floating-point scalar */ + CORRADE_COMPARE(Math::lerpInverted(2.0f, 5.0f, 3.5f), 0.5f); + + /* Floating-point vector */ + Vector3 a(-1.0f, 2.0f, 3.0f); + Vector3 b(3.0f, -2.0f, 11.0f); + CORRADE_COMPARE(Math::lerpInverted(a, b, Vector3(0.0f, 0.0f, 9.0f)), Vector3(0.25f, 0.5f, 0.75f)); +} + void FunctionsTest::fma() { CORRADE_COMPARE(Math::fma(2.0f, 3.0f, 0.75f), 6.75f); CORRADE_COMPARE(Math::fma(Vector3( 2.0f, 1.5f, 0.5f), From 759a28ef45f3b01de4672698ce797ed9e3b471df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 11 Jul 2013 14:41:42 +0200 Subject: [PATCH 03/90] Math: improved documentation for *::isNormalized(). --- src/Math/Complex.h | 2 +- src/Math/DualComplex.h | 1 + src/Math/DualQuaternion.h | 1 + src/Math/Quaternion.h | 2 +- src/Math/Vector.h | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Math/Complex.h b/src/Math/Complex.h index 8e54f03b7..88f2338f7 100644 --- a/src/Math/Complex.h +++ b/src/Math/Complex.h @@ -150,7 +150,7 @@ template class Complex { * @brief Whether the complex number is normalized * * Complex number is normalized if it has unit length: @f[ - * |c|^2 = |c| = 1 + * |c \cdot c - 1| < 2 \epsilon + \epsilon^2 \cong 2 \epsilon * @f] * @see dot(), normalized() */ diff --git a/src/Math/DualComplex.h b/src/Math/DualComplex.h index 024563d2f..95ed5e7fb 100644 --- a/src/Math/DualComplex.h +++ b/src/Math/DualComplex.h @@ -133,6 +133,7 @@ template class DualComplex: public Dual> { * |c_0|^2 = |c_0| = 1 * @f] * @see Complex::dot(), normalized() + * @todoc Improve the equation as in Complex::isNormalized() */ bool isNormalized() const { return Implementation::isNormalizedSquared(lengthSquared()); diff --git a/src/Math/DualQuaternion.h b/src/Math/DualQuaternion.h index 6411c9fa7..e3ef06f26 100644 --- a/src/Math/DualQuaternion.h +++ b/src/Math/DualQuaternion.h @@ -139,6 +139,7 @@ template class DualQuaternion: public Dual> { * |\hat q|^2 = |\hat q| = 1 + \epsilon 0 * @f] * @see lengthSquared(), normalized() + * @todoc Improve the equation as in Quaternion::isNormalized() */ bool isNormalized() const { /* Comparing dual part classically, as comparing sqrt() of it would diff --git a/src/Math/Quaternion.h b/src/Math/Quaternion.h index d17c3e627..65c3f9408 100644 --- a/src/Math/Quaternion.h +++ b/src/Math/Quaternion.h @@ -164,7 +164,7 @@ template class Quaternion { * @brief Whether the quaternion is normalized * * Quaternion is normalized if it has unit length: @f[ - * |q|^2 = |q| = 1 + * |q \cdot q - 1| < 2 \epsilon + \epsilon^2 \cong 2 \epsilon * @f] * @see dot(), normalized() */ diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 353986936..42aaac41c 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -224,7 +224,7 @@ template class Vector { * @brief Whether the vector is normalized * * The vector is normalized if it has unit length: @f[ - * |\boldsymbol a|^2 = |\boldsymbol a| = 1 + * |\boldsymbol a \cdot \boldsymbol a - 1| < 2 \epsilon + \epsilon^2 \cong 2 \epsilon * @f] * @see dot(), normalized() */ From 115a0578e1591a5c86142c2e9536b3783205a0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Jul 2013 23:33:31 +0200 Subject: [PATCH 04/90] Primitives: fixed include guard. --- src/Primitives/Implementation/Spheroid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Primitives/Implementation/Spheroid.h b/src/Primitives/Implementation/Spheroid.h index b493ee42e..241b77f92 100644 --- a/src/Primitives/Implementation/Spheroid.h +++ b/src/Primitives/Implementation/Spheroid.h @@ -1,5 +1,5 @@ -#ifndef Magnum_Primitives_Spheroid_h -#define Magnum_Primitives_Spheroid_h +#ifndef Magnum_Primitives_Implementation_Spheroid_h +#define Magnum_Primitives_Implementation_Spheroid_h /* This file is part of Magnum. From d67c0951f269e537d0052d01a4db046667e2b216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Jul 2013 23:33:56 +0200 Subject: [PATCH 05/90] Primitives: no need to have this stuff public. --- src/Primitives/Implementation/Spheroid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Primitives/Implementation/Spheroid.h b/src/Primitives/Implementation/Spheroid.h index 241b77f92..16921141e 100644 --- a/src/Primitives/Implementation/Spheroid.h +++ b/src/Primitives/Implementation/Spheroid.h @@ -50,10 +50,10 @@ class Spheroid { Trade::MeshData3D finalize(); + private: UnsignedInt segments; TextureCoords textureCoords; - private: std::vector indices; std::vector positions; std::vector normals; From d13388f7bccd760a486d71eb7988bb814397f57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Jul 2013 23:35:26 +0200 Subject: [PATCH 06/90] Primitives: wireframe versions of Capsule, Cylinder and UVSphere. Simplified representation of the shapes, i.e. an UVSphere is visualized by three circles, one for each axis. Will be used mainly in DebugTools. --- src/Primitives/CMakeLists.txt | 3 +- src/Primitives/Capsule.cpp | 22 ++++ src/Primitives/Capsule.h | 14 +++ src/Primitives/Cylinder.cpp | 16 +++ src/Primitives/Cylinder.h | 12 ++ .../Implementation/WireframeSpheroid.cpp | 115 ++++++++++++++++++ .../Implementation/WireframeSpheroid.h | 54 ++++++++ src/Primitives/Test/CapsuleTest.cpp | 82 ++++++++++++- src/Primitives/Test/CylinderTest.cpp | 64 +++++++++- src/Primitives/Test/UVSphereTest.cpp | 56 ++++++++- src/Primitives/UVSphere.cpp | 14 +++ src/Primitives/UVSphere.h | 11 ++ 12 files changed, 444 insertions(+), 19 deletions(-) create mode 100644 src/Primitives/Implementation/WireframeSpheroid.cpp create mode 100644 src/Primitives/Implementation/WireframeSpheroid.h diff --git a/src/Primitives/CMakeLists.txt b/src/Primitives/CMakeLists.txt index 01224000d..8ee9e9951 100644 --- a/src/Primitives/CMakeLists.txt +++ b/src/Primitives/CMakeLists.txt @@ -34,7 +34,8 @@ set(MagnumPrimitives_SRCS Square.cpp UVSphere.cpp - Implementation/Spheroid.cpp) + Implementation/Spheroid.cpp + Implementation/WireframeSpheroid.cpp) set(MagnumPrimitives_HEADERS Capsule.h diff --git a/src/Primitives/Capsule.cpp b/src/Primitives/Capsule.cpp index d0128ba53..50885b3bd 100644 --- a/src/Primitives/Capsule.cpp +++ b/src/Primitives/Capsule.cpp @@ -26,6 +26,7 @@ #include "Math/Vector3.h" #include "Primitives/Implementation/Spheroid.h" +#include "Primitives/Implementation/WireframeSpheroid.h" #include "Trade/MeshData3D.h" namespace Magnum { namespace Primitives { @@ -64,4 +65,25 @@ Trade::MeshData3D Capsule::solid(UnsignedInt hemisphereRings, UnsignedInt cylind return capsule.finalize(); } +Trade::MeshData3D Capsule::wireframe(const UnsignedInt hemisphereRings, const UnsignedInt cylinderRings, const UnsignedInt segments, const Float length) { + CORRADE_ASSERT(hemisphereRings >= 1 && cylinderRings >= 1 && segments >= 4 && segments%4 == 0, "Primitives::Capsule::wireframe(): improper parameters", Trade::MeshData3D(Mesh::Primitive::Lines, {}, {}, {}, {})); + + Implementation::WireframeSpheroid capsule(segments/4); + + /* Bottom hemisphere */ + capsule.bottomHemisphere(-length/2, hemisphereRings); + + /* Cylinder */ + capsule.ring(-length/2); + for(UnsignedInt i = 0; i != cylinderRings; ++i) { + capsule.cylinder(); + capsule.ring(-length/2 + (i+1)*(length/cylinderRings)); + } + + /* Top hemisphere */ + capsule.topHemisphere(length/2, hemisphereRings); + + return capsule.finalize(); +} + }} diff --git a/src/Primitives/Capsule.h b/src/Primitives/Capsule.h index fbefe1c30..bf9195aed 100644 --- a/src/Primitives/Capsule.h +++ b/src/Primitives/Capsule.h @@ -62,6 +62,20 @@ class MAGNUM_PRIMITIVES_EXPORT Capsule { * vertices of one segment are duplicated for texture wrapping. */ static Trade::MeshData3D solid(UnsignedInt hemisphereRings, UnsignedInt cylinderRings, UnsignedInt segments, Float length, TextureCoords textureCoords = TextureCoords::DontGenerate); + + /** + * @brief Wireframe capsule + * @param hemisphereRings Number of (line) rings for each hemisphere. + * Must be larger or equal to 1. + * @param cylinderRings Number of (line) rings for cylinder. Must be + * larger or equal to 1. + * @param segments Number of line segments. Must be larger or + * equal to 4 and multiple of 4. + * @param length Length of the capsule, excluding hemispheres. + * + * Indexed @ref Mesh::Primitive "Lines". + */ + static Trade::MeshData3D wireframe(UnsignedInt hemisphereRings, UnsignedInt cylinderRings, UnsignedInt segments, Float length); }; }} diff --git a/src/Primitives/Cylinder.cpp b/src/Primitives/Cylinder.cpp index a750715ae..b1af5e6a8 100644 --- a/src/Primitives/Cylinder.cpp +++ b/src/Primitives/Cylinder.cpp @@ -26,6 +26,7 @@ #include "Math/Vector3.h" #include "Primitives/Implementation/Spheroid.h" +#include "Primitives/Implementation/WireframeSpheroid.h" #include "Trade/MeshData3D.h" namespace Magnum { namespace Primitives { @@ -61,4 +62,19 @@ Trade::MeshData3D Cylinder::solid(UnsignedInt rings, UnsignedInt segments, Float return cylinder.finalize(); } +Trade::MeshData3D Cylinder::wireframe(const UnsignedInt rings, const UnsignedInt segments, const Float length) { + CORRADE_ASSERT(rings >= 1 && segments >= 4 && segments%4 == 0, "Primitives::Cylinder::wireframe(): improper parameters", Trade::MeshData3D(Mesh::Primitive::Lines, {}, {}, {}, {})); + + Implementation::WireframeSpheroid cylinder(segments/4); + + /* Rings */ + cylinder.ring(-length/2); + for(UnsignedInt i = 0; i != rings; ++i) { + cylinder.cylinder(); + cylinder.ring(-length/2 + (i+1)*(length/rings)); + } + + return cylinder.finalize(); +} + }} diff --git a/src/Primitives/Cylinder.h b/src/Primitives/Cylinder.h index 0a08fcf2b..8b8d92bfb 100644 --- a/src/Primitives/Cylinder.h +++ b/src/Primitives/Cylinder.h @@ -71,6 +71,18 @@ class MAGNUM_PRIMITIVES_EXPORT Cylinder { * wrapping. */ static Trade::MeshData3D solid(UnsignedInt rings, UnsignedInt segments, Float length, Flags flags = Flags()); + + /** + * @brief Wireframe cylinder + * @param rings Number of (line) rings. Must be larger or equal + * to 1. + * @param segments Number of (line) segments. Must be larger or + * equal to 4 and multiple of 4. + * @param length Cylinder length + * + * Indexed @ref Mesh::Primitive "Lines". + */ + static Trade::MeshData3D wireframe(UnsignedInt rings, UnsignedInt segments, Float length); }; CORRADE_ENUMSET_OPERATORS(Cylinder::Flags) diff --git a/src/Primitives/Implementation/WireframeSpheroid.cpp b/src/Primitives/Implementation/WireframeSpheroid.cpp new file mode 100644 index 000000000..67bbaeed4 --- /dev/null +++ b/src/Primitives/Implementation/WireframeSpheroid.cpp @@ -0,0 +1,115 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "WireframeSpheroid.h" + +#include "Math/Functions.h" +#include "Math/Vector3.h" +#include "Trade/MeshData3D.h" + +namespace Magnum { namespace Primitives { namespace Implementation { + +WireframeSpheroid::WireframeSpheroid(const UnsignedInt segments): _segments(segments) {} + +void WireframeSpheroid::bottomHemisphere(const Float endY, const UnsignedInt rings) { + CORRADE_INTERNAL_ASSERT(_positions.empty()); + + /* Initial vertex */ + _positions.push_back(Vector3::yAxis(endY - 1.0f)); + + /* Connect initial vertex to first ring */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {0, i+1}); + + /* Hemisphere vertices and indices */ + const Rad ringAngleIncrement(Constants::pi()/(2*rings)); + for(UnsignedInt j = 0; j != rings-1; ++j) { + const Rad angle = (j+1)*ringAngleIncrement; + + _positions.emplace_back(0.0f, endY - Math::cos(angle), Math::sin(angle)); + _positions.emplace_back(Math::sin(angle), endY - Math::cos(angle), 0.0f); + _positions.emplace_back(0.0f, endY - Math::cos(angle), -Math::sin(angle)); + _positions.emplace_back(-Math::sin(angle), endY - Math::cos(angle), 0.0f); + + /* Connect vertices to next ring */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-4+i, UnsignedInt(_positions.size())+i}); + } +} + +void WireframeSpheroid::topHemisphere(const Float startY, const UnsignedInt rings) { + /* Connect previous ring to following vertices */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-4*_segments+i, UnsignedInt(_positions.size())+i}); + + /* Hemisphere vertices and indices */ + const Rad ringAngleIncrement(Constants::pi()/(2*rings)); + for(UnsignedInt j = 0; j != rings-1; ++j) { + const Rad angle = (j+1)*ringAngleIncrement; + + /* Connect previous hemisphere ring to current vertices */ + if(j != 0) for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-4+i, UnsignedInt(_positions.size())+i}); + + _positions.emplace_back(0.0f, startY + Math::sin(angle), Math::cos(angle)); + _positions.emplace_back(Math::cos(angle), startY + Math::sin(angle), 0.0f); + _positions.emplace_back(0.0f, startY + Math::sin(angle), -Math::cos(angle)); + _positions.emplace_back(-Math::cos(angle), startY + Math::sin(angle), 0.0f); + } + + /* Final vertex */ + _positions.push_back(Vector3::yAxis(startY + 1.0f)); + + /* Connect last ring to final vertex */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-5+i, UnsignedInt(_positions.size())-1}); +} + +void WireframeSpheroid::ring(const Float y) { + /* Ring vertices and indices */ + const Rad segmentAngleIncrement(Constants::pi()/(2*_segments)); + for(UnsignedInt j = 0; j != _segments; ++j) { + for(UnsignedInt i = 0; i != 4; ++i) { + const Rad segmentAngle = Rad(i*Constants::pi()/2) + j*segmentAngleIncrement; + if(j != 0) _indices.insert(_indices.end(), {UnsignedInt(_positions.size()-4), UnsignedInt(_positions.size())}); + _positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle)); + } + } + + /* Close the ring */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-4+i, UnsignedInt(_positions.size())-4*_segments+(i+1)%4}); +} + +void WireframeSpheroid::cylinder() { + /* Connect four vertex pairs of previous and next ring */ + for(UnsignedInt i = 0; i != 4; ++i) + _indices.insert(_indices.end(), {UnsignedInt(_positions.size())-4*_segments+i, UnsignedInt(_positions.size())+i}); +} + +Trade::MeshData3D WireframeSpheroid::finalize() { + return Trade::MeshData3D(Mesh::Primitive::Lines, std::move(_indices), {std::move(_positions)}, {}, {}); +} + +}}} diff --git a/src/Primitives/Implementation/WireframeSpheroid.h b/src/Primitives/Implementation/WireframeSpheroid.h new file mode 100644 index 000000000..04f40fc5f --- /dev/null +++ b/src/Primitives/Implementation/WireframeSpheroid.h @@ -0,0 +1,54 @@ +#ifndef Magnum_Primitives_WireframeSpheroid_h +#define Magnum_Primitives_WireframeSpheroid_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "Magnum.h" +#include "Trade/Trade.h" + +namespace Magnum { namespace Primitives { namespace Implementation { + +class WireframeSpheroid { + public: + WireframeSpheroid(UnsignedInt segments); + + void bottomHemisphere(Float endY, UnsignedInt rings); + void topHemisphere(Float startY, UnsignedInt rings); + void ring(Float y); + void cylinder(); + + Trade::MeshData3D finalize(); + + private: + UnsignedInt _segments; + + std::vector _indices; + std::vector _positions; +}; + +}}} + +#endif diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Primitives/Test/CapsuleTest.cpp index 4e41eae02..77e7be8e3 100644 --- a/src/Primitives/Test/CapsuleTest.cpp +++ b/src/Primitives/Test/CapsuleTest.cpp @@ -38,16 +38,18 @@ class CapsuleTest: public TestSuite::Tester { public: CapsuleTest(); - void withoutTextureCoords(); - void withTextureCoords(); + void solidWithoutTextureCoords(); + void solidWithTextureCoords(); + void wireframe(); }; CapsuleTest::CapsuleTest() { - addTests({&CapsuleTest::withoutTextureCoords, - &CapsuleTest::withTextureCoords}); + addTests({&CapsuleTest::solidWithoutTextureCoords, + &CapsuleTest::solidWithTextureCoords, + &CapsuleTest::wireframe}); } -void CapsuleTest::withoutTextureCoords() { +void CapsuleTest::solidWithoutTextureCoords() { Trade::MeshData3D capsule = Capsule::solid(2, 2, 3, 1.0f); CORRADE_COMPARE_AS(capsule.positions(0), (std::vector{ @@ -112,7 +114,7 @@ void CapsuleTest::withoutTextureCoords() { }), TestSuite::Compare::Container); } -void CapsuleTest::withTextureCoords() { +void CapsuleTest::solidWithTextureCoords() { Trade::MeshData3D capsule = Capsule::solid(2, 2, 3, 1.0f, Capsule::TextureCoords::Generate); CORRADE_COMPARE_AS(capsule.positions(0), (std::vector{ @@ -187,6 +189,74 @@ void CapsuleTest::withTextureCoords() { }), TestSuite::Compare::Container); } +void CapsuleTest::wireframe() { + Trade::MeshData3D capsule = Capsule::wireframe(2, 2, 8, 1.0f); + + CORRADE_COMPARE_AS(capsule.positions(0), (std::vector{ + {0.0f, -1.5f, 0.0f}, + + {0.0f, -1.20711f, 0.707107f}, + {0.707107f, -1.20711f, 0.0f}, + {0.0f, -1.20711f, -0.707107f}, + {-0.707107f, -1.20711f, 0.0f}, + + {0.0f, -0.5f, 1.0f}, + {1.0f, -0.5f, 0.0f}, + {0.0f, -0.5f, -1.0f}, + {-1.0f, -0.5f, 0.0f}, + {0.707107f, -0.5f, 0.707107f}, + {0.707107f, -0.5f, -0.707107f}, + {-0.707107f, -0.5f, -0.707107f}, + {-0.707107f, -0.5f, 0.707107f}, + + {0.0f, 0.0f, 1.0f}, + {1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, -1.0f}, + {-1.0f, 0.0f, 0.0f}, + {0.707107f, 0.0f, 0.707107f}, + {0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, 0.707107f}, + + {0.0f, 0.5f, 1.0f}, + {1.0f, 0.5f, 0.0f}, + {0.0f, 0.5f, -1.0f}, + {-1.0f, 0.5f, 0.0f}, + {0.707107f, 0.5f, 0.707107f}, + {0.707107f, 0.5f, -0.707107f}, + {-0.707107f, 0.5f, -0.707107f}, + {-0.707107f, 0.5f, 0.707107f}, + + {0.0f, 1.20711f, 0.707107f}, + {0.707107f, 1.20711f, 0.0f}, + {0.0f, 1.20711f, -0.707107f}, + {-0.707107f, 1.20711f, 0.0f}, + + {0.0f, 1.5f, 0.0f} + }), TestSuite::Compare::Container); + + CORRADE_COMPARE(capsule.normalArrayCount(), 0); + + CORRADE_COMPARE_AS(capsule.indices(), (std::vector{ + 0, 1, 0, 2, 0, 3, 0, 4, + 1, 5, 2, 6, 3, 7, 4, 8, + 5, 9, 6, 10, 7, 11, 8, 12, + 9, 6, 10, 7, 11, 8, 12, 5, + + 5, 13, 6, 14, 7, 15, 8, 16, + + 13, 17, 14, 18, 15, 19, 16, 20, + 17, 14, 18, 15, 19, 16, 20, 13, + + 13, 21, 14, 22, 15, 23, 16, 24, + + 21, 25, 22, 26, 23, 27, 24, 28, + 25, 22, 26, 23, 27, 24, 28, 21, + 21, 29, 22, 30, 23, 31, 24, 32, + 29, 33, 30, 33, 31, 33, 32, 33 + }), TestSuite::Compare::Container); +} + }}} CORRADE_TEST_MAIN(Magnum::Primitives::Test::CapsuleTest) diff --git a/src/Primitives/Test/CylinderTest.cpp b/src/Primitives/Test/CylinderTest.cpp index 33e8a7d43..7aa532bf6 100644 --- a/src/Primitives/Test/CylinderTest.cpp +++ b/src/Primitives/Test/CylinderTest.cpp @@ -35,16 +35,18 @@ class CylinderTest: public TestSuite::Tester { public: CylinderTest(); - void withoutAnything(); - void withTextureCoordsAndCaps(); + void solidWithoutAnything(); + void solidWithTextureCoordsAndCaps(); + void wireframe(); }; CylinderTest::CylinderTest() { - addTests({&CylinderTest::withoutAnything, - &CylinderTest::withTextureCoordsAndCaps}); + addTests({&CylinderTest::solidWithoutAnything, + &CylinderTest::solidWithTextureCoordsAndCaps, + &CylinderTest::wireframe}); } -void CylinderTest::withoutAnything() { +void CylinderTest::solidWithoutAnything() { Trade::MeshData3D cylinder = Cylinder::solid(2, 3, 3.0f); CORRADE_COMPARE_AS(cylinder.positions(0), (std::vector{ @@ -81,7 +83,7 @@ void CylinderTest::withoutAnything() { }), TestSuite::Compare::Container); } -void CylinderTest::withTextureCoordsAndCaps() { +void CylinderTest::solidWithTextureCoordsAndCaps() { Trade::MeshData3D cylinder = Cylinder::solid(2, 3, 3.0f, Cylinder::Flag::GenerateTextureCoords|Cylinder::Flag::CapEnds); CORRADE_COMPARE_AS(cylinder.positions(0), (std::vector{ @@ -185,6 +187,56 @@ void CylinderTest::withTextureCoordsAndCaps() { }), TestSuite::Compare::Container); } +void CylinderTest::wireframe() { + Trade::MeshData3D cylinder = Cylinder::wireframe(2, 8, 1.0f); + + CORRADE_COMPARE_AS(cylinder.positions(0), (std::vector{ + {0.0f, -0.5f, 1.0f}, + {1.0f, -0.5f, 0.0f}, + {0.0f, -0.5f, -1.0f}, + {-1.0f, -0.5f, 0.0f}, + {0.707107f, -0.5f, 0.707107f}, + {0.707107f, -0.5f, -0.707107f}, + {-0.707107f, -0.5f, -0.707107f}, + {-0.707107f, -0.5f, 0.707107f}, + + {0.0f, 0.0f, 1.0f}, + {1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, -1.0f}, + {-1.0f, 0.0f, 0.0f}, + {0.707107f, 0.0f, 0.707107f}, + {0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, 0.707107f}, + + {0.0f, 0.5f, 1.0f}, + {1.0f, 0.5f, 0.0f}, + {0.0f, 0.5f, -1.0f}, + {-1.0f, 0.5f, 0.0f}, + {0.707107f, 0.5f, 0.707107f}, + {0.707107f, 0.5f, -0.707107f}, + {-0.707107f, 0.5f, -0.707107f}, + {-0.707107f, 0.5f, 0.707107f} + }), TestSuite::Compare::Container); + + CORRADE_COMPARE(cylinder.normalArrayCount(), 0); + + CORRADE_COMPARE_AS(cylinder.indices(), (std::vector{ + 0, 4, 1, 5, 2, 6, 3, 7, + 4, 1, 5, 2, 6, 3, 7, 0, + + 0, 8, 1, 9, 2, 10, 3, 11, + + 8, 12, 9, 13, 10, 14, 11, 15, + 12, 9, 13, 10, 14, 11, 15, 8, + + 8, 16, 9, 17, 10, 18, 11, 19, + + 16, 20, 17, 21, 18, 22, 19, 23, + 20, 17, 21, 18, 22, 19, 23, 16 + }), TestSuite::Compare::Container); +} + }}} CORRADE_TEST_MAIN(Magnum::Primitives::Test::CylinderTest) diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Primitives/Test/UVSphereTest.cpp index 46f25bbf0..f4df1a54e 100644 --- a/src/Primitives/Test/UVSphereTest.cpp +++ b/src/Primitives/Test/UVSphereTest.cpp @@ -35,16 +35,18 @@ class UVSphereTest: public TestSuite::Tester { public: UVSphereTest(); - void withoutTextureCoords(); - void withTextureCoords(); + void solidWithoutTextureCoords(); + void solidWithTextureCoords(); + void wireframe(); }; UVSphereTest::UVSphereTest() { - addTests({&UVSphereTest::withoutTextureCoords, - &UVSphereTest::withTextureCoords}); + addTests({&UVSphereTest::solidWithoutTextureCoords, + &UVSphereTest::solidWithTextureCoords, + &UVSphereTest::wireframe}); } -void UVSphereTest::withoutTextureCoords() { +void UVSphereTest::solidWithoutTextureCoords() { Trade::MeshData3D sphere = UVSphere::solid(3, 3); CORRADE_COMPARE_AS(sphere.positions(0), (std::vector{ @@ -82,7 +84,7 @@ void UVSphereTest::withoutTextureCoords() { }), TestSuite::Compare::Container); } -void UVSphereTest::withTextureCoords() { +void UVSphereTest::solidWithTextureCoords() { Trade::MeshData3D sphere = UVSphere::solid(3, 3, UVSphere::TextureCoords::Generate); CORRADE_COMPARE_AS(sphere.positions(0), (std::vector{ @@ -124,6 +126,48 @@ void UVSphereTest::withTextureCoords() { }), TestSuite::Compare::Container); } +void UVSphereTest::wireframe() { + Trade::MeshData3D sphere = UVSphere::wireframe(4, 8); + + CORRADE_COMPARE_AS(sphere.positions(0), (std::vector{ + {0.0f, -1.0f, 0.0f}, + + {0.0f, -0.707107f, 0.707107f}, + {0.707107f, -0.707107f, 0.0f}, + {0.0f, -0.707107f, -0.707107f}, + {-0.707107f, -0.707107f, 0.0f}, + + {0.0f, 0.0f, 1.0f}, + {1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, -1.0f}, + {-1.0f, 0.0f, 0.0f}, + {0.707107f, 0.0f, 0.707107f}, + {0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, -0.707107f}, + {-0.707107f, 0.0f, 0.707107f}, + + {0.0f, 0.707107f, 0.707107f}, + {0.707107f, 0.707107f, 0.0f}, + {0.0f, 0.707107f, -0.707107f}, + {-0.707107f, 0.707107f, 0.0f}, + + {0.0f, 1.0f, 0.0f} + }), TestSuite::Compare::Container); + + CORRADE_COMPARE(sphere.normalArrayCount(), 0); + + CORRADE_COMPARE_AS(sphere.indices(), (std::vector{ + 0, 1, 0, 2, 0, 3, 0, 4, + 1, 5, 2, 6, 3, 7, 4, 8, + + 5, 9, 6, 10, 7, 11, 8, 12, + 9, 6, 10, 7, 11, 8, 12, 5, + + 5, 13, 6, 14, 7, 15, 8, 16, + 13, 17, 14, 17, 15, 17, 16, 17 + }), TestSuite::Compare::Container); +} + }}} CORRADE_TEST_MAIN(Magnum::Primitives::Test::UVSphereTest) diff --git a/src/Primitives/UVSphere.cpp b/src/Primitives/UVSphere.cpp index b4003300f..75e67ba5e 100644 --- a/src/Primitives/UVSphere.cpp +++ b/src/Primitives/UVSphere.cpp @@ -26,6 +26,7 @@ #include "Math/Vector3.h" #include "Primitives/Implementation/Spheroid.h" +#include "Primitives/Implementation/WireframeSpheroid.h" #include "Trade/MeshData3D.h" namespace Magnum { namespace Primitives { @@ -57,4 +58,17 @@ Trade::MeshData3D UVSphere::solid(UnsignedInt rings, UnsignedInt segments, Textu return sphere.finalize(); } +Trade::MeshData3D UVSphere::wireframe(const UnsignedInt rings, const UnsignedInt segments) { + CORRADE_ASSERT(rings >= 2 && rings%2 == 0 && segments >= 4 && segments%2 == 0, "Primitives::UVSphere::wireframe(): improper parameters", Trade::MeshData3D(Mesh::Primitive::Lines, {}, {}, {}, {})); + + Implementation::WireframeSpheroid sphere(segments/4); + + /* Make sphere */ + sphere.bottomHemisphere(0.0f, rings/2); + sphere.ring(0.0f); + sphere.topHemisphere(0.0f, rings/2); + + return sphere.finalize(); +} + }} diff --git a/src/Primitives/UVSphere.h b/src/Primitives/UVSphere.h index 7cfb75b94..df0fcdda5 100644 --- a/src/Primitives/UVSphere.h +++ b/src/Primitives/UVSphere.h @@ -59,6 +59,17 @@ class MAGNUM_PRIMITIVES_EXPORT UVSphere { * vertices of one segment are duplicated for texture wrapping. */ static Trade::MeshData3D solid(UnsignedInt rings, UnsignedInt segments, TextureCoords textureCoords = TextureCoords::DontGenerate); + + /** + * @brief Wireframe UV sphere + * @param rings Number of (line) rings. Must be larger or equal + * to 2 and multiple of 2. + * @param segments Number of (line) segments. Must be larger or + * equal to 4 and multiple of 4. + * + * Indexed @ref Mesh::Primitive "Lines". + */ + static Trade::MeshData3D wireframe(UnsignedInt rings, UnsignedInt segments); }; }} From e72bf297ab13b2492fdf0d66eba0260b6debe47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Jul 2013 23:38:45 +0200 Subject: [PATCH 07/90] DebugTools: implemented ShapeRenderer for 3D sphere. --- src/DebugTools/Implementation/SphereRenderer.cpp | 7 +++++++ src/DebugTools/Implementation/SphereRenderer.h | 5 +++++ src/DebugTools/ShapeRenderer.cpp | 9 ++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/DebugTools/Implementation/SphereRenderer.cpp index 6452e9e8e..43faf06a1 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/DebugTools/Implementation/SphereRenderer.cpp @@ -28,8 +28,10 @@ #include "DebugTools/ShapeRenderer.h" #include "Shapes/Sphere.h" #include "Primitives/Circle.h" +#include "Primitives/UVSphere.h" #include "Shaders/Flat.h" #include "Trade/MeshData2D.h" +#include "Trade/MeshData3D.h" namespace Magnum { namespace DebugTools { namespace Implementation { @@ -37,6 +39,10 @@ AbstractSphereRenderer<2>::AbstractSphereRenderer(): AbstractShapeRenderer<2>("s if(!wireframeMesh) createResources(Primitives::Circle::wireframe(40)); } +AbstractSphereRenderer<3>::AbstractSphereRenderer(): AbstractShapeRenderer<3>("sphere3d", "sphere3d-vertices", "sphere3d-indices") { + if(!wireframeMesh) createResources(Primitives::UVSphere::wireframe(40, 20)); +} + template SphereRenderer::SphereRenderer(const Shapes::Implementation::AbstractShape* sphere): sphere(static_cast>*>(sphere)->shape) {} template void SphereRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { @@ -49,5 +55,6 @@ template void SphereRenderer::draw(Resource< } template class SphereRenderer<2>; +template class SphereRenderer<3>; }}} diff --git a/src/DebugTools/Implementation/SphereRenderer.h b/src/DebugTools/Implementation/SphereRenderer.h index 15d12048c..232231732 100644 --- a/src/DebugTools/Implementation/SphereRenderer.h +++ b/src/DebugTools/Implementation/SphereRenderer.h @@ -39,6 +39,11 @@ template<> class AbstractSphereRenderer<2>: public AbstractShapeRenderer<2> { AbstractSphereRenderer(); }; +template<> class AbstractSphereRenderer<3>: public AbstractShapeRenderer<3> { + public: + AbstractSphereRenderer(); +}; + template class SphereRenderer: public AbstractSphereRenderer { public: SphereRenderer(const Shapes::Implementation::AbstractShape* sphere); diff --git a/src/DebugTools/ShapeRenderer.cpp b/src/DebugTools/ShapeRenderer.cpp index d1843d0d1..52cf39947 100644 --- a/src/DebugTools/ShapeRenderer.cpp +++ b/src/DebugTools/ShapeRenderer.cpp @@ -53,15 +53,15 @@ template<> void createDebugMesh(ShapeRenderer<2>* renderer, const Shapes::Implem case Shapes::AbstractShape2D::Type::Point: renderer->renderers.push_back(new Implementation::PointRenderer<2>(shape)); break; + case Shapes::AbstractShape2D::Type::Sphere: + renderer->renderers.push_back(new Implementation::SphereRenderer<2>(shape)); + break; case Shapes::AbstractShape2D::Type::Composition: { const Shapes::Composition2D& composition = static_cast*>(shape)->shape; for(std::size_t i = 0; i != composition.size(); ++i) createDebugMesh(renderer, Shapes::Implementation::getAbstractShape(composition, i)); } break; - case Shapes::AbstractShape2D::Type::Sphere: - renderer->renderers.push_back(new Implementation::SphereRenderer<2>(shape)); - break; default: Warning() << "DebugTools::ShapeRenderer2D::createShapeRenderer(): type" << shape->type() << "not implemented"; } @@ -81,6 +81,9 @@ template<> void createDebugMesh(ShapeRenderer<3>* renderer, const Shapes::Implem case Shapes::AbstractShape3D::Type::Point: renderer->renderers.push_back(new Implementation::PointRenderer<3>(shape)); break; + case Shapes::AbstractShape3D::Type::Sphere: + renderer->renderers.push_back(new Implementation::SphereRenderer<3>(shape)); + break; case Shapes::AbstractShape3D::Type::Composition: { const Shapes::Composition3D& composition = static_cast*>(shape)->shape; From 99c72ed99b54be2911107aee183606f390122eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:04:06 +0200 Subject: [PATCH 08/90] Initial support for OpenGL 4.4. --- Doxyfile | 1 + doc/required-extensions.dox | 2 ++ src/Buffer.h | 2 +- src/Context.cpp | 12 ++++++++++++ src/Context.h | 1 + src/Extensions.h | 10 +++++++++- src/Platform/magnum-info.cpp | 1 + src/Shader.cpp | 1 + 8 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Doxyfile b/Doxyfile index 257379fc2..ec9dbea6a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -216,6 +216,7 @@ ALIASES = \ "requires_gl41=@xrefitem requires-gl41 \"Requires OpenGL 4.1\" \"Functionality requiring OpenGL 4.1\"" \ "requires_gl42=@xrefitem requires-gl42 \"Requires OpenGL 4.2\" \"Functionality requiring OpenGL 4.2\"" \ "requires_gl43=@xrefitem requires-gl43 \"Requires OpenGL 4.3\" \"Functionality requiring OpenGL 4.3\"" \ + "requires_gl44=@xrefitem requires-gl44 \"Requires OpenGL 4.4\" \"Functionality requiring OpenGL 4.4\"" \ "requires_extension=@xrefitem requires-extension \"Requires OpenGL extension\" \"Functionality requiring specific OpenGL extension\"" \ "extension{2}=\1_\2" \ "requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \ diff --git a/doc/required-extensions.dox b/doc/required-extensions.dox index 2d56cfa65..e2c4d8b14 100644 --- a/doc/required-extensions.dox +++ b/doc/required-extensions.dox @@ -46,6 +46,7 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). - @subpage requires-gl41 - @subpage requires-gl42 - @subpage requires-gl43 +- @subpage requires-gl44 - @subpage requires-extension - @subpage requires-gl - @subpage requires-gles20 @@ -61,6 +62,7 @@ supported on Intel GPUs even if they are capable of OpenGL 2.1 only). @page requires-gl41 Functionality requiring OpenGL 4.1 @page requires-gl42 Functionality requiring OpenGL 4.2 @page requires-gl43 Functionality requiring OpenGL 4.3 +@page requires-gl44 Functionality requiring OpenGL 4.4 @page requires-extension Functionality requiring specific OpenGL extension diff --git a/src/Buffer.h b/src/Buffer.h index 7cbc99ae2..0fe35faaa 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -119,7 +119,7 @@ OpenGL in order to preserve the data. If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} is not available, these functions do nothing. -@todo Support for AMD's query buffer (@extension{AMD,query_buffer_object}) +@todo Support for AMD/ARB's query buffer (@extension{AMD,query_buffer_object}, @extension{ARB,query_buffer_object}) @todo BindBufferRange/BindBufferOffset/BindBufferBase for transform feedback (3.0, @extension{EXT,transform_feedback}) */ class MAGNUM_EXPORT Buffer { diff --git a/src/Context.cpp b/src/Context.cpp index a2d290dee..1b7f9d72e 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -61,6 +61,7 @@ Debug operator<<(Debug debug, Version value) { _c(GL410, "OpenGL 4.1") _c(GL420, "OpenGL 4.2") _c(GL430, "OpenGL 4.3") + _c(GL440, "OpenGL 4.4") #else _c(GLES200, "OpenGL ES 2.0") _c(GLES300, "OpenGL ES 3.0") @@ -195,6 +196,15 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,ARB,texture_storage_multisample), _extension(GL,ARB,texture_view), _extension(GL,ARB,vertex_attrib_binding)}; + static const std::vector extensions440{ + _extension(GL,ARB,buffer_storage), + _extension(GL,ARB,clear_texture), + _extension(GL,ARB,enhanced_layouts), + _extension(GL,ARB,multi_bind), + _extension(GL,ARB,query_buffer_object), + _extension(GL,ARB,texture_mirror_clamp_to_edge), + _extension(GL,ARB,texture_stencil8), + _extension(GL,ARB,vertex_type_10f_11f_11f_rev)}; #undef _extension #else static const std::vector extensions{ @@ -271,6 +281,7 @@ const std::vector& Extension::extensions(Version version) { case Version::GL420: return extensions420; /* case Version::GLES300: */ case Version::GL430: return extensions430; + case Version::GL440: return extensions440; #else case Version::GLES200: return empty; case Version::GLES300: return extensionsES300; @@ -322,6 +333,7 @@ Context::Context() { Version::GL410, Version::GL420, Version::GL430, + Version::GL440, #else Version::GLES200, Version::GLES300, diff --git a/src/Context.h b/src/Context.h index d768897fc..3bdd1c6f0 100644 --- a/src/Context.h +++ b/src/Context.h @@ -59,6 +59,7 @@ enum class Version: Int { GL410 = 410, /**< @brief OpenGL 4.1, GLSL 4.10 */ GL420 = 420, /**< @brief OpenGL 4.2, GLSL 4.20 */ GL430 = 430, /**< @brief OpenGL 4.3, GLSL 4.30 */ + GL440 = 440, /**< @brief OpenGL 4.4, GLSL 4.40 */ #endif /** diff --git a/src/Extensions.h b/src/Extensions.h index 249dad0db..80595b3a2 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -153,6 +153,14 @@ namespace GL { _extension(GL,ARB,texture_buffer_range, GL210, GL430) // #139 _extension(GL,ARB,texture_query_levels, GL300, GL430) // #140 _extension(GL,ARB,texture_storage_multisample, GL210, GL430) // #141 + _extension(GL,ARB,buffer_storage, /*?*/ GL430, GL440) // #144 + _extension(GL,ARB,clear_texture, GL210, GL440) // #145 + _extension(GL,ARB,enhanced_layouts, GL310, GL440) // #146 + _extension(GL,ARB,multi_bind, GL300, GL440) // #147 + _extension(GL,ARB,query_buffer_object, GL210, GL440) // #148 + _extension(GL,ARB,texture_mirror_clamp_to_edge, GL210, GL440) // #149 + _extension(GL,ARB,texture_stencil8, GL210, GL440) // #150 + _extension(GL,ARB,vertex_type_10f_11f_11f_rev, GL300, GL440) // #151 } namespace EXT { _extension(GL,EXT,texture_filter_anisotropic, GL210, None) // #187 /* EXT_framebuffer_object, EXT_packed_depth_stencil, EXT_framebuffer_blit, @@ -181,7 +189,7 @@ namespace GL { _extension(GL,NV,conditional_render, GL210, GL300) // #346 /* NV_draw_texture not supported */ // #430 } - /* IMPORTANT: if this line is > 188 (57 + size), don't forget to update array size in Context.h */ + /* IMPORTANT: if this line is > 194 (67 + size), don't forget to update array size in Context.h */ #else #line 1 namespace ANGLE { diff --git a/src/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 74129639a..8def78d74 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -119,6 +119,7 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat Version::GL410, Version::GL420, Version::GL430, + Version::GL440, #else Version::GLES200, Version::GLES300, diff --git a/src/Shader.cpp b/src/Shader.cpp index d71cea9bd..5b12c8b03 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -71,6 +71,7 @@ Shader::Shader(const Version version, const Type type): _type(type), _id(0) { case Version::GL410: sources.push_back("#version 410\n"); return; case Version::GL420: sources.push_back("#version 420\n"); return; case Version::GL430: sources.push_back("#version 430\n"); return; + case Version::GL440: sources.push_back("#version 440\n"); return; #else case Version::GLES200: sources.push_back("#version 100\n"); return; case Version::GLES300: sources.push_back("#version 300\n"); return; From 48260e2479da9bf2dc7ad94ef6a3b48cf9628e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:18:57 +0200 Subject: [PATCH 09/90] Assert instead of returning empty list in Context::supportedExtensions(). --- src/Context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Context.cpp b/src/Context.cpp index 1b7f9d72e..eb3b97165 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -288,7 +288,7 @@ const std::vector& Extension::extensions(Version version) { #endif } - return empty; + CORRADE_ASSERT_UNREACHABLE(); } Context* Context::_current = nullptr; From 9f61c08e97867c6cd847c96fe3960c2182b262da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:20:02 +0200 Subject: [PATCH 10/90] Support for ARB_texture_stencil8. --- src/AbstractTexture.cpp | 10 ++++++++++ src/ImageFormat.h | 7 +++++-- src/TextureFormat.h | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index fc02749d7..26835ac0b 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -423,6 +423,11 @@ ImageFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in #endif return ImageFormat::DepthComponent; + #ifndef MAGNUM_TARGET_GLES + case TextureFormat::StencilIndex8: + return ImageFormat::StencilIndex; + #endif + case TextureFormat::DepthStencil: case TextureFormat::Depth24Stencil8: #ifndef MAGNUM_TARGET_GLES2 @@ -605,6 +610,11 @@ ImageType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern return ImageType::Float; #endif + #ifndef MAGNUM_TARGET_GLES + case TextureFormat::StencilIndex8: + return ImageType::UnsignedByte; + #endif + case TextureFormat::DepthStencil: case TextureFormat::Depth24Stencil8: return ImageType::UnsignedInt248; diff --git a/src/ImageFormat.h b/src/ImageFormat.h index 308f1f023..9ab0818a9 100644 --- a/src/ImageFormat.h +++ b/src/ImageFormat.h @@ -223,8 +223,11 @@ enum class ImageFormat: GLenum { #ifndef MAGNUM_TARGET_GLES3 /** - * Stencil index. For framebuffer reading only. - * @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil} + * Stencil index. + * @requires_gl44 %Extension @extension{ARB,texture_stencil8} for texture + * data, otherwise for framebuffer reading only. + * @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil}, + * for framebuffer reading only. * @todo Where to get GL_STENCIL_INDEX in ES? */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/TextureFormat.h b/src/TextureFormat.h index 86d68f36e..5625ffc0d 100644 --- a/src/TextureFormat.h +++ b/src/TextureFormat.h @@ -809,6 +809,15 @@ enum class TextureFormat: GLenum { DepthComponent32F = GL_DEPTH_COMPONENT32F, #endif + #ifndef MAGNUM_TARGET_GLES + /** + * Stencil index, 8bit. + * @requires_gl44 %Extension @extension{ARB,texture_stencil8} + * @requires_gl Only available as renderbuffer format in OpenGL ES. + */ + StencilIndex8 = GL_STENCIL_INDEX8, + #endif + /** * Depth and stencil component, size implementation-dependent. * @deprecated Prefer to use exactly specified version of this format, e.g. From b3e42f1ca439478bcce294e992f5c7a284900264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:44:09 +0200 Subject: [PATCH 11/90] Updated upstream OpenGL header for 4.4. --- external/OpenGL/GL/glcorearb.h | 5219 ++++++++++++-------------------- 1 file changed, 1968 insertions(+), 3251 deletions(-) diff --git a/external/OpenGL/GL/glcorearb.h b/external/OpenGL/GL/glcorearb.h index 9274c0fb4..af7c4012d 100644 --- a/external/OpenGL/GL/glcorearb.h +++ b/external/OpenGL/GL/glcorearb.h @@ -1,12 +1,12 @@ #ifndef __glcorearb_h_ -#define __glcorearb_h_ +#define __glcorearb_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2007-2012 The Khronos Group Inc. +** Copyright (c) 2013 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -27,36 +27,19 @@ extern "C" { ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ - -/* glcorearb.h replaces gl3.h. It is for use with OpenGL core - * profile implementations. - * - * glcorearb.h last updated on $Date: 2013-02-07 01:42:49 -0800 (Thu, 07 Feb 2013) $ - * - * RELEASE NOTES - 2013/02/07 - * - * glcorearb.h should be placed in the same directory as gl.h and - * included as - * ''. - * - * glcorearb.h includes only APIs in the latest OpenGL core profile - * implementation together with APIs in newer ARB extensions which can be - * can be supported by the core profile. It does not, and never will - * include functionality removed from the core profile, such as - * fixed-function vertex and fragment processing. - * - * It is not possible to #include both and either of - * or in the same source file. - * - * Feedback can be given by registering for the Khronos Bugzilla - * (www.khronos.org/bugzilla) and filing issues there under product - * "OpenGL", category "Registry". - */ - -/* Function declaration macros - to move into glplatform.h */ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 +#endif #include #endif @@ -70,36 +53,151 @@ extern "C" { #define GLAPI extern #endif -/* Base GL types */ +/* glcorearb.h is for use with OpenGL core profile implementations. +** It should should be placed in the same directory as gl.h and +** included as . +** +** glcorearb.h includes only APIs in the latest OpenGL core profile +** implementation together with APIs in newer ARB extensions which +** can be supported by the core profile. It does not, and never will +** include functionality removed from the core profile, such as +** fixed-function vertex and fragment processing. +** +** Do not #include both and either of or +** in the same source file. +*/ + +/* Generated C header for: + * API: gl + * Profile: core + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: glcore + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef signed char GLbyte; -typedef short GLshort; +typedef float GLfloat; typedef int GLint; typedef int GLsizei; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef unsigned short GLhalf; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; typedef void GLvoid; - -/*************************************************************/ +typedef unsigned int GLbitfield; +typedef double GLdouble; +typedef unsigned int GLuint; +typedef unsigned char GLboolean; +typedef unsigned char GLubyte; +typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size); +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLFINISHPROC) (void); +typedef void (APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode); +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *params); +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *params); +typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far); +typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullFace (GLenum mode); +GLAPI void APIENTRY glFrontFace (GLenum mode); +GLAPI void APIENTRY glHint (GLenum target, GLenum mode); +GLAPI void APIENTRY glLineWidth (GLfloat width); +GLAPI void APIENTRY glPointSize (GLfloat size); +GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); +GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glDrawBuffer (GLenum mode); +GLAPI void APIENTRY glClear (GLbitfield mask); +GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glClearStencil (GLint s); +GLAPI void APIENTRY glClearDepth (GLdouble depth); +GLAPI void APIENTRY glStencilMask (GLuint mask); +GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void APIENTRY glDepthMask (GLboolean flag); +GLAPI void APIENTRY glDisable (GLenum cap); +GLAPI void APIENTRY glEnable (GLenum cap); +GLAPI void APIENTRY glFinish (void); +GLAPI void APIENTRY glFlush (void); +GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GLAPI void APIENTRY glLogicOp (GLenum opcode); +GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void APIENTRY glDepthFunc (GLenum func); +GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); +GLAPI void APIENTRY glReadBuffer (GLenum mode); +GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *params); +GLAPI GLenum APIENTRY glGetError (void); +GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params); +GLAPI const GLubyte *APIENTRY glGetString (GLenum name); +GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); +GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far); +GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_VERSION_1_0 */ #ifndef GL_VERSION_1_1 -/* AttribMask */ +#define GL_VERSION_1_1 1 +typedef float GLclampf; +typedef double GLclampd; #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 -/* Boolean */ #define GL_FALSE 0 #define GL_TRUE 1 -/* BeginMode */ #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 @@ -108,7 +206,6 @@ typedef void GLvoid; #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 #define GL_QUADS 0x0007 -/* AlphaFunction */ #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 @@ -117,7 +214,6 @@ typedef void GLvoid; #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 -/* BlendingFactorDest */ #define GL_ZERO 0 #define GL_ONE 1 #define GL_SRC_COLOR 0x0300 @@ -126,11 +222,9 @@ typedef void GLvoid; #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 -/* BlendingFactorSrc */ #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 -/* DrawBufferMode */ #define GL_NONE 0 #define GL_FRONT_LEFT 0x0400 #define GL_FRONT_RIGHT 0x0401 @@ -141,16 +235,13 @@ typedef void GLvoid; #define GL_LEFT 0x0406 #define GL_RIGHT 0x0407 #define GL_FRONT_AND_BACK 0x0408 -/* ErrorCode */ #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_OUT_OF_MEMORY 0x0505 -/* FrontFaceDirection */ #define GL_CW 0x0900 #define GL_CCW 0x0901 -/* GetPName */ #define GL_POINT_SIZE 0x0B11 #define GL_POINT_SIZE_RANGE 0x0B12 #define GL_POINT_SIZE_GRANULARITY 0x0B13 @@ -218,7 +309,6 @@ typedef void GLvoid; #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_TEXTURE_BINDING_1D 0x8068 #define GL_TEXTURE_BINDING_2D 0x8069 -/* GetTextureParameter */ #define GL_TEXTURE_WIDTH 0x1000 #define GL_TEXTURE_HEIGHT 0x1001 #define GL_TEXTURE_INTERNAL_FORMAT 0x1003 @@ -227,11 +317,9 @@ typedef void GLvoid; #define GL_TEXTURE_GREEN_SIZE 0x805D #define GL_TEXTURE_BLUE_SIZE 0x805E #define GL_TEXTURE_ALPHA_SIZE 0x805F -/* HintMode */ #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 -/* DataType */ #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 @@ -240,10 +328,8 @@ typedef void GLvoid; #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_DOUBLE 0x140A -/* ErrorCode */ #define GL_STACK_OVERFLOW 0x0503 #define GL_STACK_UNDERFLOW 0x0504 -/* LogicOp */ #define GL_CLEAR 0x1500 #define GL_AND 0x1501 #define GL_AND_REVERSE 0x1502 @@ -260,13 +346,10 @@ typedef void GLvoid; #define GL_OR_INVERTED 0x150D #define GL_NAND 0x150E #define GL_SET 0x150F -/* MatrixMode (for gl3.h, FBO attachment type) */ #define GL_TEXTURE 0x1702 -/* PixelCopyType */ #define GL_COLOR 0x1800 #define GL_DEPTH 0x1801 #define GL_STENCIL 0x1802 -/* PixelFormat */ #define GL_STENCIL_INDEX 0x1901 #define GL_DEPTH_COMPONENT 0x1902 #define GL_RED 0x1903 @@ -275,39 +358,30 @@ typedef void GLvoid; #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 -/* PolygonMode */ #define GL_POINT 0x1B00 #define GL_LINE 0x1B01 #define GL_FILL 0x1B02 -/* StencilOp */ #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 #define GL_DECR 0x1E03 -/* StringName */ #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 -/* TextureMagFilter */ #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 -/* TextureMinFilter */ #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 -/* TextureParameterName */ #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 -/* TextureTarget */ #define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_2D 0x8064 -/* TextureWrapMode */ #define GL_REPEAT 0x2901 -/* PixelInternalFormat */ #define GL_R3_G3_B2 0x2A10 #define GL_RGB4 0x804F #define GL_RGB5 0x8050 @@ -322,9 +396,40 @@ typedef void GLvoid; #define GL_RGB10_A2 0x8059 #define GL_RGBA12 0x805A #define GL_RGBA16 0x805B +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, GLvoid **params); +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY glGetPointerv (GLenum pname, GLvoid **params); +GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); +GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GLAPI GLboolean APIENTRY glIsTexture (GLuint texture); #endif +#endif /* GL_VERSION_1_1 */ #ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 @@ -361,23 +466,24 @@ typedef void GLvoid; #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glBlendEquation (GLenum mode); +GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #endif - -#ifndef GL_ARB_imaging -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif +#endif /* GL_VERSION_1_2 */ #ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 @@ -437,9 +543,30 @@ typedef void GLvoid; #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); #endif +#endif /* GL_VERSION_1_3 */ #ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA @@ -456,9 +583,29 @@ typedef void GLvoid; #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid *const*indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid *const*indices, GLsizei drawcount); +GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); #endif +#endif /* GL_VERSION_1_4 */ #ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#include +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 @@ -487,11 +634,56 @@ typedef void GLvoid; #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 #define GL_SRC1_ALPHA 0x8589 +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQuery (GLuint id); +GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQuery (GLenum target); +GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); +GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid **params); #endif +#endif /* GL_VERSION_1_5 */ #ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERSION_2_0 1 +typedef char GLchar; +typedef short GLshort; +typedef signed char GLbyte; +typedef unsigned short GLushort; +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 @@ -570,9 +762,198 @@ typedef void GLvoid; #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum type); +GLAPI void APIENTRY glDeleteProgram (GLuint program); +GLAPI void APIENTRY glDeleteShader (GLuint shader); +GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid **pointer); +GLAPI GLboolean APIENTRY glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY glIsShader (GLuint shader); +GLAPI void APIENTRY glLinkProgram (GLuint program); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI void APIENTRY glUseProgram (GLuint program); +GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glValidateProgram (GLuint program); +GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); #endif +#endif /* GL_VERSION_2_0 */ #ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED @@ -589,9 +970,25 @@ typedef void GLvoid; #define GL_SRGB8_ALPHA8 0x8C43 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); #endif +#endif /* GL_VERSION_2_1 */ #ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +typedef unsigned short GLhalf; #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_CLIP_DISTANCE0 0x3000 #define GL_CLIP_DISTANCE1 0x3001 @@ -692,850 +1089,9 @@ typedef void GLvoid; #define GL_BUFFER_ACCESS_FLAGS 0x911F #define GL_BUFFER_MAP_LENGTH 0x9120 #define GL_BUFFER_MAP_OFFSET 0x9121 -/* Reuse tokens from ARB_depth_buffer_float */ -/* reuse GL_DEPTH_COMPONENT32F */ -/* reuse GL_DEPTH32F_STENCIL8 */ -/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */ -/* Reuse tokens from ARB_framebuffer_object */ -/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ -/* reuse GL_FRAMEBUFFER_DEFAULT */ -/* reuse GL_FRAMEBUFFER_UNDEFINED */ -/* reuse GL_DEPTH_STENCIL_ATTACHMENT */ -/* reuse GL_INDEX */ -/* reuse GL_MAX_RENDERBUFFER_SIZE */ -/* reuse GL_DEPTH_STENCIL */ -/* reuse GL_UNSIGNED_INT_24_8 */ -/* reuse GL_DEPTH24_STENCIL8 */ -/* reuse GL_TEXTURE_STENCIL_SIZE */ -/* reuse GL_TEXTURE_RED_TYPE */ -/* reuse GL_TEXTURE_GREEN_TYPE */ -/* reuse GL_TEXTURE_BLUE_TYPE */ -/* reuse GL_TEXTURE_ALPHA_TYPE */ -/* reuse GL_TEXTURE_DEPTH_TYPE */ -/* reuse GL_UNSIGNED_NORMALIZED */ -/* reuse GL_FRAMEBUFFER_BINDING */ -/* reuse GL_DRAW_FRAMEBUFFER_BINDING */ -/* reuse GL_RENDERBUFFER_BINDING */ -/* reuse GL_READ_FRAMEBUFFER */ -/* reuse GL_DRAW_FRAMEBUFFER */ -/* reuse GL_READ_FRAMEBUFFER_BINDING */ -/* reuse GL_RENDERBUFFER_SAMPLES */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ -/* reuse GL_FRAMEBUFFER_COMPLETE */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ -/* reuse GL_FRAMEBUFFER_UNSUPPORTED */ -/* reuse GL_MAX_COLOR_ATTACHMENTS */ -/* reuse GL_COLOR_ATTACHMENT0 */ -/* reuse GL_COLOR_ATTACHMENT1 */ -/* reuse GL_COLOR_ATTACHMENT2 */ -/* reuse GL_COLOR_ATTACHMENT3 */ -/* reuse GL_COLOR_ATTACHMENT4 */ -/* reuse GL_COLOR_ATTACHMENT5 */ -/* reuse GL_COLOR_ATTACHMENT6 */ -/* reuse GL_COLOR_ATTACHMENT7 */ -/* reuse GL_COLOR_ATTACHMENT8 */ -/* reuse GL_COLOR_ATTACHMENT9 */ -/* reuse GL_COLOR_ATTACHMENT10 */ -/* reuse GL_COLOR_ATTACHMENT11 */ -/* reuse GL_COLOR_ATTACHMENT12 */ -/* reuse GL_COLOR_ATTACHMENT13 */ -/* reuse GL_COLOR_ATTACHMENT14 */ -/* reuse GL_COLOR_ATTACHMENT15 */ -/* reuse GL_DEPTH_ATTACHMENT */ -/* reuse GL_STENCIL_ATTACHMENT */ -/* reuse GL_FRAMEBUFFER */ -/* reuse GL_RENDERBUFFER */ -/* reuse GL_RENDERBUFFER_WIDTH */ -/* reuse GL_RENDERBUFFER_HEIGHT */ -/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */ -/* reuse GL_STENCIL_INDEX1 */ -/* reuse GL_STENCIL_INDEX4 */ -/* reuse GL_STENCIL_INDEX8 */ -/* reuse GL_STENCIL_INDEX16 */ -/* reuse GL_RENDERBUFFER_RED_SIZE */ -/* reuse GL_RENDERBUFFER_GREEN_SIZE */ -/* reuse GL_RENDERBUFFER_BLUE_SIZE */ -/* reuse GL_RENDERBUFFER_ALPHA_SIZE */ -/* reuse GL_RENDERBUFFER_DEPTH_SIZE */ -/* reuse GL_RENDERBUFFER_STENCIL_SIZE */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ -/* reuse GL_MAX_SAMPLES */ -/* Reuse tokens from ARB_framebuffer_sRGB */ -/* reuse GL_FRAMEBUFFER_SRGB */ -/* Reuse tokens from ARB_half_float_vertex */ -/* reuse GL_HALF_FLOAT */ -/* Reuse tokens from ARB_map_buffer_range */ -/* reuse GL_MAP_READ_BIT */ -/* reuse GL_MAP_WRITE_BIT */ -/* reuse GL_MAP_INVALIDATE_RANGE_BIT */ -/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */ -/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */ -/* reuse GL_MAP_UNSYNCHRONIZED_BIT */ -/* Reuse tokens from ARB_texture_compression_rgtc */ -/* reuse GL_COMPRESSED_RED_RGTC1 */ -/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */ -/* reuse GL_COMPRESSED_RG_RGTC2 */ -/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */ -/* Reuse tokens from ARB_texture_rg */ -/* reuse GL_RG */ -/* reuse GL_RG_INTEGER */ -/* reuse GL_R8 */ -/* reuse GL_R16 */ -/* reuse GL_RG8 */ -/* reuse GL_RG16 */ -/* reuse GL_R16F */ -/* reuse GL_R32F */ -/* reuse GL_RG16F */ -/* reuse GL_RG32F */ -/* reuse GL_R8I */ -/* reuse GL_R8UI */ -/* reuse GL_R16I */ -/* reuse GL_R16UI */ -/* reuse GL_R32I */ -/* reuse GL_R32UI */ -/* reuse GL_RG8I */ -/* reuse GL_RG8UI */ -/* reuse GL_RG16I */ -/* reuse GL_RG16UI */ -/* reuse GL_RG32I */ -/* reuse GL_RG32UI */ -/* Reuse tokens from ARB_vertex_array_object */ -/* reuse GL_VERTEX_ARRAY_BINDING */ -#endif - -#ifndef GL_VERSION_3_1 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_RED_SNORM 0x8F90 -#define GL_RG_SNORM 0x8F91 -#define GL_RGB_SNORM 0x8F92 -#define GL_RGBA_SNORM 0x8F93 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -/* Reuse tokens from ARB_copy_buffer */ -/* reuse GL_COPY_READ_BUFFER */ -/* reuse GL_COPY_WRITE_BUFFER */ -/* Reuse tokens from ARB_draw_instanced (none) */ -/* Reuse tokens from ARB_uniform_buffer_object */ -/* reuse GL_UNIFORM_BUFFER */ -/* reuse GL_UNIFORM_BUFFER_BINDING */ -/* reuse GL_UNIFORM_BUFFER_START */ -/* reuse GL_UNIFORM_BUFFER_SIZE */ -/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */ -/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */ -/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */ -/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */ -/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */ -/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */ -/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */ -/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */ -/* reuse GL_ACTIVE_UNIFORM_BLOCKS */ -/* reuse GL_UNIFORM_TYPE */ -/* reuse GL_UNIFORM_SIZE */ -/* reuse GL_UNIFORM_NAME_LENGTH */ -/* reuse GL_UNIFORM_BLOCK_INDEX */ -/* reuse GL_UNIFORM_OFFSET */ -/* reuse GL_UNIFORM_ARRAY_STRIDE */ -/* reuse GL_UNIFORM_MATRIX_STRIDE */ -/* reuse GL_UNIFORM_IS_ROW_MAJOR */ -/* reuse GL_UNIFORM_BLOCK_BINDING */ -/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */ -/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */ -/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */ -/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */ -/* reuse GL_INVALID_INDEX */ -#endif - -#ifndef GL_VERSION_3_2 -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -/* reuse GL_MAX_VARYING_COMPONENTS */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ -/* Reuse tokens from ARB_depth_clamp */ -/* reuse GL_DEPTH_CLAMP */ -/* Reuse tokens from ARB_draw_elements_base_vertex (none) */ -/* Reuse tokens from ARB_fragment_coord_conventions (none) */ -/* Reuse tokens from ARB_provoking_vertex */ -/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ -/* reuse GL_FIRST_VERTEX_CONVENTION */ -/* reuse GL_LAST_VERTEX_CONVENTION */ -/* reuse GL_PROVOKING_VERTEX */ -/* Reuse tokens from ARB_seamless_cube_map */ -/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */ -/* Reuse tokens from ARB_sync */ -/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */ -/* reuse GL_OBJECT_TYPE */ -/* reuse GL_SYNC_CONDITION */ -/* reuse GL_SYNC_STATUS */ -/* reuse GL_SYNC_FLAGS */ -/* reuse GL_SYNC_FENCE */ -/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */ -/* reuse GL_UNSIGNALED */ -/* reuse GL_SIGNALED */ -/* reuse GL_ALREADY_SIGNALED */ -/* reuse GL_TIMEOUT_EXPIRED */ -/* reuse GL_CONDITION_SATISFIED */ -/* reuse GL_WAIT_FAILED */ -/* reuse GL_TIMEOUT_IGNORED */ -/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */ -/* reuse GL_TIMEOUT_IGNORED */ -/* Reuse tokens from ARB_texture_multisample */ -/* reuse GL_SAMPLE_POSITION */ -/* reuse GL_SAMPLE_MASK */ -/* reuse GL_SAMPLE_MASK_VALUE */ -/* reuse GL_MAX_SAMPLE_MASK_WORDS */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE */ -/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */ -/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_TEXTURE_SAMPLES */ -/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */ -/* reuse GL_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */ -/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */ -/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */ -/* reuse GL_MAX_INTEGER_SAMPLES */ -/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */ -#endif - -#ifndef GL_VERSION_3_3 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -/* Reuse tokens from ARB_blend_func_extended */ -/* reuse GL_SRC1_COLOR */ -/* reuse GL_ONE_MINUS_SRC1_COLOR */ -/* reuse GL_ONE_MINUS_SRC1_ALPHA */ -/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */ -/* Reuse tokens from ARB_explicit_attrib_location (none) */ -/* Reuse tokens from ARB_occlusion_query2 */ -/* reuse GL_ANY_SAMPLES_PASSED */ -/* Reuse tokens from ARB_sampler_objects */ -/* reuse GL_SAMPLER_BINDING */ -/* Reuse tokens from ARB_shader_bit_encoding (none) */ -/* Reuse tokens from ARB_texture_rgb10_a2ui */ -/* reuse GL_RGB10_A2UI */ -/* Reuse tokens from ARB_texture_swizzle */ -/* reuse GL_TEXTURE_SWIZZLE_R */ -/* reuse GL_TEXTURE_SWIZZLE_G */ -/* reuse GL_TEXTURE_SWIZZLE_B */ -/* reuse GL_TEXTURE_SWIZZLE_A */ -/* reuse GL_TEXTURE_SWIZZLE_RGBA */ -/* Reuse tokens from ARB_timer_query */ -/* reuse GL_TIME_ELAPSED */ -/* reuse GL_TIMESTAMP */ -/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */ -/* reuse GL_INT_2_10_10_10_REV */ -#endif - -#ifndef GL_VERSION_4_0 -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -/* Reuse tokens from ARB_texture_query_lod (none) */ -/* Reuse tokens from ARB_draw_buffers_blend (none) */ -/* Reuse tokens from ARB_draw_indirect */ -/* reuse GL_DRAW_INDIRECT_BUFFER */ -/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */ -/* Reuse tokens from ARB_gpu_shader5 */ -/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */ -/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */ -/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */ -/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */ -/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */ -/* reuse GL_MAX_VERTEX_STREAMS */ -/* Reuse tokens from ARB_gpu_shader_fp64 */ -/* reuse GL_DOUBLE_VEC2 */ -/* reuse GL_DOUBLE_VEC3 */ -/* reuse GL_DOUBLE_VEC4 */ -/* reuse GL_DOUBLE_MAT2 */ -/* reuse GL_DOUBLE_MAT3 */ -/* reuse GL_DOUBLE_MAT4 */ -/* reuse GL_DOUBLE_MAT2x3 */ -/* reuse GL_DOUBLE_MAT2x4 */ -/* reuse GL_DOUBLE_MAT3x2 */ -/* reuse GL_DOUBLE_MAT3x4 */ -/* reuse GL_DOUBLE_MAT4x2 */ -/* reuse GL_DOUBLE_MAT4x3 */ -/* Reuse tokens from ARB_shader_subroutine */ -/* reuse GL_ACTIVE_SUBROUTINES */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */ -/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */ -/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */ -/* reuse GL_MAX_SUBROUTINES */ -/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */ -/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ -/* reuse GL_COMPATIBLE_SUBROUTINES */ -/* Reuse tokens from ARB_tessellation_shader */ -/* reuse GL_PATCHES */ -/* reuse GL_PATCH_VERTICES */ -/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */ -/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */ -/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */ -/* reuse GL_TESS_GEN_MODE */ -/* reuse GL_TESS_GEN_SPACING */ -/* reuse GL_TESS_GEN_VERTEX_ORDER */ -/* reuse GL_TESS_GEN_POINT_MODE */ -/* reuse GL_ISOLINES */ -/* reuse GL_FRACTIONAL_ODD */ -/* reuse GL_FRACTIONAL_EVEN */ -/* reuse GL_MAX_PATCH_VERTICES */ -/* reuse GL_MAX_TESS_GEN_LEVEL */ -/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */ -/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */ -/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_PATCH_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */ -/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */ -/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */ -/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */ -/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */ -/* reuse GL_TESS_EVALUATION_SHADER */ -/* reuse GL_TESS_CONTROL_SHADER */ -/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */ -/* Reuse tokens from ARB_transform_feedback2 */ -/* reuse GL_TRANSFORM_FEEDBACK */ -/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ -/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ -/* reuse GL_TRANSFORM_FEEDBACK_BINDING */ -/* Reuse tokens from ARB_transform_feedback3 */ -/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */ -/* reuse GL_MAX_VERTEX_STREAMS */ -#endif - -#ifndef GL_VERSION_4_1 -/* Reuse tokens from ARB_ES2_compatibility */ -/* reuse GL_FIXED */ -/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */ -/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */ -/* reuse GL_LOW_FLOAT */ -/* reuse GL_MEDIUM_FLOAT */ -/* reuse GL_HIGH_FLOAT */ -/* reuse GL_LOW_INT */ -/* reuse GL_MEDIUM_INT */ -/* reuse GL_HIGH_INT */ -/* reuse GL_SHADER_COMPILER */ -/* reuse GL_SHADER_BINARY_FORMATS */ -/* reuse GL_NUM_SHADER_BINARY_FORMATS */ -/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ -/* reuse GL_MAX_VARYING_VECTORS */ -/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */ -/* reuse GL_RGB565 */ -/* Reuse tokens from ARB_get_program_binary */ -/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */ -/* reuse GL_PROGRAM_BINARY_LENGTH */ -/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */ -/* reuse GL_PROGRAM_BINARY_FORMATS */ -/* Reuse tokens from ARB_separate_shader_objects */ -/* reuse GL_VERTEX_SHADER_BIT */ -/* reuse GL_FRAGMENT_SHADER_BIT */ -/* reuse GL_GEOMETRY_SHADER_BIT */ -/* reuse GL_TESS_CONTROL_SHADER_BIT */ -/* reuse GL_TESS_EVALUATION_SHADER_BIT */ -/* reuse GL_ALL_SHADER_BITS */ -/* reuse GL_PROGRAM_SEPARABLE */ -/* reuse GL_ACTIVE_PROGRAM */ -/* reuse GL_PROGRAM_PIPELINE_BINDING */ -/* Reuse tokens from ARB_shader_precision (none) */ -/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */ -/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */ -/* reuse GL_MAX_VIEWPORTS */ -/* reuse GL_VIEWPORT_SUBPIXEL_BITS */ -/* reuse GL_VIEWPORT_BOUNDS_RANGE */ -/* reuse GL_LAYER_PROVOKING_VERTEX */ -/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */ -/* reuse GL_UNDEFINED_VERTEX */ -#endif - -#ifndef GL_VERSION_4_2 -/* Reuse tokens from ARB_base_instance (none) */ -/* Reuse tokens from ARB_shading_language_420pack (none) */ -/* Reuse tokens from ARB_transform_feedback_instanced (none) */ -/* Reuse tokens from ARB_compressed_texture_pixel_storage */ -/* reuse GL_UNPACK_COMPRESSED_BLOCK_WIDTH */ -/* reuse GL_UNPACK_COMPRESSED_BLOCK_HEIGHT */ -/* reuse GL_UNPACK_COMPRESSED_BLOCK_DEPTH */ -/* reuse GL_UNPACK_COMPRESSED_BLOCK_SIZE */ -/* reuse GL_PACK_COMPRESSED_BLOCK_WIDTH */ -/* reuse GL_PACK_COMPRESSED_BLOCK_HEIGHT */ -/* reuse GL_PACK_COMPRESSED_BLOCK_DEPTH */ -/* reuse GL_PACK_COMPRESSED_BLOCK_SIZE */ -/* Reuse tokens from ARB_conservative_depth (none) */ -/* Reuse tokens from ARB_internalformat_query */ -/* reuse GL_NUM_SAMPLE_COUNTS */ -/* Reuse tokens from ARB_map_buffer_alignment */ -/* reuse GL_MIN_MAP_BUFFER_ALIGNMENT */ -/* Reuse tokens from ARB_shader_atomic_counters */ -/* reuse GL_ATOMIC_COUNTER_BUFFER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_BINDING */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_START */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_SIZE */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER */ -/* reuse GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_VERTEX_ATOMIC_COUNTERS */ -/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS */ -/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS */ -/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTERS */ -/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTERS */ -/* reuse GL_MAX_COMBINED_ATOMIC_COUNTERS */ -/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE */ -/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS */ -/* reuse GL_ACTIVE_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX */ -/* reuse GL_UNSIGNED_INT_ATOMIC_COUNTER */ -/* Reuse tokens from ARB_shader_image_load_store */ -/* reuse GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT */ -/* reuse GL_ELEMENT_ARRAY_BARRIER_BIT */ -/* reuse GL_UNIFORM_BARRIER_BIT */ -/* reuse GL_TEXTURE_FETCH_BARRIER_BIT */ -/* reuse GL_SHADER_IMAGE_ACCESS_BARRIER_BIT */ -/* reuse GL_COMMAND_BARRIER_BIT */ -/* reuse GL_PIXEL_BUFFER_BARRIER_BIT */ -/* reuse GL_TEXTURE_UPDATE_BARRIER_BIT */ -/* reuse GL_BUFFER_UPDATE_BARRIER_BIT */ -/* reuse GL_FRAMEBUFFER_BARRIER_BIT */ -/* reuse GL_TRANSFORM_FEEDBACK_BARRIER_BIT */ -/* reuse GL_ATOMIC_COUNTER_BARRIER_BIT */ -/* reuse GL_ALL_BARRIER_BITS */ -/* reuse GL_MAX_IMAGE_UNITS */ -/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ -/* reuse GL_IMAGE_BINDING_NAME */ -/* reuse GL_IMAGE_BINDING_LEVEL */ -/* reuse GL_IMAGE_BINDING_LAYERED */ -/* reuse GL_IMAGE_BINDING_LAYER */ -/* reuse GL_IMAGE_BINDING_ACCESS */ -/* reuse GL_IMAGE_1D */ -/* reuse GL_IMAGE_2D */ -/* reuse GL_IMAGE_3D */ -/* reuse GL_IMAGE_2D_RECT */ -/* reuse GL_IMAGE_CUBE */ -/* reuse GL_IMAGE_BUFFER */ -/* reuse GL_IMAGE_1D_ARRAY */ -/* reuse GL_IMAGE_2D_ARRAY */ -/* reuse GL_IMAGE_CUBE_MAP_ARRAY */ -/* reuse GL_IMAGE_2D_MULTISAMPLE */ -/* reuse GL_IMAGE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_INT_IMAGE_1D */ -/* reuse GL_INT_IMAGE_2D */ -/* reuse GL_INT_IMAGE_3D */ -/* reuse GL_INT_IMAGE_2D_RECT */ -/* reuse GL_INT_IMAGE_CUBE */ -/* reuse GL_INT_IMAGE_BUFFER */ -/* reuse GL_INT_IMAGE_1D_ARRAY */ -/* reuse GL_INT_IMAGE_2D_ARRAY */ -/* reuse GL_INT_IMAGE_CUBE_MAP_ARRAY */ -/* reuse GL_INT_IMAGE_2D_MULTISAMPLE */ -/* reuse GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_UNSIGNED_INT_IMAGE_1D */ -/* reuse GL_UNSIGNED_INT_IMAGE_2D */ -/* reuse GL_UNSIGNED_INT_IMAGE_3D */ -/* reuse GL_UNSIGNED_INT_IMAGE_2D_RECT */ -/* reuse GL_UNSIGNED_INT_IMAGE_CUBE */ -/* reuse GL_UNSIGNED_INT_IMAGE_BUFFER */ -/* reuse GL_UNSIGNED_INT_IMAGE_1D_ARRAY */ -/* reuse GL_UNSIGNED_INT_IMAGE_2D_ARRAY */ -/* reuse GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY */ -/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE */ -/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_MAX_IMAGE_SAMPLES */ -/* reuse GL_IMAGE_BINDING_FORMAT */ -/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */ -/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE */ -/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS */ -/* reuse GL_MAX_VERTEX_IMAGE_UNIFORMS */ -/* reuse GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS */ -/* reuse GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS */ -/* reuse GL_MAX_GEOMETRY_IMAGE_UNIFORMS */ -/* reuse GL_MAX_FRAGMENT_IMAGE_UNIFORMS */ -/* reuse GL_MAX_COMBINED_IMAGE_UNIFORMS */ -/* Reuse tokens from ARB_shading_language_packing (none) */ -/* Reuse tokens from ARB_texture_storage */ -/* reuse GL_TEXTURE_IMMUTABLE_FORMAT */ -#endif - -#ifndef GL_VERSION_4_3 -#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 -#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E -/* Reuse tokens from ARB_arrays_of_arrays (none, GLSL only) */ -/* Reuse tokens from ARB_fragment_layer_viewport (none, GLSL only) */ -/* Reuse tokens from ARB_shader_image_size (none, GLSL only) */ -/* Reuse tokens from ARB_ES3_compatibility */ -/* reuse GL_COMPRESSED_RGB8_ETC2 */ -/* reuse GL_COMPRESSED_SRGB8_ETC2 */ -/* reuse GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ -/* reuse GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ -/* reuse GL_COMPRESSED_RGBA8_ETC2_EAC */ -/* reuse GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */ -/* reuse GL_COMPRESSED_R11_EAC */ -/* reuse GL_COMPRESSED_SIGNED_R11_EAC */ -/* reuse GL_COMPRESSED_RG11_EAC */ -/* reuse GL_COMPRESSED_SIGNED_RG11_EAC */ -/* reuse GL_PRIMITIVE_RESTART_FIXED_INDEX */ -/* reuse GL_ANY_SAMPLES_PASSED_CONSERVATIVE */ -/* reuse GL_MAX_ELEMENT_INDEX */ -/* Reuse tokens from ARB_clear_buffer_object (none) */ -/* Reuse tokens from ARB_compute_shader */ -/* reuse GL_COMPUTE_SHADER */ -/* reuse GL_MAX_COMPUTE_UNIFORM_BLOCKS */ -/* reuse GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS */ -/* reuse GL_MAX_COMPUTE_IMAGE_UNIFORMS */ -/* reuse GL_MAX_COMPUTE_SHARED_MEMORY_SIZE */ -/* reuse GL_MAX_COMPUTE_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS */ -/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTERS */ -/* reuse GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS */ -/* reuse GL_MAX_COMPUTE_LOCAL_INVOCATIONS */ -/* reuse GL_MAX_COMPUTE_WORK_GROUP_COUNT */ -/* reuse GL_MAX_COMPUTE_WORK_GROUP_SIZE */ -/* reuse GL_COMPUTE_LOCAL_WORK_SIZE */ -/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER */ -/* reuse GL_DISPATCH_INDIRECT_BUFFER */ -/* reuse GL_DISPATCH_INDIRECT_BUFFER_BINDING */ -/* Reuse tokens from ARB_copy_image (none) */ -/* Reuse tokens from KHR_debug */ -/* reuse GL_DEBUG_OUTPUT_SYNCHRONOUS */ -/* reuse GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH */ -/* reuse GL_DEBUG_CALLBACK_FUNCTION */ -/* reuse GL_DEBUG_CALLBACK_USER_PARAM */ -/* reuse GL_DEBUG_SOURCE_API */ -/* reuse GL_DEBUG_SOURCE_WINDOW_SYSTEM */ -/* reuse GL_DEBUG_SOURCE_SHADER_COMPILER */ -/* reuse GL_DEBUG_SOURCE_THIRD_PARTY */ -/* reuse GL_DEBUG_SOURCE_APPLICATION */ -/* reuse GL_DEBUG_SOURCE_OTHER */ -/* reuse GL_DEBUG_TYPE_ERROR */ -/* reuse GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR */ -/* reuse GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR */ -/* reuse GL_DEBUG_TYPE_PORTABILITY */ -/* reuse GL_DEBUG_TYPE_PERFORMANCE */ -/* reuse GL_DEBUG_TYPE_OTHER */ -/* reuse GL_MAX_DEBUG_MESSAGE_LENGTH */ -/* reuse GL_MAX_DEBUG_LOGGED_MESSAGES */ -/* reuse GL_DEBUG_LOGGED_MESSAGES */ -/* reuse GL_DEBUG_SEVERITY_HIGH */ -/* reuse GL_DEBUG_SEVERITY_MEDIUM */ -/* reuse GL_DEBUG_SEVERITY_LOW */ -/* reuse GL_DEBUG_TYPE_MARKER */ -/* reuse GL_DEBUG_TYPE_PUSH_GROUP */ -/* reuse GL_DEBUG_TYPE_POP_GROUP */ -/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */ -/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */ -/* reuse GL_DEBUG_GROUP_STACK_DEPTH */ -/* reuse GL_BUFFER */ -/* reuse GL_SHADER */ -/* reuse GL_PROGRAM */ -/* reuse GL_QUERY */ -/* reuse GL_PROGRAM_PIPELINE */ -/* reuse GL_SAMPLER */ -/* reuse GL_DISPLAY_LIST */ -/* reuse GL_MAX_LABEL_LENGTH */ -/* reuse GL_DEBUG_OUTPUT */ -/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */ -/* reuse GL_STACK_UNDERFLOW */ -/* reuse GL_STACK_OVERFLOW */ -/* Reuse tokens from ARB_explicit_uniform_location */ -/* reuse GL_MAX_UNIFORM_LOCATIONS */ -/* Reuse tokens from ARB_framebuffer_no_attachments */ -/* reuse GL_FRAMEBUFFER_DEFAULT_WIDTH */ -/* reuse GL_FRAMEBUFFER_DEFAULT_HEIGHT */ -/* reuse GL_FRAMEBUFFER_DEFAULT_LAYERS */ -/* reuse GL_FRAMEBUFFER_DEFAULT_SAMPLES */ -/* reuse GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS */ -/* reuse GL_MAX_FRAMEBUFFER_WIDTH */ -/* reuse GL_MAX_FRAMEBUFFER_HEIGHT */ -/* reuse GL_MAX_FRAMEBUFFER_LAYERS */ -/* reuse GL_MAX_FRAMEBUFFER_SAMPLES */ -/* Reuse tokens from ARB_internalformat_query2 */ -/* reuse GL_INTERNALFORMAT_SUPPORTED */ -/* reuse GL_INTERNALFORMAT_PREFERRED */ -/* reuse GL_INTERNALFORMAT_RED_SIZE */ -/* reuse GL_INTERNALFORMAT_GREEN_SIZE */ -/* reuse GL_INTERNALFORMAT_BLUE_SIZE */ -/* reuse GL_INTERNALFORMAT_ALPHA_SIZE */ -/* reuse GL_INTERNALFORMAT_DEPTH_SIZE */ -/* reuse GL_INTERNALFORMAT_STENCIL_SIZE */ -/* reuse GL_INTERNALFORMAT_SHARED_SIZE */ -/* reuse GL_INTERNALFORMAT_RED_TYPE */ -/* reuse GL_INTERNALFORMAT_GREEN_TYPE */ -/* reuse GL_INTERNALFORMAT_BLUE_TYPE */ -/* reuse GL_INTERNALFORMAT_ALPHA_TYPE */ -/* reuse GL_INTERNALFORMAT_DEPTH_TYPE */ -/* reuse GL_INTERNALFORMAT_STENCIL_TYPE */ -/* reuse GL_MAX_WIDTH */ -/* reuse GL_MAX_HEIGHT */ -/* reuse GL_MAX_DEPTH */ -/* reuse GL_MAX_LAYERS */ -/* reuse GL_MAX_COMBINED_DIMENSIONS */ -/* reuse GL_COLOR_COMPONENTS */ -/* reuse GL_DEPTH_COMPONENTS */ -/* reuse GL_STENCIL_COMPONENTS */ -/* reuse GL_COLOR_RENDERABLE */ -/* reuse GL_DEPTH_RENDERABLE */ -/* reuse GL_STENCIL_RENDERABLE */ -/* reuse GL_FRAMEBUFFER_RENDERABLE */ -/* reuse GL_FRAMEBUFFER_RENDERABLE_LAYERED */ -/* reuse GL_FRAMEBUFFER_BLEND */ -/* reuse GL_READ_PIXELS */ -/* reuse GL_READ_PIXELS_FORMAT */ -/* reuse GL_READ_PIXELS_TYPE */ -/* reuse GL_TEXTURE_IMAGE_FORMAT */ -/* reuse GL_TEXTURE_IMAGE_TYPE */ -/* reuse GL_GET_TEXTURE_IMAGE_FORMAT */ -/* reuse GL_GET_TEXTURE_IMAGE_TYPE */ -/* reuse GL_MIPMAP */ -/* reuse GL_MANUAL_GENERATE_MIPMAP */ -/* reuse GL_AUTO_GENERATE_MIPMAP */ -/* reuse GL_COLOR_ENCODING */ -/* reuse GL_SRGB_READ */ -/* reuse GL_SRGB_WRITE */ -/* reuse GL_FILTER */ -/* reuse GL_VERTEX_TEXTURE */ -/* reuse GL_TESS_CONTROL_TEXTURE */ -/* reuse GL_TESS_EVALUATION_TEXTURE */ -/* reuse GL_GEOMETRY_TEXTURE */ -/* reuse GL_FRAGMENT_TEXTURE */ -/* reuse GL_COMPUTE_TEXTURE */ -/* reuse GL_TEXTURE_SHADOW */ -/* reuse GL_TEXTURE_GATHER */ -/* reuse GL_TEXTURE_GATHER_SHADOW */ -/* reuse GL_SHADER_IMAGE_LOAD */ -/* reuse GL_SHADER_IMAGE_STORE */ -/* reuse GL_SHADER_IMAGE_ATOMIC */ -/* reuse GL_IMAGE_TEXEL_SIZE */ -/* reuse GL_IMAGE_COMPATIBILITY_CLASS */ -/* reuse GL_IMAGE_PIXEL_FORMAT */ -/* reuse GL_IMAGE_PIXEL_TYPE */ -/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST */ -/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST */ -/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE */ -/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE */ -/* reuse GL_TEXTURE_COMPRESSED_BLOCK_WIDTH */ -/* reuse GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT */ -/* reuse GL_TEXTURE_COMPRESSED_BLOCK_SIZE */ -/* reuse GL_CLEAR_BUFFER */ -/* reuse GL_TEXTURE_VIEW */ -/* reuse GL_VIEW_COMPATIBILITY_CLASS */ -/* reuse GL_FULL_SUPPORT */ -/* reuse GL_CAVEAT_SUPPORT */ -/* reuse GL_IMAGE_CLASS_4_X_32 */ -/* reuse GL_IMAGE_CLASS_2_X_32 */ -/* reuse GL_IMAGE_CLASS_1_X_32 */ -/* reuse GL_IMAGE_CLASS_4_X_16 */ -/* reuse GL_IMAGE_CLASS_2_X_16 */ -/* reuse GL_IMAGE_CLASS_1_X_16 */ -/* reuse GL_IMAGE_CLASS_4_X_8 */ -/* reuse GL_IMAGE_CLASS_2_X_8 */ -/* reuse GL_IMAGE_CLASS_1_X_8 */ -/* reuse GL_IMAGE_CLASS_11_11_10 */ -/* reuse GL_IMAGE_CLASS_10_10_10_2 */ -/* reuse GL_VIEW_CLASS_128_BITS */ -/* reuse GL_VIEW_CLASS_96_BITS */ -/* reuse GL_VIEW_CLASS_64_BITS */ -/* reuse GL_VIEW_CLASS_48_BITS */ -/* reuse GL_VIEW_CLASS_32_BITS */ -/* reuse GL_VIEW_CLASS_24_BITS */ -/* reuse GL_VIEW_CLASS_16_BITS */ -/* reuse GL_VIEW_CLASS_8_BITS */ -/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGB */ -/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGBA */ -/* reuse GL_VIEW_CLASS_S3TC_DXT3_RGBA */ -/* reuse GL_VIEW_CLASS_S3TC_DXT5_RGBA */ -/* reuse GL_VIEW_CLASS_RGTC1_RED */ -/* reuse GL_VIEW_CLASS_RGTC2_RG */ -/* reuse GL_VIEW_CLASS_BPTC_UNORM */ -/* reuse GL_VIEW_CLASS_BPTC_FLOAT */ -/* Reuse tokens from ARB_invalidate_subdata (none) */ -/* Reuse tokens from ARB_multi_draw_indirect (none) */ -/* Reuse tokens from ARB_program_interface_query */ -/* reuse GL_UNIFORM */ -/* reuse GL_UNIFORM_BLOCK */ -/* reuse GL_PROGRAM_INPUT */ -/* reuse GL_PROGRAM_OUTPUT */ -/* reuse GL_BUFFER_VARIABLE */ -/* reuse GL_SHADER_STORAGE_BLOCK */ -/* reuse GL_VERTEX_SUBROUTINE */ -/* reuse GL_TESS_CONTROL_SUBROUTINE */ -/* reuse GL_TESS_EVALUATION_SUBROUTINE */ -/* reuse GL_GEOMETRY_SUBROUTINE */ -/* reuse GL_FRAGMENT_SUBROUTINE */ -/* reuse GL_COMPUTE_SUBROUTINE */ -/* reuse GL_VERTEX_SUBROUTINE_UNIFORM */ -/* reuse GL_TESS_CONTROL_SUBROUTINE_UNIFORM */ -/* reuse GL_TESS_EVALUATION_SUBROUTINE_UNIFORM */ -/* reuse GL_GEOMETRY_SUBROUTINE_UNIFORM */ -/* reuse GL_FRAGMENT_SUBROUTINE_UNIFORM */ -/* reuse GL_COMPUTE_SUBROUTINE_UNIFORM */ -/* reuse GL_TRANSFORM_FEEDBACK_VARYING */ -/* reuse GL_ACTIVE_RESOURCES */ -/* reuse GL_MAX_NAME_LENGTH */ -/* reuse GL_MAX_NUM_ACTIVE_VARIABLES */ -/* reuse GL_MAX_NUM_COMPATIBLE_SUBROUTINES */ -/* reuse GL_NAME_LENGTH */ -/* reuse GL_TYPE */ -/* reuse GL_ARRAY_SIZE */ -/* reuse GL_OFFSET */ -/* reuse GL_BLOCK_INDEX */ -/* reuse GL_ARRAY_STRIDE */ -/* reuse GL_MATRIX_STRIDE */ -/* reuse GL_IS_ROW_MAJOR */ -/* reuse GL_ATOMIC_COUNTER_BUFFER_INDEX */ -/* reuse GL_BUFFER_BINDING */ -/* reuse GL_BUFFER_DATA_SIZE */ -/* reuse GL_NUM_ACTIVE_VARIABLES */ -/* reuse GL_ACTIVE_VARIABLES */ -/* reuse GL_REFERENCED_BY_VERTEX_SHADER */ -/* reuse GL_REFERENCED_BY_TESS_CONTROL_SHADER */ -/* reuse GL_REFERENCED_BY_TESS_EVALUATION_SHADER */ -/* reuse GL_REFERENCED_BY_GEOMETRY_SHADER */ -/* reuse GL_REFERENCED_BY_FRAGMENT_SHADER */ -/* reuse GL_REFERENCED_BY_COMPUTE_SHADER */ -/* reuse GL_TOP_LEVEL_ARRAY_SIZE */ -/* reuse GL_TOP_LEVEL_ARRAY_STRIDE */ -/* reuse GL_LOCATION */ -/* reuse GL_LOCATION_INDEX */ -/* reuse GL_IS_PER_PATCH */ -/* Reuse tokens from ARB_robust_buffer_access_behavior (none) */ -/* Reuse tokens from ARB_shader_storage_buffer_object */ -/* reuse GL_SHADER_STORAGE_BUFFER */ -/* reuse GL_SHADER_STORAGE_BUFFER_BINDING */ -/* reuse GL_SHADER_STORAGE_BUFFER_START */ -/* reuse GL_SHADER_STORAGE_BUFFER_SIZE */ -/* reuse GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS */ -/* reuse GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS */ -/* reuse GL_MAX_SHADER_STORAGE_BLOCK_SIZE */ -/* reuse GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT */ -/* reuse GL_SHADER_STORAGE_BARRIER_BIT */ -/* reuse GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES */ -/* Reuse tokens from ARB_stencil_texturing */ -/* reuse GL_DEPTH_STENCIL_TEXTURE_MODE */ -/* Reuse tokens from ARB_texture_buffer_range */ -/* reuse GL_TEXTURE_BUFFER_OFFSET */ -/* reuse GL_TEXTURE_BUFFER_SIZE */ -/* reuse GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT */ -/* Reuse tokens from ARB_texture_query_levels (none) */ -/* Reuse tokens from ARB_texture_storage_multisample (none) */ -/* Reuse tokens from ARB_texture_view */ -/* reuse GL_TEXTURE_VIEW_MIN_LEVEL */ -/* reuse GL_TEXTURE_VIEW_NUM_LEVELS */ -/* reuse GL_TEXTURE_VIEW_MIN_LAYER */ -/* reuse GL_TEXTURE_VIEW_NUM_LAYERS */ -/* reuse GL_TEXTURE_IMMUTABLE_LEVELS */ -/* Reuse tokens from ARB_vertex_attrib_binding */ -/* reuse GL_VERTEX_ATTRIB_BINDING */ -/* reuse GL_VERTEX_ATTRIB_RELATIVE_OFFSET */ -/* reuse GL_VERTEX_BINDING_DIVISOR */ -/* reuse GL_VERTEX_BINDING_OFFSET */ -/* reuse GL_VERTEX_BINDING_STRIDE */ -/* reuse GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET */ -/* reuse GL_MAX_VERTEX_ATTRIB_BINDINGS */ -#endif - -#ifndef GL_ARB_depth_buffer_float #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#endif - -#ifndef GL_ARB_framebuffer_object #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 #define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 @@ -1613,33 +1169,18 @@ typedef void GLvoid; #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 -#endif - -#ifndef GL_ARB_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB 0x8DB9 -#endif - -#ifndef GL_ARB_half_float_vertex #define GL_HALF_FLOAT 0x140B -#endif - -#ifndef GL_ARB_map_buffer_range #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 #define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 #define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 #define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#endif - -#ifndef GL_ARB_texture_compression_rgtc #define GL_COMPRESSED_RED_RGTC1 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC #define GL_COMPRESSED_RG_RGTC2 0x8DBD #define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#endif - -#ifndef GL_ARB_texture_rg #define GL_RG 0x8227 #define GL_RG_INTEGER 0x8228 #define GL_R8 0x8229 @@ -1662,25 +1203,219 @@ typedef void GLvoid; #define GL_RG16UI 0x823A #define GL_RG32I 0x823B #define GL_RG32UI 0x823C -#endif - -#ifndef GL_ARB_vertex_array_object #define GL_VERTEX_ARRAY_BINDING 0x85B5 +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmap (GLenum target); +GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glBindVertexArray (GLuint array); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #endif +#endif /* GL_VERSION_3_0 */ -#ifndef GL_ARB_uniform_buffer_object +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 #define GL_UNIFORM_BUFFER 0x8A11 #define GL_UNIFORM_BUFFER_BINDING 0x8A28 #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 @@ -1699,40 +1434,106 @@ typedef void GLvoid; #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFFu +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); +GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); +GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); #endif +#endif /* GL_VERSION_3_1 */ -#ifndef GL_ARB_copy_buffer -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#endif - -#ifndef GL_ARB_depth_clamp -#define GL_DEPTH_CLAMP 0x864F -#endif - -#ifndef GL_ARB_draw_elements_base_vertex +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +typedef struct __GLsync *GLsync; +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include #endif - -#ifndef GL_ARB_fragment_coord_conventions #endif - -#ifndef GL_ARB_provoking_vertex +typedef uint64_t GLuint64; +typedef int64_t GLint64; +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E #define GL_PROVOKING_VERTEX 0x8E4F -#endif - -#ifndef GL_ARB_seamless_cube_map #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#endif - -#ifndef GL_ARB_sync #define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 #define GL_OBJECT_TYPE 0x9112 #define GL_SYNC_CONDITION 0x9113 @@ -1746,11 +1547,8 @@ typedef void GLvoid; #define GL_TIMEOUT_EXPIRED 0x911B #define GL_CONDITION_SATISFIED 0x911C #define GL_WAIT_FAILED 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#endif - -#ifndef GL_ARB_texture_multisample +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 #define GL_SAMPLE_POSITION 0x8E50 #define GL_SAMPLE_MASK 0x8E51 #define GL_SAMPLE_MASK_VALUE 0x8E52 @@ -1772,142 +1570,169 @@ typedef void GLvoid; #define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E #define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F #define GL_MAX_INTEGER_SAMPLES 0x9110 +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI void APIENTRY glProvokingVertex (GLenum mode); +GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync (GLsync sync); +GLAPI void APIENTRY glDeleteSync (GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask); #endif +#endif /* GL_VERSION_3_2 */ -#ifndef GL_ARB_vertex_array_bgra -/* reuse GL_BGRA */ -#endif - -#ifndef GL_ARB_draw_buffers_blend -#endif - -#ifndef GL_ARB_sample_shading -#define GL_SAMPLE_SHADING_ARB 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 -#endif - -#ifndef GL_ARB_texture_cube_map_array -#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#endif - -#ifndef GL_ARB_texture_gather -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F -#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F -#endif - -#ifndef GL_ARB_texture_query_lod -#endif - -#ifndef GL_ARB_shading_language_include -#define GL_SHADER_INCLUDE_ARB 0x8DAE -#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 -#define GL_NAMED_STRING_TYPE_ARB 0x8DEA -#endif - -#ifndef GL_ARB_texture_compression_bptc -#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F -#endif - -#ifndef GL_ARB_blend_func_extended +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE #define GL_SRC1_COLOR 0x88F9 -/* reuse GL_SRC1_ALPHA */ #define GL_ONE_MINUS_SRC1_COLOR 0x88FA #define GL_ONE_MINUS_SRC1_ALPHA 0x88FB #define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#endif - -#ifndef GL_ARB_explicit_attrib_location -#endif - -#ifndef GL_ARB_occlusion_query2 #define GL_ANY_SAMPLES_PASSED 0x8C2F -#endif - -#ifndef GL_ARB_sampler_objects #define GL_SAMPLER_BINDING 0x8919 -#endif - -#ifndef GL_ARB_shader_bit_encoding -#endif - -#ifndef GL_ARB_texture_rgb10_a2ui #define GL_RGB10_A2UI 0x906F -#endif - -#ifndef GL_ARB_texture_swizzle #define GL_TEXTURE_SWIZZLE_R 0x8E42 #define GL_TEXTURE_SWIZZLE_G 0x8E43 #define GL_TEXTURE_SWIZZLE_B 0x8E44 #define GL_TEXTURE_SWIZZLE_A 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#endif - -#ifndef GL_ARB_timer_query #define GL_TIME_ELAPSED 0x88BF #define GL_TIMESTAMP 0x8E28 -#endif - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */ #define GL_INT_2_10_10_10_REV 0x8D9F -#endif - -#ifndef GL_ARB_draw_indirect -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#endif - -#ifndef GL_ARB_gpu_shader5 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -/* reuse GL_MAX_VERTEX_STREAMS */ -#endif - -#ifndef GL_ARB_gpu_shader_fp64 -/* reuse GL_DOUBLE */ -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#endif - -#ifndef GL_ARB_shader_subroutine -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -/* reuse GL_UNIFORM_SIZE */ -/* reuse GL_UNIFORM_NAME_LENGTH */ -#endif - -#ifndef GL_ARB_tessellation_shader -#define GL_PATCHES 0x000E +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); +GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); +GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); +GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#endif +#endif /* GL_VERSION_3_3 */ + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E #define GL_PATCH_VERTICES 0x8E72 #define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 #define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 @@ -1916,14 +1741,9 @@ typedef void GLvoid; #define GL_TESS_GEN_SPACING 0x8E77 #define GL_TESS_GEN_VERTEX_ORDER 0x8E78 #define GL_TESS_GEN_POINT_MODE 0x8E79 -/* reuse GL_TRIANGLES */ -/* reuse GL_QUADS */ #define GL_ISOLINES 0x8E7A -/* reuse GL_EQUAL */ #define GL_FRACTIONAL_ODD 0x8E7B #define GL_FRACTIONAL_EVEN 0x8E7C -/* reuse GL_CCW */ -/* reuse GL_CW */ #define GL_MAX_PATCH_VERTICES 0x8E7D #define GL_MAX_TESS_GEN_LEVEL 0x8E7E #define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F @@ -1944,29 +1764,109 @@ typedef void GLvoid; #define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 #define GL_TESS_EVALUATION_SHADER 0x8E87 #define GL_TESS_CONTROL_SHADER 0x8E88 -#endif - -#ifndef GL_ARB_texture_buffer_object_rgb32 -/* reuse GL_RGB32F */ -/* reuse GL_RGB32UI */ -/* reuse GL_RGB32I */ -#endif - -#ifndef GL_ARB_transform_feedback2 #define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#endif - -#ifndef GL_ARB_transform_feedback3 #define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -#define GL_MAX_VERTEX_STREAMS 0x8E71 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect); +typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLfloat value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect); +GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect); +GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); +GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); +GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); +GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); +GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); +GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedback (void); +GLAPI void APIENTRY glResumeTransformFeedback (void); +GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); +GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); +GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); +GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); +GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); #endif +#endif /* GL_VERSION_4_0 */ -#ifndef GL_ARB_ES2_compatibility +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 #define GL_FIXED 0x140C #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B @@ -1983,16 +1883,10 @@ typedef void GLvoid; #define GL_MAX_VARYING_VECTORS 0x8DFC #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD #define GL_RGB565 0x8D62 -#endif - -#ifndef GL_ARB_get_program_binary #define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 #define GL_PROGRAM_BINARY_LENGTH 0x8741 #define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE #define GL_PROGRAM_BINARY_FORMATS 0x87FF -#endif - -#ifndef GL_ARB_separate_shader_objects #define GL_VERTEX_SHADER_BIT 0x00000001 #define GL_FRAGMENT_SHADER_BIT 0x00000002 #define GL_GEOMETRY_SHADER_BIT 0x00000004 @@ -2002,97 +1896,194 @@ typedef void GLvoid; #define GL_PROGRAM_SEPARABLE 0x8258 #define GL_ACTIVE_PROGRAM 0x8259 #define GL_PROGRAM_PIPELINE_BINDING 0x825A -#endif - -#ifndef GL_ARB_shader_precision -#endif - -#ifndef GL_ARB_vertex_attrib_64bit -/* reuse GL_RGB32I */ -/* reuse GL_DOUBLE_VEC2 */ -/* reuse GL_DOUBLE_VEC3 */ -/* reuse GL_DOUBLE_VEC4 */ -/* reuse GL_DOUBLE_MAT2 */ -/* reuse GL_DOUBLE_MAT3 */ -/* reuse GL_DOUBLE_MAT4 */ -/* reuse GL_DOUBLE_MAT2x3 */ -/* reuse GL_DOUBLE_MAT2x4 */ -/* reuse GL_DOUBLE_MAT3x2 */ -/* reuse GL_DOUBLE_MAT3x4 */ -/* reuse GL_DOUBLE_MAT4x2 */ -/* reuse GL_DOUBLE_MAT4x3 */ -#endif - -#ifndef GL_ARB_viewport_array -/* reuse GL_SCISSOR_BOX */ -/* reuse GL_VIEWPORT */ -/* reuse GL_DEPTH_RANGE */ -/* reuse GL_SCISSOR_TEST */ #define GL_MAX_VIEWPORTS 0x825B #define GL_VIEWPORT_SUBPIXEL_BITS 0x825C #define GL_VIEWPORT_BOUNDS_RANGE 0x825D #define GL_LAYER_PROVOKING_VERTEX 0x825E #define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F #define GL_UNDEFINED_VERTEX 0x8260 -/* reuse GL_FIRST_VERTEX_CONVENTION */ -/* reuse GL_LAST_VERTEX_CONVENTION */ -/* reuse GL_PROVOKING_VERTEX */ -#endif - -#ifndef GL_ARB_cl_event -#define GL_SYNC_CL_EVENT_ARB 0x8240 -#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 -#endif - -#ifndef GL_ARB_debug_output -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 -#define GL_DEBUG_SOURCE_API_ARB 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A -#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B -#define GL_DEBUG_TYPE_ERROR_ARB 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 -#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 -#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 -#endif - -#ifndef GL_ARB_robustness -/* reuse GL_NO_ERROR */ -#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 -#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 -#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 -#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 -#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 -#endif - -#ifndef GL_ARB_shader_stencil_export -#endif - -#ifndef GL_ARB_base_instance -#endif - -#ifndef GL_ARB_shading_language_420pack -#endif - -#ifndef GL_ARB_transform_feedback_instanced +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GLAPI void APIENTRY glClearDepthf (GLfloat d); +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); #endif +#endif /* GL_VERSION_4_1 */ -#ifndef GL_ARB_compressed_texture_pixel_storage +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 #define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 #define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 #define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 @@ -2101,20 +2092,8 @@ typedef void GLvoid; #define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C #define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D #define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E -#endif - -#ifndef GL_ARB_conservative_depth -#endif - -#ifndef GL_ARB_internalformat_query #define GL_NUM_SAMPLE_COUNTS 0x9380 -#endif - -#ifndef GL_ARB_map_buffer_alignment #define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC -#endif - -#ifndef GL_ARB_shader_atomic_counters #define GL_ATOMIC_COUNTER_BUFFER 0x92C0 #define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 #define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 @@ -2144,9 +2123,6 @@ typedef void GLvoid; #define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 #define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA #define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB -#endif - -#ifndef GL_ARB_shader_image_load_store #define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 #define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 #define GL_UNIFORM_BARRIER_BIT 0x00000004 @@ -2211,47 +2187,70 @@ typedef void GLvoid; #define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD #define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE #define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF -#endif - -#ifndef GL_ARB_shading_language_packing -#endif - -#ifndef GL_ARB_texture_storage #define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); +GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); #endif +#endif /* GL_VERSION_4_2 */ -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif - -#ifndef GL_KHR_debug +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 @@ -2268,6 +2267,12 @@ typedef void GLvoid; #define GL_DEBUG_TYPE_PORTABILITY 0x824F #define GL_DEBUG_TYPE_PERFORMANCE 0x8250 #define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 #define GL_DEBUG_TYPE_MARKER 0x8268 #define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 #define GL_DEBUG_TYPE_POP_GROUP 0x826A @@ -2280,96 +2285,10 @@ typedef void GLvoid; #define GL_QUERY 0x82E3 #define GL_PROGRAM_PIPELINE 0x82E4 #define GL_SAMPLER 0x82E6 -#define GL_DISPLAY_LIST 0x82E7 -/* DISPLAY_LIST used in compatibility profile only */ #define GL_MAX_LABEL_LENGTH 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES 0x9145 -#define GL_DEBUG_SEVERITY_HIGH 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 -#define GL_DEBUG_SEVERITY_LOW 0x9148 #define GL_DEBUG_OUTPUT 0x92E0 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 -/* reuse GL_STACK_UNDERFLOW */ -/* reuse GL_STACK_OVERFLOW */ -#endif - -#ifndef GL_ARB_arrays_of_arrays -#endif - -#ifndef GL_ARB_clear_buffer_object -#endif - -#ifndef GL_ARB_compute_shader -#define GL_COMPUTE_SHADER 0x91B9 -#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB -#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC -#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 -#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 -#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 -#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 -#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 -#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB -#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE -#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF -#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC -#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED -#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE -#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF -#define GL_COMPUTE_SHADER_BIT 0x00000020 -#endif - -#ifndef GL_ARB_copy_image -#endif - -#ifndef GL_ARB_texture_view -#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#endif - -#ifndef GL_ARB_vertex_attrib_binding -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#endif - -#ifndef GL_ARB_robustness_isolation -#endif - -#ifndef GL_ARB_ES3_compatibility -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#endif - -#ifndef GL_ARB_explicit_uniform_location #define GL_MAX_UNIFORM_LOCATIONS 0x826E -#endif - -#ifndef GL_ARB_fragment_layer_viewport -#endif - -#ifndef GL_ARB_framebuffer_no_attachments #define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 #define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 #define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 @@ -2379,25 +2298,6 @@ typedef void GLvoid; #define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 #define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 #define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 -#endif - -#ifndef GL_ARB_internalformat_query2 -/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */ -/* reuse GL_NUM_SAMPLE_COUNTS */ -/* reuse GL_RENDERBUFFER */ -/* reuse GL_SAMPLES */ -/* reuse GL_TEXTURE_1D */ -/* reuse GL_TEXTURE_1D_ARRAY */ -/* reuse GL_TEXTURE_2D */ -/* reuse GL_TEXTURE_2D_ARRAY */ -/* reuse GL_TEXTURE_3D */ -/* reuse GL_TEXTURE_CUBE_MAP */ -/* reuse GL_TEXTURE_CUBE_MAP_ARRAY */ -/* reuse GL_TEXTURE_RECTANGLE */ -/* reuse GL_TEXTURE_BUFFER */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE */ -/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ -/* reuse GL_TEXTURE_COMPRESSED */ #define GL_INTERNALFORMAT_SUPPORTED 0x826F #define GL_INTERNALFORMAT_PREFERRED 0x8270 #define GL_INTERNALFORMAT_RED_SIZE 0x8271 @@ -2440,7 +2340,6 @@ typedef void GLvoid; #define GL_COLOR_ENCODING 0x8296 #define GL_SRGB_READ 0x8297 #define GL_SRGB_WRITE 0x8298 -#define GL_SRGB_DECODE_ARB 0x8299 #define GL_FILTER 0x829A #define GL_VERTEX_TEXTURE 0x829B #define GL_TESS_CONTROL_TEXTURE 0x829C @@ -2497,22 +2396,12 @@ typedef void GLvoid; #define GL_VIEW_CLASS_RGTC2_RG 0x82D1 #define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 #define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 -#endif - -#ifndef GL_ARB_invalidate_subdata -#endif - -#ifndef GL_ARB_multi_draw_indirect -#endif - -#ifndef GL_ARB_program_interface_query #define GL_UNIFORM 0x92E1 #define GL_UNIFORM_BLOCK 0x92E2 #define GL_PROGRAM_INPUT 0x92E3 #define GL_PROGRAM_OUTPUT 0x92E4 #define GL_BUFFER_VARIABLE 0x92E5 #define GL_SHADER_STORAGE_BLOCK 0x92E6 -/* reuse GL_ATOMIC_COUNTER_BUFFER */ #define GL_VERTEX_SUBROUTINE 0x92E8 #define GL_TESS_CONTROL_SUBROUTINE 0x92E9 #define GL_TESS_EVALUATION_SUBROUTINE 0x92EA @@ -2554,17 +2443,6 @@ typedef void GLvoid; #define GL_LOCATION 0x930E #define GL_LOCATION_INDEX 0x930F #define GL_IS_PER_PATCH 0x92E7 -/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ -/* reuse GL_COMPATIBLE_SUBROUTINES */ -#endif - -#ifndef GL_ARB_robust_buffer_access_behavior -#endif - -#ifndef GL_ARB_shader_image_size -#endif - -#ifndef GL_ARB_shader_storage_buffer_object #define GL_SHADER_STORAGE_BUFFER 0x90D2 #define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 #define GL_SHADER_STORAGE_BUFFER_START 0x90D4 @@ -2581,1955 +2459,794 @@ typedef void GLvoid; #define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF #define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 #define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 -/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ -#endif - -#ifndef GL_ARB_stencil_texturing #define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA -#endif - -#ifndef GL_ARB_texture_buffer_range #define GL_TEXTURE_BUFFER_OFFSET 0x919D #define GL_TEXTURE_BUFFER_SIZE 0x919E #define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); #endif - -#ifndef GL_ARB_texture_query_levels -#endif - -#ifndef GL_ARB_texture_storage_multisample -#endif - - -/*************************************************************/ - -#include -#ifndef GL_VERSION_2_0 -/* GL type for program/shader text */ -typedef char GLchar; -#endif - -#ifndef GL_VERSION_1_5 -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -#endif - -#ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif - -#ifndef GL_ARB_shader_objects -/* GL types for program/shader text and shader object handles */ -typedef char GLcharARB; -typedef unsigned int GLhandleARB; -#endif - -/* GL type for "half" precision (s10e5) float data in host memory */ -#ifndef GL_ARB_half_float_pixel -typedef unsigned short GLhalfARB; -#endif - -#ifndef GL_NV_half_float -typedef unsigned short GLhalfNV; -#endif - -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif - -#ifndef GL_EXT_timer_query -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; -#endif - -#ifndef GL_ARB_sync -typedef int64_t GLint64; -typedef uint64_t GLuint64; -typedef struct __GLsync *GLsync; -#endif - -#ifndef GL_ARB_cl_event -/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */ -struct _cl_context; -struct _cl_event; -#endif - -#ifndef GL_ARB_debug_output -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#endif - -#ifndef GL_AMD_debug_output -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#endif - -#ifndef GL_KHR_debug -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); -#endif - -#ifndef GL_NV_vdpau_interop -typedef GLintptr GLvdpauSurfaceNV; -#endif - -#ifndef GL_OES_fixed_point -/* GLint must be 32 bits, a relatively safe assumption on modern CPUs */ -typedef GLint GLfixed; -#endif - -#ifndef GL_VERSION_1_0 -#define GL_VERSION_1_0 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glCullFace (GLenum mode); -GLAPI void APIENTRY glFrontFace (GLenum mode); -GLAPI void APIENTRY glHint (GLenum target, GLenum mode); -GLAPI void APIENTRY glLineWidth (GLfloat width); -GLAPI void APIENTRY glPointSize (GLfloat size); -GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode); -GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glDrawBuffer (GLenum mode); -GLAPI void APIENTRY glClear (GLbitfield mask); -GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI void APIENTRY glClearStencil (GLint s); -GLAPI void APIENTRY glClearDepth (GLdouble depth); -GLAPI void APIENTRY glStencilMask (GLuint mask); -GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GLAPI void APIENTRY glDepthMask (GLboolean flag); -GLAPI void APIENTRY glDisable (GLenum cap); -GLAPI void APIENTRY glEnable (GLenum cap); -GLAPI void APIENTRY glFinish (void); -GLAPI void APIENTRY glFlush (void); -GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GLAPI void APIENTRY glLogicOp (GLenum opcode); -GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GLAPI void APIENTRY glDepthFunc (GLenum func); -GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); -GLAPI void APIENTRY glReadBuffer (GLenum mode); -GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); -GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *params); -GLAPI GLenum APIENTRY glGetError (void); -GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params); -GLAPI const GLubyte * APIENTRY glGetString (GLenum name); -GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); -GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far); -GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); -typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); -typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size); -typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); -typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth); -typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); -typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); -typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLFINISHPROC) (void); -typedef void (APIENTRYP PFNGLFLUSHPROC) (void); -typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); -typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode); -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); -typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *params); -typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *params); -typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void); -typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params); -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); -typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far); -typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_1 -#define GL_VERSION_1_1 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -GLAPI void APIENTRY glGetPointerv (GLenum pname, GLvoid* *params); -GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); -GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GLAPI GLboolean APIENTRY glIsTexture (GLuint texture); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); -#endif - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI void APIENTRY glBlendEquation (GLenum mode); -GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum texture); -GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); -GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); -GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); -GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); -GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GLAPI GLboolean APIENTRY glIsQuery (GLuint id); -GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); -GLAPI void APIENTRY glEndQuery (GLenum target); -GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); -GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -GLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GLAPI void APIENTRY glCompileShader (GLuint shader); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum type); -GLAPI void APIENTRY glDeleteProgram (GLuint program); -GLAPI void APIENTRY glDeleteShader (GLuint shader); -GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); -GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer); -GLAPI GLboolean APIENTRY glIsProgram (GLuint program); -GLAPI GLboolean APIENTRY glIsShader (GLuint shader); -GLAPI void APIENTRY glLinkProgram (GLuint program); -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length); -GLAPI void APIENTRY glUseProgram (GLuint program); -GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); -GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); -GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glValidateProgram (GLuint program); -GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif - -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -/* OpenGL 3.0 also reuses entry points from these extensions: */ -/* ARB_framebuffer_object */ -/* ARB_map_buffer_range */ -/* ARB_vertex_array_object */ -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); -GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); -GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); -GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); -GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GLAPI void APIENTRY glEndTransformFeedback (void); -GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode); -GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); -GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); -GLAPI void APIENTRY glEndConditionalRender (void); -GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); -GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); -GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); -GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); -GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); -GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); -#endif - -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -/* OpenGL 3.1 also reuses entry points from these extensions: */ -/* ARB_copy_buffer */ -/* ARB_uniform_buffer_object */ -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); -GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); -GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); -typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); -#endif - -#ifndef GL_VERSION_3_2 -#define GL_VERSION_3_2 1 -/* OpenGL 3.2 also reuses entry points from these extensions: */ -/* ARB_draw_elements_base_vertex */ -/* ARB_provoking_vertex */ -/* ARB_sync */ -/* ARB_texture_multisample */ -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -#endif - -#ifndef GL_VERSION_3_3 -#define GL_VERSION_3_3 1 -/* OpenGL 3.3 also reuses entry points from these extensions: */ -/* ARB_blend_func_extended */ -/* ARB_sampler_objects */ -/* ARB_explicit_attrib_location, but it has none */ -/* ARB_occlusion_query2 (no entry points) */ -/* ARB_shader_bit_encoding (no entry points) */ -/* ARB_texture_rgb10_a2ui (no entry points) */ -/* ARB_texture_swizzle (no entry points) */ -/* ARB_timer_query */ -/* ARB_vertex_type_2_10_10_10_rev */ -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); -#endif - -#ifndef GL_VERSION_4_0 -#define GL_VERSION_4_0 1 -/* OpenGL 4.0 also reuses entry points from these extensions: */ -/* ARB_texture_query_lod (no entry points) */ -/* ARB_draw_indirect */ -/* ARB_gpu_shader5 (no entry points) */ -/* ARB_gpu_shader_fp64 */ -/* ARB_shader_subroutine */ -/* ARB_tessellation_shader */ -/* ARB_texture_buffer_object_rgb32 (no entry points) */ -/* ARB_texture_cube_map_array (no entry points) */ -/* ARB_texture_gather (no entry points) */ -/* ARB_transform_feedback2 */ -/* ARB_transform_feedback3 */ -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glMinSampleShading (GLfloat value); -GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif - -#ifndef GL_VERSION_4_1 -#define GL_VERSION_4_1 1 -/* OpenGL 4.1 reuses entry points from these extensions: */ -/* ARB_ES2_compatibility */ -/* ARB_get_program_binary */ -/* ARB_separate_shader_objects */ -/* ARB_shader_precision (no entry points) */ -/* ARB_vertex_attrib_64bit */ -/* ARB_viewport_array */ -#endif - -#ifndef GL_VERSION_4_2 -#define GL_VERSION_4_2 1 -/* OpenGL 4.2 reuses entry points from these extensions: */ -/* ARB_base_instance */ -/* ARB_shading_language_420pack (no entry points) */ -/* ARB_transform_feedback_instanced */ -/* ARB_compressed_texture_pixel_storage (no entry points) */ -/* ARB_conservative_depth (no entry points) */ -/* ARB_internalformat_query */ -/* ARB_map_buffer_alignment (no entry points) */ -/* ARB_shader_atomic_counters */ -/* ARB_shader_image_load_store */ -/* ARB_shading_language_packing (no entry points) */ -/* ARB_texture_storage */ -#endif - -#ifndef GL_VERSION_4_3 -#define GL_VERSION_4_3 1 -/* OpenGL 4.3 reuses entry points from these extensions: */ -/* ARB_arrays_of_arrays (no entry points, GLSL only) */ -/* ARB_fragment_layer_viewport (no entry points, GLSL only) */ -/* ARB_shader_image_size (no entry points, GLSL only) */ -/* ARB_ES3_compatibility (no entry points) */ -/* ARB_clear_buffer_object */ -/* ARB_compute_shader */ -/* ARB_copy_image */ -/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */ -/* ARB_explicit_uniform_location (no entry points) */ -/* ARB_framebuffer_no_attachments */ -/* ARB_internalformat_query2 */ -/* ARB_invalidate_subdata */ -/* ARB_multi_draw_indirect */ -/* ARB_program_interface_query */ -/* ARB_robust_buffer_access_behavior (no entry points) */ -/* ARB_shader_storage_buffer_object */ -/* ARB_stencil_texturing (no entry points) */ -/* ARB_texture_buffer_range */ -/* ARB_texture_query_levels (no entry points) */ -/* ARB_texture_storage_multisample */ -/* ARB_texture_view */ -/* ARB_vertex_attrib_binding */ -#endif - -#ifndef GL_ARB_depth_buffer_float -#define GL_ARB_depth_buffer_float 1 -#endif - -#ifndef GL_ARB_framebuffer_object -#define GL_ARB_framebuffer_object 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); -GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); -GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI void APIENTRY glGenerateMipmap (GLenum target); -GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -#endif - -#ifndef GL_ARB_framebuffer_sRGB -#define GL_ARB_framebuffer_sRGB 1 -#endif - -#ifndef GL_ARB_half_float_vertex -#define GL_ARB_half_float_vertex 1 -#endif - -#ifndef GL_ARB_map_buffer_range -#define GL_ARB_map_buffer_range 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -#endif - -#ifndef GL_ARB_texture_compression_rgtc -#define GL_ARB_texture_compression_rgtc 1 -#endif - -#ifndef GL_ARB_texture_rg -#define GL_ARB_texture_rg 1 -#endif - -#ifndef GL_ARB_vertex_array_object -#define GL_ARB_vertex_array_object 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBindVertexArray (GLuint array); -GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); -#endif - -#ifndef GL_ARB_uniform_buffer_object -#define GL_ARB_uniform_buffer_object 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices); -GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -#endif - -#ifndef GL_ARB_copy_buffer -#define GL_ARB_copy_buffer 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -#endif - -#ifndef GL_ARB_depth_clamp -#define GL_ARB_depth_clamp 1 -#endif - -#ifndef GL_ARB_draw_elements_base_vertex -#define GL_ARB_draw_elements_base_vertex 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); -#endif - -#ifndef GL_ARB_fragment_coord_conventions -#define GL_ARB_fragment_coord_conventions 1 -#endif - -#ifndef GL_ARB_provoking_vertex -#define GL_ARB_provoking_vertex 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glProvokingVertex (GLenum mode); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); -#endif - -#ifndef GL_ARB_seamless_cube_map -#define GL_ARB_seamless_cube_map 1 -#endif - -#ifndef GL_ARB_sync -#define GL_ARB_sync 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GLAPI GLboolean APIENTRY glIsSync (GLsync sync); -GLAPI void APIENTRY glDeleteSync (GLsync sync); -GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); -typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif - -#ifndef GL_ARB_texture_multisample -#define GL_ARB_texture_multisample 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); -#endif - -#ifndef GL_ARB_vertex_array_bgra -#define GL_ARB_vertex_array_bgra 1 -#endif - -#ifndef GL_ARB_draw_buffers_blend -#define GL_ARB_draw_buffers_blend 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif - -#ifndef GL_ARB_sample_shading -#define GL_ARB_sample_shading 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); -#endif - -#ifndef GL_ARB_texture_cube_map_array -#define GL_ARB_texture_cube_map_array 1 -#endif - -#ifndef GL_ARB_texture_gather -#define GL_ARB_texture_gather 1 -#endif - -#ifndef GL_ARB_texture_query_lod -#define GL_ARB_texture_query_lod 1 -#endif - -#ifndef GL_ARB_shading_language_include -#define GL_ARB_shading_language_include 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); -GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); -GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); -typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); -typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); -typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); -#endif - -#ifndef GL_ARB_texture_compression_bptc -#define GL_ARB_texture_compression_bptc 1 -#endif - -#ifndef GL_ARB_blend_func_extended -#define GL_ARB_blend_func_extended 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); -#endif - -#ifndef GL_ARB_explicit_attrib_location -#define GL_ARB_explicit_attrib_location 1 -#endif - -#ifndef GL_ARB_occlusion_query2 -#define GL_ARB_occlusion_query2 1 -#endif - -#ifndef GL_ARB_sampler_objects -#define GL_ARB_sampler_objects 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); -GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); -GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); -GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_shader_bit_encoding -#define GL_ARB_shader_bit_encoding 1 -#endif - -#ifndef GL_ARB_texture_rgb10_a2ui -#define GL_ARB_texture_rgb10_a2ui 1 -#endif - -#ifndef GL_ARB_texture_swizzle -#define GL_ARB_texture_swizzle 1 -#endif - -#ifndef GL_ARB_timer_query -#define GL_ARB_timer_query 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); -GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); -#endif - -#ifndef GL_ARB_vertex_type_2_10_10_10_rev -#define GL_ARB_vertex_type_2_10_10_10_rev 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); -GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); -GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); -GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); -GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); -GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); -GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); -GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); -GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); -GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); -typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); -typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -#endif - -#ifndef GL_ARB_draw_indirect -#define GL_ARB_draw_indirect 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect); -GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect); -#endif - -#ifndef GL_ARB_gpu_shader5 -#define GL_ARB_gpu_shader5 1 -#endif - -#ifndef GL_ARB_gpu_shader_fp64 -#define GL_ARB_gpu_shader_fp64 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); -GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); -#endif - -#ifndef GL_ARB_shader_subroutine -#define GL_ARB_shader_subroutine 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); -GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); -GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); -typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); -#endif - -#ifndef GL_ARB_tessellation_shader -#define GL_ARB_tessellation_shader 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); -GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); -#endif - -#ifndef GL_ARB_texture_buffer_object_rgb32 -#define GL_ARB_texture_buffer_object_rgb32 1 -#endif - -#ifndef GL_ARB_transform_feedback2 -#define GL_ARB_transform_feedback2 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); -GLAPI void APIENTRY glPauseTransformFeedback (void); -GLAPI void APIENTRY glResumeTransformFeedback (void); -GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); -#endif - -#ifndef GL_ARB_transform_feedback3 -#define GL_ARB_transform_feedback3 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); -GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); -GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); -GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); -typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -#endif +#endif /* GL_VERSION_4_3 */ + +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 +#define GL_CLEAR_TEXTURE 0x9365 +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); +GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#endif +#endif /* GL_VERSION_4_4 */ #ifndef GL_ARB_ES2_compatibility #define GL_ARB_ES2_compatibility 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GLAPI void APIENTRY glClearDepthf (GLfloat d); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); -#endif +#endif /* GL_ARB_ES2_compatibility */ -#ifndef GL_ARB_get_program_binary -#define GL_ARB_get_program_binary 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); -GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); -#endif +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif /* GL_ARB_ES3_compatibility */ -#ifndef GL_ARB_separate_shader_objects -#define GL_ARB_separate_shader_objects 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); -GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); -GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* const *strings); -GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); -GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); -GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); -GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); -GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); -GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); -GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); -GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); -GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); -GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); -GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); -GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* const *strings); -typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); -typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); -typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif /* GL_ARB_arrays_of_arrays */ -#ifndef GL_ARB_vertex_attrib_64bit -#define GL_ARB_vertex_attrib_64bit 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); -GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); -GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); -GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); -#endif +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 +#endif /* GL_ARB_base_instance */ -#ifndef GL_ARB_viewport_array -#define GL_ARB_viewport_array 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); -GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); -GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); -GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); -GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); -GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); -GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); -GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); -typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); -typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); -typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); -#endif +#ifndef GL_ARB_bindless_texture +#define GL_ARB_bindless_texture 1 +typedef uint64_t GLuint64EXT; +#define GL_UNSIGNED_INT64_ARB 0x140F +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_ARB_bindless_texture */ + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 +#endif /* GL_ARB_blend_func_extended */ + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 +#endif /* GL_ARB_buffer_storage */ #ifndef GL_ARB_cl_event #define GL_ARB_cl_event 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); +struct _cl_context; +struct _cl_event; +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#endif +#endif /* GL_ARB_cl_event */ + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#endif /* GL_ARB_clear_buffer_object */ + +#ifndef GL_ARB_clear_texture +#define GL_ARB_clear_texture 1 +#endif /* GL_ARB_clear_texture */ + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 +#endif /* GL_ARB_compressed_texture_pixel_storage */ + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#endif /* GL_ARB_compute_shader */ + +#ifndef GL_ARB_compute_variable_group_size +#define GL_ARB_compute_variable_group_size 1 +#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 +#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB +#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 +#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); #endif +#endif /* GL_ARB_compute_variable_group_size */ + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 +#endif /* GL_ARB_conservative_depth */ + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#endif /* GL_ARB_copy_buffer */ + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#endif /* GL_ARB_copy_image */ #ifndef GL_ARB_debug_output #define GL_ARB_debug_output 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -#endif /* GLCOREARB_PROTOTYPES */ +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); #endif +#endif /* GL_ARB_debug_output */ -#ifndef GL_ARB_robustness -#define GL_ARB_robustness 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); -GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); -GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); -GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); -GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); -typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); -typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); -typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); -typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); -#endif +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif /* GL_ARB_depth_buffer_float */ -#ifndef GL_ARB_shader_stencil_export -#define GL_ARB_shader_stencil_export 1 -#endif +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif /* GL_ARB_depth_clamp */ -#ifndef GL_ARB_base_instance -#define GL_ARB_base_instance 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); #endif +#endif /* GL_ARB_draw_buffers_blend */ -#ifndef GL_ARB_shading_language_420pack -#define GL_ARB_shading_language_420pack 1 -#endif +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#endif /* GL_ARB_draw_elements_base_vertex */ -#ifndef GL_ARB_transform_feedback_instanced -#define GL_ARB_transform_feedback_instanced 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); -GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); -#endif +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 +#endif /* GL_ARB_draw_indirect */ -#ifndef GL_ARB_compressed_texture_pixel_storage -#define GL_ARB_compressed_texture_pixel_storage 1 -#endif +#ifndef GL_ARB_enhanced_layouts +#define GL_ARB_enhanced_layouts 1 +#endif /* GL_ARB_enhanced_layouts */ -#ifndef GL_ARB_conservative_depth -#define GL_ARB_conservative_depth 1 +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif /* GL_ARB_explicit_attrib_location */ + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif /* GL_ARB_explicit_uniform_location */ + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif /* GL_ARB_fragment_coord_conventions */ + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif /* GL_ARB_fragment_layer_viewport */ + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#endif /* GL_ARB_framebuffer_no_attachments */ + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#endif /* GL_ARB_framebuffer_object */ + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif /* GL_ARB_framebuffer_sRGB */ + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#endif /* GL_ARB_get_program_binary */ + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif /* GL_ARB_gpu_shader5 */ + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 +#endif /* GL_ARB_gpu_shader_fp64 */ + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif /* GL_ARB_half_float_vertex */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif /* GL_ARB_imaging */ + +#ifndef GL_ARB_indirect_parameters +#define GL_ARB_indirect_parameters 1 +#define GL_PARAMETER_BUFFER_ARB 0x80EE +#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); #endif +#endif /* GL_ARB_indirect_parameters */ #ifndef GL_ARB_internalformat_query #define GL_ARB_internalformat_query 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); #endif +#endif /* GL_ARB_internalformat_query */ -#ifndef GL_ARB_map_buffer_alignment -#define GL_ARB_map_buffer_alignment 1 -#endif - -#ifndef GL_ARB_shader_atomic_counters -#define GL_ARB_shader_atomic_counters 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); -#endif +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#define GL_SRGB_DECODE_ARB 0x8299 +#endif /* GL_ARB_internalformat_query2 */ -#ifndef GL_ARB_shader_image_load_store -#define GL_ARB_shader_image_load_store 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); -#endif +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#endif /* GL_ARB_invalidate_subdata */ -#ifndef GL_ARB_shading_language_packing -#define GL_ARB_shading_language_packing 1 -#endif +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 +#endif /* GL_ARB_map_buffer_alignment */ -#ifndef GL_ARB_texture_storage -#define GL_ARB_texture_storage 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#endif /* GL_ARB_map_buffer_range */ -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif +#ifndef GL_ARB_multi_bind +#define GL_ARB_multi_bind 1 +#endif /* GL_ARB_multi_bind */ -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GLAPI void APIENTRY glPopDebugGroup (void); -GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); -GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); -typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#endif /* GL_ARB_multi_draw_indirect */ -#ifndef GL_ARB_arrays_of_arrays -#define GL_ARB_arrays_of_arrays 1 -#endif +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif /* GL_ARB_occlusion_query2 */ -#ifndef GL_ARB_clear_buffer_object -#define GL_ARB_clear_buffer_object 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); -#endif +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#endif /* GL_ARB_program_interface_query */ -#ifndef GL_ARB_compute_shader -#define GL_ARB_compute_shader 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); -#endif +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#endif /* GL_ARB_provoking_vertex */ -#ifndef GL_ARB_copy_image -#define GL_ARB_copy_image 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -#endif +#ifndef GL_ARB_query_buffer_object +#define GL_ARB_query_buffer_object 1 +#endif /* GL_ARB_query_buffer_object */ -#ifndef GL_ARB_texture_view -#define GL_ARB_texture_view 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -#endif +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif /* GL_ARB_robust_buffer_access_behavior */ -#ifndef GL_ARB_vertex_attrib_binding -#define GL_ARB_vertex_attrib_binding 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); #endif +#endif /* GL_ARB_robustness */ #ifndef GL_ARB_robustness_isolation #define GL_ARB_robustness_isolation 1 -#endif +#endif /* GL_ARB_robustness_isolation */ -#ifndef GL_ARB_ES3_compatibility -#define GL_ARB_ES3_compatibility 1 +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); #endif +#endif /* GL_ARB_sample_shading */ -#ifndef GL_ARB_explicit_uniform_location -#define GL_ARB_explicit_uniform_location 1 -#endif +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 +#endif /* GL_ARB_sampler_objects */ -#ifndef GL_ARB_fragment_layer_viewport -#define GL_ARB_fragment_layer_viewport 1 -#endif +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif /* GL_ARB_seamless_cube_map */ -#ifndef GL_ARB_framebuffer_no_attachments -#define GL_ARB_framebuffer_no_attachments 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); -GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); -GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); -#endif +#ifndef GL_ARB_seamless_cubemap_per_texture +#define GL_ARB_seamless_cubemap_per_texture 1 +#endif /* GL_ARB_seamless_cubemap_per_texture */ -#ifndef GL_ARB_internalformat_query2 -#define GL_ARB_internalformat_query2 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); -#endif +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#endif /* GL_ARB_separate_shader_objects */ -#ifndef GL_ARB_invalidate_subdata -#define GL_ARB_invalidate_subdata 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); -GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); -GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); -GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); -GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); -typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); -typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -#endif +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 +#endif /* GL_ARB_shader_atomic_counters */ -#ifndef GL_ARB_multi_draw_indirect -#define GL_ARB_multi_draw_indirect 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); -#endif +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 +#endif /* GL_ARB_shader_bit_encoding */ -#ifndef GL_ARB_program_interface_query -#define GL_ARB_program_interface_query 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); -GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); -#endif +#ifndef GL_ARB_shader_draw_parameters +#define GL_ARB_shader_draw_parameters 1 +#endif /* GL_ARB_shader_draw_parameters */ -#ifndef GL_ARB_robust_buffer_access_behavior -#define GL_ARB_robust_buffer_access_behavior 1 -#endif +#ifndef GL_ARB_shader_group_vote +#define GL_ARB_shader_group_vote 1 +#endif /* GL_ARB_shader_group_vote */ + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 +#endif /* GL_ARB_shader_image_load_store */ #ifndef GL_ARB_shader_image_size #define GL_ARB_shader_image_size 1 -#endif +#endif /* GL_ARB_shader_image_size */ + +#ifndef GL_ARB_shader_precision +#define GL_ARB_shader_precision 1 +#endif /* GL_ARB_shader_precision */ + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif /* GL_ARB_shader_stencil_export */ #ifndef GL_ARB_shader_storage_buffer_object #define GL_ARB_shader_storage_buffer_object 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +#endif /* GL_ARB_shader_storage_buffer_object */ + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 +#endif /* GL_ARB_shader_subroutine */ + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 +#endif /* GL_ARB_shading_language_420pack */ + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); #endif +#endif /* GL_ARB_shading_language_include */ + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 +#endif /* GL_ARB_shading_language_packing */ + +#ifndef GL_ARB_sparse_texture +#define GL_ARB_sparse_texture 1 +#define GL_TEXTURE_SPARSE_ARB 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 +#define GL_MIN_SPARSE_LEVEL_ARB 0x919B +#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +#endif +#endif /* GL_ARB_sparse_texture */ #ifndef GL_ARB_stencil_texturing #define GL_ARB_stencil_texturing 1 -#endif +#endif /* GL_ARB_stencil_texturing */ + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#endif /* GL_ARB_sync */ + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 +#endif /* GL_ARB_tessellation_shader */ + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif /* GL_ARB_texture_buffer_object_rgb32 */ #ifndef GL_ARB_texture_buffer_range #define GL_ARB_texture_buffer_range 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -#endif +#endif /* GL_ARB_texture_buffer_range */ + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#endif /* GL_ARB_texture_compression_bptc */ + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif /* GL_ARB_texture_compression_rgtc */ + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#endif /* GL_ARB_texture_cube_map_array */ + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F +#endif /* GL_ARB_texture_gather */ + +#ifndef GL_ARB_texture_mirror_clamp_to_edge +#define GL_ARB_texture_mirror_clamp_to_edge 1 +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#endif /* GL_ARB_texture_multisample */ #ifndef GL_ARB_texture_query_levels #define GL_ARB_texture_query_levels 1 -#endif +#endif /* GL_ARB_texture_query_levels */ + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif /* GL_ARB_texture_query_lod */ + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif /* GL_ARB_texture_rg */ + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif /* GL_ARB_texture_rgb10_a2ui */ + +#ifndef GL_ARB_texture_stencil8 +#define GL_ARB_texture_stencil8 1 +#endif /* GL_ARB_texture_stencil8 */ + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 +#endif /* GL_ARB_texture_storage */ #ifndef GL_ARB_texture_storage_multisample #define GL_ARB_texture_storage_multisample 1 -#ifdef GLCOREARB_PROTOTYPES -GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -#endif /* GLCOREARB_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -#endif +#endif /* GL_ARB_texture_storage_multisample */ + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 +#endif /* GL_ARB_texture_swizzle */ + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#endif /* GL_ARB_texture_view */ + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +#endif /* GL_ARB_timer_query */ + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#endif /* GL_ARB_transform_feedback2 */ +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 +#endif /* GL_ARB_transform_feedback3 */ + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 +#endif /* GL_ARB_transform_feedback_instanced */ + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#endif /* GL_ARB_uniform_buffer_object */ + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif /* GL_ARB_vertex_array_bgra */ + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#endif /* GL_ARB_vertex_array_object */ + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#endif /* GL_ARB_vertex_attrib_64bit */ + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#endif /* GL_ARB_vertex_attrib_binding */ + +#ifndef GL_ARB_vertex_type_10f_11f_11f_rev +#define GL_ARB_vertex_type_10f_11f_11f_rev 1 +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#endif /* GL_ARB_viewport_array */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_ldr */ #ifdef __cplusplus } From 6908738afb851e53b0f71fda07ae1891708b0a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:50:25 +0200 Subject: [PATCH 12/90] Extended extension support bitset to handle MOAR of them. 160 should be enough for everyone ;-) --- src/Context.h | 2 +- src/Extensions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Context.h b/src/Context.h index 3bdd1c6f0..358707c15 100644 --- a/src/Context.h +++ b/src/Context.h @@ -366,7 +366,7 @@ class MAGNUM_EXPORT Context { Int _minorVersion; Flags _flags; - std::bitset<128> extensionStatus; + std::bitset<160> extensionStatus; std::vector _supportedExtensions; Implementation::State* _state; diff --git a/src/Extensions.h b/src/Extensions.h index 80595b3a2..15bcb9ce4 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -189,7 +189,7 @@ namespace GL { _extension(GL,NV,conditional_render, GL210, GL300) // #346 /* NV_draw_texture not supported */ // #430 } - /* IMPORTANT: if this line is > 194 (67 + size), don't forget to update array size in Context.h */ + /* IMPORTANT: if this line is > 226 (66 + size), don't forget to update array size in Context.h */ #else #line 1 namespace ANGLE { From cfa3d35f1132eb1f34c7c08de80d31d7c7c161f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 01:55:19 +0200 Subject: [PATCH 13/90] Support for ARB_texture_mirror_clamp_to_edge. This functionality was present in ATI_texture_mirror_once and EXT_texture_mirror_clamp for ages, now (strict subset of) it is in core OpenGL 4.4 too. --- src/Context.cpp | 2 ++ src/Extensions.h | 3 +++ src/Sampler.h | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index eb3b97165..d84d5fbbe 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -82,7 +82,9 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,AMD,vertex_shader_layer), // done _extension(GL,AMD,shader_trinary_minmax), // done _extension(GL,ARB,robustness), // done + _extension(GL,ATI,texture_mirror_once), _extension(GL,EXT,texture_filter_anisotropic), // done + _extension(GL,EXT,texture_mirror_clamp), _extension(GL,EXT,direct_state_access), _extension(GL,GREMEDY,string_marker)}; // done static const std::vector extensions300{ diff --git a/src/Extensions.h b/src/Extensions.h index 15bcb9ce4..97ddf6bb1 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -161,10 +161,13 @@ namespace GL { _extension(GL,ARB,texture_mirror_clamp_to_edge, GL210, GL440) // #149 _extension(GL,ARB,texture_stencil8, GL210, GL440) // #150 _extension(GL,ARB,vertex_type_10f_11f_11f_rev, GL300, GL440) // #151 + } namespace ATI { + _extension(GL,ATI,texture_mirror_once, GL210, None) // #221 } namespace EXT { _extension(GL,EXT,texture_filter_anisotropic, GL210, None) // #187 /* EXT_framebuffer_object, EXT_packed_depth_stencil, EXT_framebuffer_blit, EXT_framebuffer_multisample replaced with ARB_framebuffer_object */ + _extension(GL,EXT,texture_mirror_clamp, GL210, None) // #298 _extension(GL,EXT,gpu_shader4, GL210, GL300) // #326 _extension(GL,EXT,packed_float, GL210, GL300) // #328 _extension(GL,EXT,texture_array, GL210, GL300) // #329 diff --git a/src/Sampler.h b/src/Sampler.h index 83d390aca..0c771b4f1 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -113,11 +113,24 @@ class Sampler { * @requires_es_extension %Extension @es_extension{NV,texture_border_clamp} */ #ifndef MAGNUM_TARGET_GLES - ClampToBorder = GL_CLAMP_TO_BORDER + ClampToBorder = GL_CLAMP_TO_BORDER, #else - ClampToBorder = GL_CLAMP_TO_BORDER_NV + ClampToBorder = GL_CLAMP_TO_BORDER_NV, #endif #endif + + #ifndef MAGNUM_TARGET_GLES + /** + * Mirror the texture once in negative coordinates and clamp to + * edge after that. + * @requires_gl44 %Extension @extension{ARB,texture_mirror_clamp_to_edge}, + * @extension{ATI,texture_mirror_once} or @extension{EXT,texture_mirror_clamp} + * @requires_gl Only separate @ref Magnum::Sampler::Wrapping "Wrapping::MirroredRepeat" + * or @ref Magnum::Sampler::Wrapping "Wrapping::ClampToEdge" + * is available in OpenGL ES. + */ + MirrorClampToEdge = GL_MIRROR_CLAMP_TO_EDGE + #endif }; #ifndef MAGNUM_TARGET_GLES3 From f94a53fee0d623ba618b1d3716e294c673afd327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 10:41:50 +0200 Subject: [PATCH 14/90] Workaround Doxygen misparse. Was displayed as EGL**. --- doc/building.dox | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/building.dox b/doc/building.dox index 67f412056..def7912d6 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -127,8 +127,8 @@ platform best: - `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application". Requires **SDL2** library. - `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication", - available only if targeting OpenGL ES (see above). Requires **X11** and - **EGL** libraries. + available only if targeting OpenGL ES (see above). Requires **X11** and **EGL** + libraries. - `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication". Requires **X11** and **GLX** libraries. From fc0bde4f47ccf4d79a1da37bedaded4f26210ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 12:26:07 +0200 Subject: [PATCH 15/90] Wrap CMAKE_SHARED_LIBRARY_CXX_FLAGS in quotes. The variable is empty on some platforms (Windows), would cause issues. --- src/CMakeLists.txt | 2 +- src/DebugTools/CMakeLists.txt | 2 +- src/MeshTools/CMakeLists.txt | 2 +- src/Primitives/CMakeLists.txt | 2 +- src/Shaders/CMakeLists.txt | 2 +- src/Shapes/CMakeLists.txt | 2 +- src/Text/CMakeLists.txt | 2 +- src/TextureTools/CMakeLists.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60ce0ab96..d73655b32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,7 +164,7 @@ add_library(Magnum ${SHARED_OR_STATIC} $) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(Magnum PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() set(Magnum_LIBS ${CORRADE_UTILITY_LIBRARY} diff --git a/src/DebugTools/CMakeLists.txt b/src/DebugTools/CMakeLists.txt index 8295748fe..66546c172 100644 --- a/src/DebugTools/CMakeLists.txt +++ b/src/DebugTools/CMakeLists.txt @@ -50,7 +50,7 @@ set(MagnumDebugTools_HEADERS add_library(MagnumDebugTools ${SHARED_OR_STATIC} ${MagnumDebugTools_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumDebugTools PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumDebugTools PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumDebugTools Magnum diff --git a/src/MeshTools/CMakeLists.txt b/src/MeshTools/CMakeLists.txt index 3ed711ac5..ef0c26d2e 100644 --- a/src/MeshTools/CMakeLists.txt +++ b/src/MeshTools/CMakeLists.txt @@ -62,7 +62,7 @@ add_library(MagnumMeshTools ${SHARED_OR_STATIC} ${MagnumMeshTools_GracefulAssert_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumMeshTools PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumMeshTools PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumMeshTools Magnum) diff --git a/src/Primitives/CMakeLists.txt b/src/Primitives/CMakeLists.txt index 8ee9e9951..ae364551e 100644 --- a/src/Primitives/CMakeLists.txt +++ b/src/Primitives/CMakeLists.txt @@ -54,7 +54,7 @@ set(MagnumPrimitives_HEADERS add_library(MagnumPrimitives ${SHARED_OR_STATIC} ${MagnumPrimitives_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(Magnum PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(Magnum PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumPrimitives Magnum) diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt index 79de6f97c..6e4747b37 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Shaders/CMakeLists.txt @@ -52,7 +52,7 @@ endif() add_library(MagnumShaders ${SHARED_OR_STATIC} ${MagnumShaders_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumShaders PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumShaders PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumShaders Magnum) diff --git a/src/Shapes/CMakeLists.txt b/src/Shapes/CMakeLists.txt index 189a1f07e..2f23c8abb 100644 --- a/src/Shapes/CMakeLists.txt +++ b/src/Shapes/CMakeLists.txt @@ -60,7 +60,7 @@ set(MagnumShapes_HEADERS add_library(MagnumShapes ${SHARED_OR_STATIC} ${MagnumShapes_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumShapes PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumShapes PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumShapes Magnum MagnumSceneGraph) diff --git a/src/Text/CMakeLists.txt b/src/Text/CMakeLists.txt index daed39f76..ddd67fb42 100644 --- a/src/Text/CMakeLists.txt +++ b/src/Text/CMakeLists.txt @@ -41,7 +41,7 @@ set(MagnumText_HEADERS add_library(MagnumText ${SHARED_OR_STATIC} ${MagnumText_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumText PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumText PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumText Magnum MagnumTextureTools) diff --git a/src/TextureTools/CMakeLists.txt b/src/TextureTools/CMakeLists.txt index b2237b57b..6529facbf 100644 --- a/src/TextureTools/CMakeLists.txt +++ b/src/TextureTools/CMakeLists.txt @@ -42,7 +42,7 @@ endif() add_library(MagnumTextureTools ${SHARED_OR_STATIC} ${MagnumTextureTools_SRCS}) if(BUILD_STATIC_PIC) # TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property - set_target_properties(MagnumTextureTools PROPERTIES COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + set_target_properties(MagnumTextureTools PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") endif() target_link_libraries(MagnumTextureTools Magnum) From b1766627a7ac72ef1a9257b57076f0bd10c55786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 12:27:37 +0200 Subject: [PATCH 16/90] Treat MagnumMathObjects and MagnumObjects libs separately for exporting. It's more intuitive and might be useful at some point. --- src/CMakeLists.txt | 3 ++- src/magnumVisibility.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d73655b32..cee41dec2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -156,7 +156,8 @@ set(MagnumMath_SRCS # TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS}) add_library(MagnumObjects OBJECT ${Magnum_SRCS}) -set_target_properties(MagnumObjects MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") +set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") +set_target_properties(MagnumObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") # Main library add_library(Magnum ${SHARED_OR_STATIC} diff --git a/src/magnumVisibility.h b/src/magnumVisibility.h index 60e1f8cca..09ac087ed 100644 --- a/src/magnumVisibility.h +++ b/src/magnumVisibility.h @@ -26,7 +26,7 @@ #include -#if defined(Magnum_EXPORTS) || defined(MagnumObjects_EXPORTS) +#if defined(Magnum_EXPORTS) || defined(MagnumObjects_EXPORTS) || defined(MagnumMathObjects_EXPORTS) #define MAGNUM_EXPORT CORRADE_VISIBILITY_EXPORT #else #define MAGNUM_EXPORT CORRADE_VISIBILITY_IMPORT From 56bb116305f349018a7bd05c77b3beb724983c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 12:28:53 +0200 Subject: [PATCH 17/90] Fix loud linker error on mingw32. Mingw for some reasons instantiates depending template before dependent one, causing the dependent one to be instantiated twice. --- src/Math/instantiation.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Math/instantiation.cpp b/src/Math/instantiation.cpp index 99a20d760..dcaaaa601 100644 --- a/src/Math/instantiation.cpp +++ b/src/Math/instantiation.cpp @@ -52,21 +52,33 @@ template struct ConfigurationValue>; #endif +/* For some reason mingw's GCC instantiates ConfigurationValue> + (which depends on ConfigurationValue) before + these and then loudly complains about multiple definitions. WTF. */ + template struct ConfigurationValue>; template struct ConfigurationValue>; +#ifndef _WIN32 template struct ConfigurationValue>; +#endif template struct ConfigurationValue>; template struct ConfigurationValue>; +#ifndef _WIN32 template struct ConfigurationValue>; +#endif template struct ConfigurationValue>; template struct ConfigurationValue>; +#ifndef _WIN32 template struct ConfigurationValue>; +#endif #ifndef MAGNUM_TARGET_GLES template struct ConfigurationValue>; template struct ConfigurationValue>; +#ifndef _WIN32 template struct ConfigurationValue>; #endif #endif +#endif }} From 0140aab5b1254d15184e23e2c9c6d926d732bf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 12:30:20 +0200 Subject: [PATCH 18/90] Another mingw32 linker error fix. This class is templated and thus doesn't export anything. --- src/Shapes/Shape.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shapes/Shape.h b/src/Shapes/Shape.h index 7d1774f91..05cd10172 100644 --- a/src/Shapes/Shape.h +++ b/src/Shapes/Shape.h @@ -65,7 +65,7 @@ Shapes::AbstractShape3D* firstCollision = shapes.firstCollision(shape); @see @ref scenegraph, ShapeGroup2D, ShapeGroup3D, DebugTools::ShapeRenderer */ -template class MAGNUM_SHAPES_EXPORT Shape: public AbstractShape { +template class Shape: public AbstractShape { friend struct Implementation::ShapeHelper; public: From 706560fb28977e6ea7354609279c2a261c11c51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 12:31:02 +0200 Subject: [PATCH 19/90] Mingw32's GCC 4.7 doesn't have std::to_string(). --- src/Shader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Shader.cpp b/src/Shader.cpp index 5b12c8b03..47063e848 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -27,7 +27,7 @@ #include #include -#ifdef CORRADE_TARGET_NACL_NEWLIB +#if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(_WIN32) #include #endif @@ -106,7 +106,7 @@ Shader& Shader::operator=(Shader&& other) { Shader& Shader::addSource(std::string source) { if(!source.empty()) { - #ifdef CORRADE_TARGET_NACL_NEWLIB + #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(_WIN32) std::ostringstream converter; converter << (sources.size()+1)/2; #endif @@ -114,7 +114,7 @@ Shader& Shader::addSource(std::string source) { /* Fix line numbers, so line 41 of third added file is marked as 3(41). Source 0 is the #version string added in constructor. */ sources.push_back("#line 1 " + - #ifndef CORRADE_TARGET_NACL_NEWLIB + #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(_WIN32) std::to_string((sources.size()+1)/2) + #else converter.str() + From 5e281db69318792c535e4834c53d103bf6a4ea64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 13:39:51 +0200 Subject: [PATCH 20/90] Yet another mingw32 linker fix. --- src/AbstractTexture.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 26835ac0b..44fbc5c51 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -967,9 +967,9 @@ template void AbstractTexture::image(GLenum target, GLin image.setData(image.format(), image.type(), size, data); } -template void AbstractTexture::image<1>(GLenum, GLint, Image<1>&); -template void AbstractTexture::image<2>(GLenum, GLint, Image<2>&); -template void AbstractTexture::image<3>(GLenum, GLint, Image<3>&); +template void MAGNUM_EXPORT AbstractTexture::image<1>(GLenum, GLint, Image<1>&); +template void MAGNUM_EXPORT AbstractTexture::image<2>(GLenum, GLint, Image<2>&); +template void MAGNUM_EXPORT AbstractTexture::image<3>(GLenum, GLint, Image<3>&); template void AbstractTexture::image(GLenum target, GLint level, BufferImage& image, Buffer::Usage usage) { const Math::Vector size = DataHelper::imageSize(this, target, level); @@ -981,9 +981,9 @@ template void AbstractTexture::image(GLenum target, GLin (this->*getImageImplementation)(target, level, image.format(), image.type(), dataSize, nullptr); } -template void AbstractTexture::image<1>(GLenum, GLint, BufferImage<1>&, Buffer::Usage); -template void AbstractTexture::image<2>(GLenum, GLint, BufferImage<2>&, Buffer::Usage); -template void AbstractTexture::image<3>(GLenum, GLint, BufferImage<3>&, Buffer::Usage); +template void MAGNUM_EXPORT AbstractTexture::image<1>(GLenum, GLint, BufferImage<1>&, Buffer::Usage); +template void MAGNUM_EXPORT AbstractTexture::image<2>(GLenum, GLint, BufferImage<2>&, Buffer::Usage); +template void MAGNUM_EXPORT AbstractTexture::image<3>(GLenum, GLint, BufferImage<3>&, Buffer::Usage); #endif #endif From 012d3e6a12204adc78c08e346c98ec7bc87f7455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 18:55:51 +0200 Subject: [PATCH 21/90] Primitives: fix Icosphere header. This mess is long overdue. --- src/Primitives/Icosphere.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h index 748c5e52f..220db6bfe 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Primitives/Icosphere.h @@ -68,11 +68,11 @@ template class Icosphere { /** @brief Constructor */ explicit Icosphere() { for(std::size_t i = 0; i != subdivisions; ++i) - MeshTools::subdivide(*indices(), *normals(0), [](const Vector3& a, const Vector3& b) { + MeshTools::subdivide(indices(), normals(0), [](const Vector3& a, const Vector3& b) { return (a+b).normalized(); }); - MeshTools::removeDuplicates(*indices(), *normals(0)); + MeshTools::removeDuplicates(indices(), normals(0)); positions(0)->assign(normals(0)->begin(), normals(0)->end()); } }; From c24853b041efb76aca9111172981150959089533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 19:08:16 +0200 Subject: [PATCH 22/90] Primitives: remove template crap around Icosphere. Now it has API similar to all other primitives. This thing was long overdue. --- src/Primitives/Icosphere.cpp | 85 +++++++++++++++++++++--------------- src/Primitives/Icosphere.h | 47 +++++--------------- 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/src/Primitives/Icosphere.cpp b/src/Primitives/Icosphere.cpp index 56a10f776..b6f09d32c 100644 --- a/src/Primitives/Icosphere.cpp +++ b/src/Primitives/Icosphere.cpp @@ -25,45 +25,58 @@ #include "Icosphere.h" #include "Math/Vector3.h" +#include "Trade/MeshData3D.h" +#include "MeshTools/Subdivide.h" +#include "MeshTools/RemoveDuplicates.h" namespace Magnum { namespace Primitives { -Icosphere<0>::Icosphere(): MeshData3D(Mesh::Primitive::Triangles, { - 1, 2, 6, - 1, 7, 2, - 3, 4, 5, - 4, 3, 8, - 6, 5, 11, - 5, 6, 10, - 9, 10, 2, - 10, 9, 3, - 7, 8, 9, - 8, 7, 0, - 11, 0, 1, - 0, 11, 4, - 6, 2, 10, - 1, 6, 11, - 3, 5, 10, - 5, 4, 11, - 2, 7, 9, - 7, 1, 0, - 3, 9, 8, - 4, 8, 0 -}, {}, {{ - {0.0f, -0.525731f, 0.850651f}, - {0.850651f, 0.0f, 0.525731f}, - {0.850651f, 0.0f, -0.525731f}, - {-0.850651f, 0.0f, -0.525731f}, - {-0.850651f, 0.0f, 0.525731f}, - {-0.525731f, 0.850651f, 0.0f}, - {0.525731f, 0.850651f, 0.0f}, - {0.525731f, -0.850651f, 0.0f}, - {-0.525731f, -0.850651f, 0.0f}, - {0.0f, -0.525731f, -0.850651f}, - {0.0f, 0.525731f, -0.850651f}, - {0.0f, 0.525731f, 0.850651f} -}}, {}) { - positions(0).assign(normals(0).begin(), normals(0).end()); +Trade::MeshData3D Icosphere::solid(const UnsignedInt subdivisions) { + std::vector indices{ + 1, 2, 6, + 1, 7, 2, + 3, 4, 5, + 4, 3, 8, + 6, 5, 11, + 5, 6, 10, + 9, 10, 2, + 10, 9, 3, + 7, 8, 9, + 8, 7, 0, + 11, 0, 1, + 0, 11, 4, + 6, 2, 10, + 1, 6, 11, + 3, 5, 10, + 5, 4, 11, + 2, 7, 9, + 7, 1, 0, + 3, 9, 8, + 4, 8, 0 + }; + + std::vector vertices{ + {0.0f, -0.525731f, 0.850651f}, + {0.850651f, 0.0f, 0.525731f}, + {0.850651f, 0.0f, -0.525731f}, + {-0.850651f, 0.0f, -0.525731f}, + {-0.850651f, 0.0f, 0.525731f}, + {-0.525731f, 0.850651f, 0.0f}, + {0.525731f, 0.850651f, 0.0f}, + {0.525731f, -0.850651f, 0.0f}, + {-0.525731f, -0.850651f, 0.0f}, + {0.0f, -0.525731f, -0.850651f}, + {0.0f, 0.525731f, -0.850651f}, + {0.0f, 0.525731f, 0.850651f} + }; + + for(std::size_t i = 0; i != subdivisions; ++i) + MeshTools::subdivide(indices, vertices, [](const Vector3& a, const Vector3& b) { + return (a+b).normalized(); + }); + + MeshTools::removeDuplicates(indices, vertices); + return Trade::MeshData3D(Mesh::Primitive::Triangles, std::move(indices), {vertices}, {std::move(vertices)}, {}); } }} diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h index 220db6bfe..e0a39360f 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Primitives/Icosphere.h @@ -28,53 +28,26 @@ * @brief Class Magnum::Primitives::Icosphere */ -#include "Math/Vector3.h" -#include "MeshTools/RemoveDuplicates.h" -#include "MeshTools/Subdivide.h" -#include "Trade/MeshData3D.h" +#include "Trade/Trade.h" #include "Primitives/magnumPrimitivesVisibility.h" namespace Magnum { namespace Primitives { -/** @todoc Remove `ifndef` when Doxygen is sane again */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_PRIMITIVES_EXPORT Icosphere; -#endif - -/** -@brief 3D icosphere primitive with zero subdivisions - -Indexed @ref Mesh::Primitive "Triangles" with normals. -*/ -template<> class Icosphere<0>: public Trade::MeshData3D { - public: - /** @brief Constructor */ - explicit Icosphere(); -}; - /** @brief 3D icosphere primitive -@tparam subdivisions Number of subdivisions -Indexed @ref Mesh::Primitive "Triangles" with normals. +Sphere with radius `1`. */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template class Icosphere: public Icosphere<0> { -#else -template class Icosphere { -#endif +class MAGNUM_PRIMITIVES_EXPORT Icosphere { public: - /** @brief Constructor */ - explicit Icosphere() { - for(std::size_t i = 0; i != subdivisions; ++i) - MeshTools::subdivide(indices(), normals(0), [](const Vector3& a, const Vector3& b) { - return (a+b).normalized(); - }); - - MeshTools::removeDuplicates(indices(), normals(0)); - positions(0)->assign(normals(0)->begin(), normals(0)->end()); - } + /** + * @brief Solid icosphere + * @param subdivisions Number of subdivisions + * + * Indexed @ref Mesh::Primitive "Triangles" with normals. + */ + static Trade::MeshData3D solid(UnsignedInt subdivisions); }; }} From 7636c6adc3c78bd953930ffb5d8af7dd71774b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 16:22:36 +0200 Subject: [PATCH 23/90] Better usage of *Basic* in class names, part 1: SceneGraph object. Use AbstractObject like before and add two kinds of aliases instead of only one: AbstractBasicObject2D/AbstractBasicObject3D for abstract type and AbstractObject2D/AbstractObject2D for Float. Makes it easier to use AbstractObject in templates of fixed dimensions (e.g. Bullet integration, where it can now be written as `AbstractBasicObject2D` instead of potentially confusing `AbstractBasicObject<2, btScalar>`). Partially reverts commit cfd405c32ca74f7e139078cb0199e76c7b7413ef. --- src/DebugTools/ForceRenderer.cpp | 2 +- src/DebugTools/ForceRenderer.h | 2 +- src/DebugTools/ObjectRenderer.cpp | 2 +- src/DebugTools/ObjectRenderer.h | 2 +- src/SceneGraph/AbstractCamera.h | 2 +- src/SceneGraph/AbstractCamera.hpp | 6 +-- src/SceneGraph/AbstractFeature.h | 24 ++++----- src/SceneGraph/AbstractFeature.hpp | 2 +- src/SceneGraph/AbstractGroupedFeature.h | 2 +- src/SceneGraph/AbstractObject.h | 65 +++++++++++++++++++------ src/SceneGraph/Animable.h | 2 +- src/SceneGraph/Animable.hpp | 2 +- src/SceneGraph/Camera2D.h | 2 +- src/SceneGraph/Camera2D.hpp | 2 +- src/SceneGraph/Camera3D.h | 2 +- src/SceneGraph/Camera3D.hpp | 2 +- src/SceneGraph/Drawable.h | 2 +- src/SceneGraph/Object.h | 14 +++--- src/SceneGraph/Object.hpp | 8 +-- src/SceneGraph/SceneGraph.h | 13 +++-- src/SceneGraph/instantiation.cpp | 4 +- src/Shapes/AbstractShape.cpp | 2 +- src/Shapes/AbstractShape.h | 2 +- src/Shapes/Shape.h | 6 +-- src/Shapes/ShapeGroup.cpp | 4 +- 25 files changed, 108 insertions(+), 68 deletions(-) diff --git a/src/DebugTools/ForceRenderer.cpp b/src/DebugTools/ForceRenderer.cpp index 5ee1f2179..da72e3501 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/DebugTools/ForceRenderer.cpp @@ -64,7 +64,7 @@ const std::array indices{{ } -template ForceRenderer::ForceRenderer(SceneGraph::AbstractBasicObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance()->get(options)) { +template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance()->get(options)) { /* Shader */ shader = ResourceManager::instance()->get>(shaderKey()); if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::Flat); diff --git a/src/DebugTools/ForceRenderer.h b/src/DebugTools/ForceRenderer.h index 3a40ec092..1b70c545c 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/DebugTools/ForceRenderer.h @@ -117,7 +117,7 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p * saved as reference to original vector and thus it must be available * for the whole lifetime of the renderer. */ - explicit ForceRenderer(SceneGraph::AbstractBasicObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); + explicit ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); protected: void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) override; diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/DebugTools/ObjectRenderer.cpp index 94194bc4c..3f4573452 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/DebugTools/ObjectRenderer.cpp @@ -142,7 +142,7 @@ const std::array Renderer<3>::indices{{ } -template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractBasicObject* object, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), options(ResourceManager::instance()->get(options)) { +template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), options(ResourceManager::instance()->get(options)) { /* Shader */ shader = ResourceManager::instance()->get>(Renderer::shader()); if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::VertexColor); diff --git a/src/DebugTools/ObjectRenderer.h b/src/DebugTools/ObjectRenderer.h index 7f86de227..eb92f723b 100644 --- a/src/DebugTools/ObjectRenderer.h +++ b/src/DebugTools/ObjectRenderer.h @@ -96,7 +96,7 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: * * The renderer is automatically added to object's features. */ - explicit ObjectRenderer(SceneGraph::AbstractBasicObject* object, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); + explicit ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); protected: void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) override; diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index e07f90bb2..52dc8b497 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -78,7 +78,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Constructor * @param object Object holding the camera */ - explicit AbstractBasicCamera(AbstractBasicObject* object); + explicit AbstractBasicCamera(AbstractObject* object); virtual ~AbstractBasicCamera() = 0; diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index dbd368ba9..15f7d3fad 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -70,7 +70,7 @@ template typename DimensionTraits AbstractBasicCamera::AbstractBasicCamera(AbstractBasicObject* object): AbstractBasicFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { +template AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractBasicFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { AbstractBasicFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } @@ -88,14 +88,14 @@ template void AbstractBasicCamera void AbstractBasicCamera::draw(BasicDrawableGroup& group) { - AbstractBasicObject* scene = AbstractBasicFeature::object()->scene(); + AbstractObject* scene = AbstractBasicFeature::object()->scene(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); /* Compute camera matrix */ AbstractBasicFeature::object()->setClean(); /* Compute transformations of all objects in the group relative to the camera */ - std::vector*> objects(group.size()); + std::vector*> objects(group.size()); for(std::size_t i = 0; i != group.size(); ++i) objects[i] = group[i]->object(); std::vector::MatrixType> transformations = diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 343b9b6bc..00e0ad57d 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -141,7 +141,7 @@ class TransformingFeature: public SceneGraph::AbstractFeature3D { }; @endcode If we take for example @ref Object "Object", it is -derived from @ref AbstractBasicObject "AbstractObject3D" and +derived from @ref AbstractObject "AbstractObject3D" and @ref BasicMatrixTransformation3D "MatrixTransformation3D", which is derived from @ref AbstractBasicTranslationRotationScaling3D "AbstractTranslationRotationScaling3D", which is derived from @ref AbstractBasicTranslationRotation3D "AbstractTranslationRotation3D", @@ -161,11 +161,11 @@ AbstractFeature.hpp implementation file to avoid linker errors. See also */ template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature #ifndef DOXYGEN_GENERATING_OUTPUT -: private Containers::LinkedListItem, AbstractBasicObject> +: private Containers::LinkedListItem, AbstractObject> #endif { friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractBasicObject>; + friend class Containers::LinkedListItem, AbstractObject>; template friend class Object; public: @@ -173,38 +173,38 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Constructor * @param object %Object holding this feature */ - explicit AbstractBasicFeature(AbstractBasicObject* object); + explicit AbstractBasicFeature(AbstractObject* object); virtual ~AbstractBasicFeature() = 0; /** @brief %Object holding this feature */ - AbstractBasicObject* object() { - return Containers::LinkedListItem, AbstractBasicObject>::list(); + AbstractObject* object() { + return Containers::LinkedListItem, AbstractObject>::list(); } /** @overload */ - const AbstractBasicObject* object() const { - return Containers::LinkedListItem, AbstractBasicObject>::list(); + const AbstractObject* object() const { + return Containers::LinkedListItem, AbstractObject>::list(); } /** @brief Previous feature or `nullptr`, if this is first feature */ AbstractBasicFeature* previousFeature() { - return Containers::LinkedListItem, AbstractBasicObject>::previous(); + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @overload */ const AbstractBasicFeature* previousFeature() const { - return Containers::LinkedListItem, AbstractBasicObject>::previous(); + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @brief Next feature or `nullptr`, if this is last feature */ AbstractBasicFeature* nextFeature() { - return Containers::LinkedListItem, AbstractBasicObject>::next(); + return Containers::LinkedListItem, AbstractObject>::next(); } /** @overload */ const AbstractBasicFeature* nextFeature() const { - return Containers::LinkedListItem, AbstractBasicObject>::next(); + return Containers::LinkedListItem, AbstractObject>::next(); } /** diff --git a/src/SceneGraph/AbstractFeature.hpp b/src/SceneGraph/AbstractFeature.hpp index 27210fa1f..837aee192 100644 --- a/src/SceneGraph/AbstractFeature.hpp +++ b/src/SceneGraph/AbstractFeature.hpp @@ -32,7 +32,7 @@ namespace Magnum { namespace SceneGraph { -template AbstractBasicFeature::AbstractBasicFeature(AbstractBasicObject* object) { +template AbstractBasicFeature::AbstractBasicFeature(AbstractObject* object) { object->Containers::template LinkedList>::insert(this); } diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index 2d5efe8c9..4b45f4ff5 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -78,7 +78,7 @@ template class AbstractBasicGrou * Adds the feature to the object and to group, if specified. * @see FeatureGroup::add() */ - explicit AbstractBasicGroupedFeature(AbstractBasicObject* object, BasicFeatureGroup* group = nullptr): AbstractBasicFeature(object), _group(nullptr) { + explicit AbstractBasicGroupedFeature(AbstractObject* object, BasicFeatureGroup* group = nullptr): AbstractBasicFeature(object), _group(nullptr) { if(group) group->add(static_cast(this)); } diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index ee1c5e9ab..080515e06 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicObject, alias Magnum::SceneGraph::AbstractObject2D, Magnum::SceneGraph::AbstractObject3D + * @brief Class Magnum::SceneGraph::AbstractObject, alias Magnum::SceneGraph::AbstractBasicObject2D, Magnum::SceneGraph::AbstractBasicObject3D, typedef Magnum::SceneGraph::AbstractObject2D, Magnum::SceneGraph::AbstractObject3D */ #include @@ -54,15 +54,16 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne } @endcode -@see @ref AbstractObject2D, @ref AbstractObject3D +@see @ref AbstractBasicObject2D, @ref AbstractBasicObject3D, + @ref AbstractObject2D, @ref AbstractObject3D */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicObject +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject #ifndef DOXYGEN_GENERATING_OUTPUT : private Containers::LinkedList> #endif { friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractBasicObject>; + friend class Containers::LinkedListItem, AbstractObject>; friend class AbstractBasicFeature; public: @@ -72,8 +73,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /** @brief Feature object type */ typedef AbstractBasicFeature FeatureType; - explicit AbstractBasicObject(); - virtual ~AbstractBasicObject(); + explicit AbstractObject(); + virtual ~AbstractObject(); /** @brief Whether this object has features */ bool hasFeatures() const { @@ -104,10 +105,10 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief %Scene * @return %Scene or `nullptr`, if the object is not part of any scene. */ - AbstractBasicObject* scene() { return doScene(); } + AbstractObject* scene() { return doScene(); } /** @overload */ - const AbstractBasicObject* scene() const { return doScene(); } + const AbstractObject* scene() const { return doScene(); } /** @{ @name Object transformation */ @@ -138,7 +139,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * Object type, use typesafe Object::transformationMatrices() when * possible. */ - std::vector transformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const { + std::vector transformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const { return doTransformationMatrices(objects, initialTransformationMatrix); } @@ -157,7 +158,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @warning This function cannot check if all objects are of the same * Object type, use typesafe Object::setClean() when possible. */ - static void setClean(const std::vector*>& objects) { + static void setClean(const std::vector*>& objects) { if(objects.empty()) return; objects.front()->doSetClean(objects); } @@ -203,32 +204,64 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /*@}*/ private: - virtual AbstractBasicObject* doScene() = 0; - virtual const AbstractBasicObject* doScene() const = 0; + virtual AbstractObject* doScene() = 0; + virtual const AbstractObject* doScene() const = 0; virtual MatrixType doTransformationMatrix() const = 0; virtual MatrixType doAbsoluteTransformationMatrix() const = 0; - virtual std::vector doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const = 0; + virtual std::vector doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const = 0; virtual bool doIsDirty() const = 0; virtual void doSetDirty() = 0; virtual void doSetClean() = 0; - virtual void doSetClean(const std::vector*>& objects) = 0; + virtual void doSetClean(const std::vector*>& objects) = 0; }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base object for two-dimensional scenes + +Convenience alternative to %AbstractObject<2, T>. See AbstractObject +for more information. +@note Not available on GCC < 4.7. Use %AbstractObject<2, T> instead. +@see @ref AbstractObject2D, @ref AbstractBasicObject3D +*/ +template using AbstractBasicObject2D = AbstractObject<2, T>; +#endif + /** @brief Base object for two-dimensional float scenes @see @ref AbstractObject3D */ -typedef AbstractBasicObject<2, Float> AbstractObject2D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicObject2D AbstractObject2D; +#else +typedef AbstractObject<2, Float> AbstractObject2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base object for three-dimensional scenes + +Convenience alternative to %AbstractObject<3, T>. See AbstractObject +for more information. +@note Not available on GCC < 4.7. Use %AbstractObject<3, T> instead. +@see AbstractObject2D +*/ +template using AbstractBasicObject3D = AbstractObject<3, T>; +#endif /** @brief Base object for three-dimensional float scenes @see @ref AbstractObject2D */ -typedef AbstractBasicObject<3, Float> AbstractObject3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicObject3D AbstractObject3D; +#else +typedef AbstractObject<3, Float> AbstractObject3D; +#endif }} diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 8d22714d7..1ebcdcdfa 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -154,7 +154,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * adds the feature to the object and also to group, if specified. * @see setDuration(), setState(), setRepeated(), BasicAnimableGroup::add() */ - explicit BasicAnimable(AbstractBasicObject* object, BasicAnimableGroup* group = nullptr); + explicit BasicAnimable(AbstractObject* object, BasicAnimableGroup* group = nullptr); ~BasicAnimable(); diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index b34101bea..061e4f836 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { -template BasicAnimable::BasicAnimable(AbstractBasicObject* object, BasicAnimableGroup* group): AbstractBasicGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} +template BasicAnimable::BasicAnimable(AbstractObject* object, BasicAnimableGroup* group): AbstractBasicGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} template BasicAnimable::~BasicAnimable() {} diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 02a935d1b..17dc1cf06 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -64,7 +64,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractB * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). * @see setProjection() */ - explicit BasicCamera2D(AbstractBasicObject<2, T>* object); + explicit BasicCamera2D(AbstractObject<2, T>* object); /** * @brief Set projection diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 7de9807fd..16926a89d 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -35,7 +35,7 @@ using namespace std; namespace Magnum { namespace SceneGraph { -template BasicCamera2D::BasicCamera2D(AbstractBasicObject<2, T>* object): AbstractBasicCamera<2, T>(object) {} +template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>* object): AbstractBasicCamera<2, T>(object) {} template BasicCamera2D* BasicCamera2D::setProjection(const Math::Vector2& size) { AbstractBasicCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 77cba35a2..66e66158c 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -66,7 +66,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractB * @brief Constructor * @param object %Object holding this feature */ - explicit BasicCamera3D(AbstractBasicObject<3, T>* object); + explicit BasicCamera3D(AbstractObject<3, T>* object); /** * @brief Set orthographic projection diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index 4cee4003b..81f15bfa0 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -33,7 +33,7 @@ namespace Magnum { namespace SceneGraph { -template BasicCamera3D::BasicCamera3D(AbstractBasicObject<3, T>* object): AbstractBasicCamera<3, T>(object), _near(T(0)), _far(T(0)) {} +template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>* object): AbstractBasicCamera<3, T>(object), _near(T(0)), _far(T(0)) {} template BasicCamera3D* BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index e5beac03f..ee9595e70 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -126,7 +126,7 @@ template class BasicDrawable: public AbstractBa * Adds the feature to the object and also to the group, if specified. * Otherwise you can use BasicDrawableGroup::add(). */ - explicit BasicDrawable(AbstractBasicObject* object, BasicDrawableGroup* drawables = nullptr): AbstractBasicGroupedFeature, T>(object, drawables) {} + explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractBasicGroupedFeature, T>(object, drawables) {} /** * @brief Draw the object using given camera diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 28de664cd..2698c5653 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -88,7 +88,7 @@ See @ref compilation-speedup-hpp for more information. @see Scene, AbstractFeature, AbstractTransformation, DebugTools::ObjectRenderer */ -template class MAGNUM_SCENEGRAPH_EXPORT Object: public AbstractBasicObject, public Transformation +template class MAGNUM_SCENEGRAPH_EXPORT Object: public AbstractObject, public Transformation #ifndef DOXYGEN_GENERATING_OUTPUT , private Containers::LinkedList>, private Containers::LinkedListItem, Object> #endif @@ -129,7 +129,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs * See @ref scenegraph-hierarchy for more information. */ - /** @copydoc AbstractBasicObject::scene() */ + /** @copydoc AbstractObject::scene() */ Scene* scene(); const Scene* scene() const; /**< @overload */ @@ -271,13 +271,13 @@ template class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs /* `objects` passed by copy intentionally (to avoid copy internally) */ static void setClean(std::vector*> objects); - /** @copydoc AbstractBasicObject::isDirty() */ + /** @copydoc AbstractObject::isDirty() */ bool isDirty() const { return !!(flags & Flag::Dirty); } - /** @copydoc AbstractBasicObject::setDirty() */ + /** @copydoc AbstractObject::setDirty() */ void setDirty(); - /** @copydoc AbstractBasicObject::setClean() */ + /** @copydoc AbstractObject::setClean() */ void setClean(); /*@}*/ @@ -298,14 +298,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs return absoluteTransformationMatrix(); } - std::vector doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const override final; + std::vector doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const override final; typename Transformation::DataType MAGNUM_SCENEGRAPH_LOCAL computeJointTransformation(const std::vector*>& jointObjects, std::vector& jointTransformations, const std::size_t joint, const typename Transformation::DataType& initialTransformation) const; bool MAGNUM_SCENEGRAPH_LOCAL doIsDirty() const override final { return isDirty(); } void MAGNUM_SCENEGRAPH_LOCAL doSetDirty() override final { setDirty(); } void MAGNUM_SCENEGRAPH_LOCAL doSetClean() override final { setClean(); } - void doSetClean(const std::vector*>& objects) override final; + void doSetClean(const std::vector*>& objects) override final; void MAGNUM_SCENEGRAPH_LOCAL setClean(const typename Transformation::DataType& absoluteTransformation); diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 1dd120ce5..0fa140ae6 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -38,8 +38,8 @@ namespace Magnum { namespace SceneGraph { -template AbstractBasicObject::AbstractBasicObject() {} -template AbstractBasicObject::~AbstractBasicObject() {} +template AbstractObject::AbstractObject() {} +template AbstractObject::~AbstractObject() {} template AbstractBasicTransformation::AbstractBasicTransformation() {} @@ -160,7 +160,7 @@ template void Object::setClean() { } } -template auto Object::doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const -> std::vector { +template auto Object::doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const -> std::vector { std::vector*> castObjects(objects.size()); for(std::size_t i = 0; i != objects.size(); ++i) /** @todo Ensure this doesn't crash, somehow */ @@ -322,7 +322,7 @@ template typename Transformation::DataType Object void Object::doSetClean(const std::vector*>& objects) { +template void Object::doSetClean(const std::vector*>& objects) { std::vector*> castObjects(objects.size()); for(std::size_t i = 0; i != objects.size(); ++i) /** @todo Ensure this doesn't crash, somehow */ diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 255b02640..4dfb0a194 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -58,9 +58,16 @@ template using AbstractGroupedFeature2D = AbstractBasicGroupedFea template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature<3, Derived, Float>; #endif -template class AbstractBasicObject; -typedef AbstractBasicObject<2, Float> AbstractObject2D; -typedef AbstractBasicObject<3, Float> AbstractObject3D; +template class AbstractObject; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using AbstractBasicObject2D = AbstractObject<2, T>; +template using AbstractBasicObject3D = AbstractObject<3, T>; +typedef AbstractBasicObject2D AbstractObject2D; +typedef AbstractBasicObject3D AbstractObject3D; +#else +typedef AbstractObject<2, Float> AbstractObject2D; +typedef AbstractObject<3, Float> AbstractObject3D; +#endif enum class TransformationType: UnsignedByte; diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index 4c731c268..ab056b10c 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -37,8 +37,8 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicObject<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicObject<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<3, Float>; diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index baff8f03f..0c969964f 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace Shapes { -template AbstractShape::AbstractShape(SceneGraph::AbstractBasicObject* object, ShapeGroup* group): SceneGraph::AbstractBasicGroupedFeature, Float>(object, group) { +template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractBasicGroupedFeature, Float>(object, group) { this->setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } diff --git a/src/Shapes/AbstractShape.h b/src/Shapes/AbstractShape.h index b980d9f60..b114ec23d 100644 --- a/src/Shapes/AbstractShape.h +++ b/src/Shapes/AbstractShape.h @@ -79,7 +79,7 @@ template class MAGNUM_SHAPES_EXPORT AbstractShape: publi * @param object Object holding this feature * @param group Group this shape belongs to */ - explicit AbstractShape(SceneGraph::AbstractBasicObject* object, ShapeGroup* group = nullptr); + explicit AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group = nullptr); /** * @brief Shape group containing this shape diff --git a/src/Shapes/Shape.h b/src/Shapes/Shape.h index 05cd10172..6dbf612f2 100644 --- a/src/Shapes/Shape.h +++ b/src/Shapes/Shape.h @@ -75,17 +75,17 @@ template class Shape: public AbstractShape { * @param shape Shape * @param group Group this shape belongs to */ - explicit Shape(SceneGraph::AbstractBasicObject* object, const T& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { + explicit Shape(SceneGraph::AbstractObject* object, const T& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { Implementation::ShapeHelper::set(*this, shape); } /** @overload */ - explicit Shape(SceneGraph::AbstractBasicObject* object, T&& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { + explicit Shape(SceneGraph::AbstractObject* object, T&& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { Implementation::ShapeHelper::set(*this, std::move(shape)); } /** @overload */ - explicit Shape(SceneGraph::AbstractBasicObject* object, ShapeGroup* group = nullptr): AbstractShape(object, group) {} + explicit Shape(SceneGraph::AbstractObject* object, ShapeGroup* group = nullptr): AbstractShape(object, group) {} /** @brief Shape */ const T& shape() const { return _shape.shape; } diff --git a/src/Shapes/ShapeGroup.cpp b/src/Shapes/ShapeGroup.cpp index 226e7d15d..7c28e30dc 100644 --- a/src/Shapes/ShapeGroup.cpp +++ b/src/Shapes/ShapeGroup.cpp @@ -31,11 +31,11 @@ namespace Magnum { namespace Shapes { template void ShapeGroup::setClean() { /* Clean all objects */ if(!this->isEmpty()) { - std::vector*> objects(this->size()); + std::vector*> objects(this->size()); for(std::size_t i = 0; i != this->size(); ++i) objects[i] = (*this)[i]->object(); - SceneGraph::AbstractBasicObject::setClean(objects); + SceneGraph::AbstractObject::setClean(objects); } dirty = false; From ab1d2f8f5f7e9f948453acbbbf4e5703019e591b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 17:03:53 +0200 Subject: [PATCH 24/90] Better usage of *Basic* in class names, part 2: SceneGraph animables. Use Animable and AnimableGroup like before and add two kinds of aliases instead of only one: BasicAnimable[Group]2D/BasicAnimable[Group]3D for abstract type and Animable[Group]2D/Animable[Group]3D for Float. Partially reverts commit c32c12b387cf644360ad3b2e9305076d16bacc16. --- src/SceneGraph/Animable.cpp | 8 +-- src/SceneGraph/Animable.h | 107 +++++++++++++++++++++------------ src/SceneGraph/Animable.hpp | 22 +++---- src/SceneGraph/AnimableGroup.h | 53 +++++++++++++--- src/SceneGraph/SceneGraph.h | 26 ++++++-- 5 files changed, 147 insertions(+), 69 deletions(-) diff --git a/src/SceneGraph/Animable.cpp b/src/SceneGraph/Animable.cpp index ad53b31fe..1087f8371 100644 --- a/src/SceneGraph/Animable.cpp +++ b/src/SceneGraph/Animable.cpp @@ -27,10 +27,10 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimable<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimable<3, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimableGroup<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimableGroup<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT Animable<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT Animable<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup<3, Float>; #endif Debug operator<<(Debug debug, AnimationState value) { diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 1ebcdcdfa..daa1870ca 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::BasicAnimable, typedef Magnum::SceneGraph::Animable2D, Magnum::SceneGraph::Animable3D, enum Magnum::SceneGraph::AnimationState + * @brief Class Magnum::SceneGraph::Animable, alias Magnum::SceneGraph::BasicAnimable2D, Magnum::SceneGraph::BasicAnimable3D, typedef Magnum::SceneGraph::Animable2D, Magnum::SceneGraph::Animable3D, enum Magnum::SceneGraph::AnimationState */ #include "AbstractGroupedFeature.h" @@ -37,7 +37,7 @@ namespace Magnum { namespace SceneGraph { /** @brief Animation state -@see BasicAnimable::setState() +@see Animable::setState() */ enum class AnimationState: UnsignedByte { /** @@ -56,7 +56,7 @@ enum class AnimationState: UnsignedByte { Running }; -/** @debugoperator{Magnum::SceneGraph::BasicAnimable} */ +/** @debugoperator{Magnum::SceneGraph::Animable} */ Debug MAGNUM_SCENEGRAPH_EXPORT operator<<(Debug debug, AnimationState value); /** @@ -90,10 +90,9 @@ class AnimableObject: public Object3D, SceneGraph::Animable3D { @endcode Then add the object to your scene and some animation group. You can also use -BasicAnimableGroup::add() and BasicAnimableGroup::remove() instead of passing -the group in the constructor. The animation is initially in stopped state and -without repeat, see setState(), setRepeated() and setRepeatCount() for more -information. +AnimableGroup::add() and AnimableGroup::remove() instead of passing the group +in the constructor. The animation is initially in stopped state and without +repeat, see setState(), setRepeated() and setRepeatCount() for more information. @code Scene3D scene; SceneGraph::AnimableGroup3D animables; @@ -103,10 +102,10 @@ SceneGraph::AnimableGroup3D animables; // ... @endcode -Animation step is performed by calling BasicAnimableGroup::step() in your draw -event implementation. The function expects absolute time from relative to some -fixed point in the past and time delta (i.e. duration of the frame). You can -use Timeline for that, see its documentation for more information. +Animation step is performed by calling AnimableGroup::step() in your draw event +implementation. The function expects absolute time from relative to some fixed +point in the past and time delta (i.e. duration of the frame). You can use +Timeline for that, see its documentation for more information. @code Timeline timeline; timeline.start(); @@ -122,11 +121,11 @@ void MyApplication::drawEvent() { @section Animable-performance Using animable groups to improve performance -Animable group is optimized for case when no animation is running - it just +AnimableGroup is optimized for case when no animation is running - it just puts itself to rest and waits until some animation changes its state to @ref AnimationState "AnimationState::Running" again. If you put animations which are not pernamently running to separate group, they will not be always -traversed when calling BasicAnimableGroup::step(), saving precious frame time. +traversed when calling AnimableGroup::step(), saving precious frame time. @section Animable-explicit-specializations Explicit template specializations @@ -135,14 +134,14 @@ For other specializations (e.g. using Double type) you have to use Animable.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref BasicAnimable "BasicAnimable<2, Float>", @ref BasicAnimableGroup "BasicAnimableGroup<2, Float>" - - @ref BasicAnimable "BasicAnimable<3, Float>", @ref BasicAnimableGroup "BasicAnimableGroup<3, Float>" + - @ref Animable "Animable<2, Float>", @ref AnimableGroup "AnimableGroup<2, Float>" + - @ref Animable "Animable<3, Float>", @ref AnimableGroup "AnimableGroup<3, Float>" -@see @ref Animable2D, @ref Animable3D, @ref scenegraph, @ref AnimableGroup2D, - @ref AnimableGroup3D +@see @ref scenegraph, @ref BasicAnimable2D, @ref BasicAnimable3D, + @ref Animable2D, @ref Animable3D */ -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimable: public AbstractBasicGroupedFeature, T> { - friend class BasicAnimableGroup; +template class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractBasicGroupedFeature, T> { + friend class AnimableGroup; public: /** @@ -152,11 +151,11 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * * Creates stopped non-repeating animation with infinite duration, * adds the feature to the object and also to group, if specified. - * @see setDuration(), setState(), setRepeated(), BasicAnimableGroup::add() + * @see setDuration(), setState(), setRepeated(), AnimableGroup::add() */ - explicit BasicAnimable(AbstractObject* object, BasicAnimableGroup* group = nullptr); + explicit Animable(AbstractObject* object, AnimableGroup* group = nullptr); - ~BasicAnimable(); + ~Animable(); /** @brief Animation duration */ Float duration() const { return _duration; } @@ -175,7 +174,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * @see animationStarted(), animationPaused(), animationResumed(), * animationStopped() */ - BasicAnimable* setState(AnimationState state); + Animable* setState(AnimationState state); /** * @brief Whether the animation is repeated @@ -191,7 +190,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * Default is `false`. * @see setRepeatCount() */ - BasicAnimable* setRepeated(bool repeated) { + Animable* setRepeated(bool repeated) { _repeated = repeated; return this; } @@ -211,7 +210,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * infinitely repeated animation. Default is `0`. * @see setRepeated() */ - BasicAnimable* setRepeatCount(UnsignedShort count) { + Animable* setRepeatCount(UnsignedShort count) { _repeatCount = count; return this; } @@ -221,8 +220,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * * If the animable doesn't belong to any group, returns `nullptr`. */ - BasicAnimableGroup* group(); - const BasicAnimableGroup* group() const; /**< @overload */ + AnimableGroup* group(); + const AnimableGroup* group() const; /**< @overload */ protected: /** @@ -233,7 +232,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * infinite non-repeating animation. Default is `0.0f`. */ /* Protected so only animation implementer can change it */ - BasicAnimable* setDuration(Float duration) { + Animable* setDuration(Float duration) { _duration = duration; return this; } @@ -243,8 +242,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn * @param time Time from start of the animation * @param delta Time delta for current frame * - * This function is periodically called from BasicAnimableGroup::step() - * if the animation state is set to @ref AnimationState "AnimationState::Running". + * This function is periodically called from AnimableGroup::step() if + * the animation state is set to @ref AnimationState "AnimationState::Running". * After animation duration is exceeded and repeat is not enabled or * repeat count is exceeded, the animation state is set to * @ref AnimationState "AnimationState::Stopped". @@ -262,7 +261,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn /** * @brief Action on animation start * - * Called from BasicAnimableGroup::step() when state is changed from + * Called from AnimableGroup::step() when state is changed from * @ref AnimationState "AnimationState::Stopped" to * @ref AnimationState "AnimationState::Running" and before first * animationStep() is called. @@ -276,7 +275,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn /** * @brief Action on animation pause * - * Called from BasicAnimableGroup::step() when state changes from + * Called from AnimableGroup::step() when state changes from * @ref AnimationState "AnimationState::Running" to * @ref AnimationState "AnimationState::Paused" and after last * animationStep() is called. @@ -290,7 +289,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn /** * @brief Action on animation resume * - * Called from BasicAnimableGroup::step() when state changes from + * Called from AnimableGroup::step() when state changes from * @ref AnimationState "AnimationState::Paused" to * @ref AnimationState "AnimationState::Running" and before first * animationStep() is called. @@ -304,7 +303,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn /** * @brief Action on animation stop * - * Called from BasicAnimableGroup::step() when state changes from either + * Called from AnimableGroup::step() when state changes from either * @ref AnimationState "AnimationState::Running" or * @ref AnimationState "AnimationState::Paused" to * @ref AnimationState "AnimationState::Stopped" and after last @@ -328,19 +327,51 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn UnsignedShort repeats; }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief %Animable for two-dimensional scenes + +Convenience alternative to %Animable<2, T>. See Animable for more +information. +@note Not available on GCC < 4.7. Use %Animable<2, T> instead. +@see @ref Animable2D, @ref BasicAnimable3D +*/ +template using BasicAnimable2D = Animable<2, T>; +#endif + /** -@brief Animable for two-dimensional float scenes +@brief %Animable for two-dimensional float scenes @see @ref Animable3D */ -typedef BasicAnimable<2, Float> Animable2D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicAnimable2D Animable2D; +#else +typedef Animable<2, Float> Animable2D; +#endif +#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Animable for three-dimensional float scenes +@brief %Animable for three-dimensional scenes + +Convenience alternative to %Animable<3, T>. See Animable for more +information. +@note Not available on GCC < 4.7. Use %Animable<3, T> instead. +@see @ref Animable3D, @ref BasicAnimable2D +*/ +template using BasicAnimable3D = Animable<3, T>; +#endif + +/** +@brief %Animable for three-dimensional float scenes @see @ref Animable2D */ -typedef BasicAnimable<3, Float> Animable3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicAnimable3D Animable3D; +#else +typedef Animable<3, Float> Animable3D; +#endif }} diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 061e4f836..8e5cf3bdf 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -35,11 +35,11 @@ namespace Magnum { namespace SceneGraph { -template BasicAnimable::BasicAnimable(AbstractObject* object, BasicAnimableGroup* group): AbstractBasicGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} +template Animable::Animable(AbstractObject* object, AnimableGroup* group): AbstractBasicGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} -template BasicAnimable::~BasicAnimable() {} +template Animable::~Animable() {} -template BasicAnimable* BasicAnimable::setState(AnimationState state) { +template Animable* Animable::setState(AnimationState state) { if(currentState == state) return this; /* Not allowed (for sanity) */ @@ -52,20 +52,20 @@ template BasicAnimable* BasicAni return this; } -template BasicAnimableGroup* BasicAnimable::group() { - return static_cast*>(AbstractBasicGroupedFeature, T>::group()); +template AnimableGroup* Animable::group() { + return static_cast*>(AbstractBasicGroupedFeature, T>::group()); } -template const BasicAnimableGroup* BasicAnimable::group() const { - return static_cast*>(AbstractBasicGroupedFeature, T>::group()); +template const AnimableGroup* Animable::group() const { + return static_cast*>(AbstractBasicGroupedFeature, T>::group()); } -template void BasicAnimableGroup::step(const Float time, const Float delta) { +template void AnimableGroup::step(const Float time, const Float delta) { if(!_runningCount && !wakeUp) return; wakeUp = false; for(std::size_t i = 0; i != this->size(); ++i) { - BasicAnimable* animable = (*this)[i]; + Animable* animable = (*this)[i]; /* The animation was stopped recently, just decrease count of running animations if the animation was running before */ @@ -126,9 +126,9 @@ template void BasicAnimableGroup /* Animation is still running, perform animation step */ CORRADE_ASSERT(time-animable->startTime >= 0.0f, - "SceneGraph::BasicAnimableGroup::step(): animation was started in future - probably wrong time passed", ); + "SceneGraph::AnimableGroup::step(): animation was started in future - probably wrong time passed", ); CORRADE_ASSERT(delta >= 0.0f, - "SceneGraph::BasicAnimableGroup::step(): negative delta passed", ); + "SceneGraph::AnimableGroup::step(): negative delta passed", ); animable->animationStep(time - animable->startTime, delta); } diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index 835ee4769..cbf47af49 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::BasicAnimableGroup, typedef Magnum::SceneGraph::AnimableGroup2D, Magnum::SceneGraph::AnimableGroup3D + * @brief Class Magnum::SceneGraph::AnimableGroup, alias Magnum::SceneGraph::BasicAnimableGroup2D, Magnum::SceneGraph::BasicAnimableGroup3D, typedef Magnum::SceneGraph::AnimableGroup2D, Magnum::SceneGraph::AnimableGroup3D */ #include "FeatureGroup.h" @@ -37,17 +37,18 @@ namespace Magnum { namespace SceneGraph { /** @brief Group of animables -See BasicAnimable for more information. -@see @ref AnimableGroup2D, @ref AnimableGroup3D, @ref scenegraph +See Animable for more information. +@see @ref scenegraph, @ref BasicAnimableGroup2D, @ref BasicAnimableGroup3D, + @ref AnimableGroup2D, @ref AnimableGroup3D */ -template class MAGNUM_SCENEGRAPH_EXPORT BasicAnimableGroup: public BasicFeatureGroup, T> { - friend class BasicAnimable; +template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public BasicFeatureGroup, T> { + friend class Animable; public: /** * @brief Constructor */ - explicit BasicAnimableGroup(): _runningCount(0), wakeUp(false) {} + explicit AnimableGroup(): _runningCount(0), wakeUp(false) {} /** * @brief Count of running animations @@ -71,19 +72,51 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicAn bool wakeUp; }; +#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Animable group for two-dimensional float scenes +@brief %Animable group for two-dimensional scenes + +Convenience alternative to %AnimableGroup<2, T>. See Animable for +more information. +@note Not available on GCC < 4.7. Use %AnimableGroup<2, T> instead. +@see @ref AnimableGroup2D, @ref BasicAnimableGroup3D +*/ +template using BasicAnimableGroup2D = AnimableGroup<2, T>; +#endif + +/** +@brief %Animable group for two-dimensional float scenes @see @ref AnimableGroup3D */ -typedef BasicAnimableGroup<2, Float> AnimableGroup2D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicAnimableGroup2D AnimableGroup2D; +#else +typedef AnimableGroup<2, Float> AnimableGroup2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief %Animable group for three-dimensional scenes + +Convenience alternative to %AnimableGroup<3, T>. See Animable for +more information. +@note Not available on GCC < 4.7. Use %AnimableGroup<3, T> instead. +@see @ref AnimableGroup3D, @ref BasicAnimableGroup2D +*/ +template using BasicAnimableGroup3D = AnimableGroup<3, T>; +#endif /** -@brief Animable group for three-dimensional float scenes +@brief %Animable group for three-dimensional float scenes @see @ref AnimableGroup2D */ -typedef BasicAnimableGroup<3, Float> AnimableGroup3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicAnimableGroup3D AnimableGroup3D; +#else +typedef AnimableGroup<3, Float> AnimableGroup3D; +#endif }} diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 4dfb0a194..d5577b3a6 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -85,15 +85,29 @@ template class AbstractBasicTranslationRotationScaling3D; typedef AbstractBasicTranslationRotationScaling2D AbstractTranslationRotationScaling2D; typedef AbstractBasicTranslationRotationScaling3D AbstractTranslationRotationScaling3D; -template class BasicAnimable; -typedef BasicAnimable<2, Float> Animable2D; -typedef BasicAnimable<3, Float> Animable3D; +template class Animable; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using BasicAnimable2D = Animable<2, T>; +template using BasicAnimable3D = Animable<3, T>; +typedef BasicAnimable2D Animable2D; +typedef BasicAnimable3D Animable3D; +#else +typedef Animable<2, Float> Animable2D; +typedef Animable<3, Float> Animable3D; +#endif enum class AnimationState: UnsignedByte; -template class BasicAnimableGroup; -typedef BasicAnimableGroup<2, Float> AnimableGroup2D; -typedef BasicAnimableGroup<3, Float> AnimableGroup3D; +template class AnimableGroup; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using BasicAnimableGroup2D = AnimableGroup<2, T>; +template using BasicAnimableGroup3D = AnimableGroup<3, T>; +typedef BasicAnimableGroup2D AnimableGroup2D; +typedef BasicAnimableGroup3D AnimableGroup3D; +#else +typedef AnimableGroup<2, Float> AnimableGroup2D; +typedef AnimableGroup<3, Float> AnimableGroup3D; +#endif template class BasicCamera2D; template class BasicCamera3D; From 43feadfed6621978113e53013d33def57f2d282a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 17:58:34 +0200 Subject: [PATCH 25/90] Better usage of *Basic* in class names, part 3: SceneGraph features. Use AbstractFeature, AbstractGroupedFeature<...>, AbstractFeatureGroup<...>, FeatureGroup<...> like before and add two kinds of aliases instead of only one, one with *Basic* for abstract type and one for Float type. Partially reverts commit 572efce3f7cd413addcf67967a88263f7d235830. --- src/SceneGraph/AbstractCamera.h | 4 +- src/SceneGraph/AbstractCamera.hpp | 8 +-- src/SceneGraph/AbstractFeature.h | 89 +++++++++++++++++-------- src/SceneGraph/AbstractFeature.hpp | 12 ++-- src/SceneGraph/AbstractGroupedFeature.h | 68 +++++++++++++------ src/SceneGraph/AbstractObject.h | 20 +++--- src/SceneGraph/Animable.h | 4 +- src/SceneGraph/Animable.hpp | 6 +- src/SceneGraph/AnimableGroup.h | 2 +- src/SceneGraph/Drawable.h | 8 +-- src/SceneGraph/FeatureGroup.h | 87 +++++++++++++++--------- src/SceneGraph/FeatureGroup.hpp | 8 +-- src/SceneGraph/Object.hpp | 4 +- src/SceneGraph/SceneGraph.h | 35 ++++++---- src/SceneGraph/instantiation.cpp | 8 +-- src/Shapes/AbstractShape.cpp | 6 +- src/Shapes/AbstractShape.h | 2 +- src/Shapes/ShapeGroup.h | 2 +- 18 files changed, 232 insertions(+), 141 deletions(-) diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 52dc8b497..e7e71fb25 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -72,7 +72,7 @@ relevant sections in @see AbstractCamera2D, AbstractCamera3D, @ref scenegraph, Drawable, DrawableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicCamera: public AbstractBasicFeature { +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicCamera: public AbstractFeature { public: /** * @brief Constructor @@ -98,7 +98,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * applied as first. */ typename DimensionTraits::MatrixType cameraMatrix() { - AbstractBasicFeature::object()->setClean(); + AbstractFeature::object()->setClean(); return _cameraMatrix; } diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 15f7d3fad..91d7ed59a 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -70,8 +70,8 @@ template typename DimensionTraits AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractBasicFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { - AbstractBasicFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); +template AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { + AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } template AbstractBasicCamera::~AbstractBasicCamera() {} @@ -88,11 +88,11 @@ template void AbstractBasicCamera void AbstractBasicCamera::draw(BasicDrawableGroup& group) { - AbstractObject* scene = AbstractBasicFeature::object()->scene(); + AbstractObject* scene = AbstractFeature::object()->scene(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); /* Compute camera matrix */ - AbstractBasicFeature::object()->setClean(); + AbstractFeature::object()->setClean(); /* Compute transformations of all objects in the group relative to the camera */ std::vector*> objects(group.size()); diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 00e0ad57d..de9c71892 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicFeature, typedef Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations + * @brief Class Magnum::SceneGraph::AbstractFeature, alias Magnum::SceneGraph::BasicAbstractFeature2D, Magnum::SceneGraph::BasicAbstractFeature3D, typedef Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations */ #include @@ -40,8 +40,8 @@ namespace Magnum { namespace SceneGraph { @brief Which transformation to cache in given feature @see @ref scenegraph-caching, CachedTransformations, - AbstractBasicFeature::setCachedTransformations(), AbstractBasicFeature::clean(), - AbstractBasicFeature::cleanInverted() + AbstractFeature::setCachedTransformations(), AbstractFeature::clean(), + AbstractFeature::cleanInverted() @todo Provide also simpler representations from which could benefit other transformation implementations, as they won't need to e.g. create transformation matrix from quaternion? @@ -65,8 +65,8 @@ enum class CachedTransformation: UnsignedByte { /** @brief Which transformations to cache in this feature -@see @ref scenegraph-caching, AbstractBasicFeature::setCachedTransformations(), - AbstractBasicFeature::clean(), AbstractBasicFeature::cleanInverted() +@see @ref scenegraph-caching, AbstractFeature::setCachedTransformations(), + AbstractFeature::clean(), AbstractFeature::cleanInverted() */ typedef Containers::EnumSet CachedTransformations; @@ -154,18 +154,19 @@ For other specializations (e.g. using Double type) you have to use AbstractFeature.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref AbstractBasicFeature "AbstractBasicFeature<2, Float>" - - @ref AbstractBasicFeature "AbstractBasicFeature<3, Float>" + - @ref AbstractFeature "AbstractFeature<2, Float>" + - @ref AbstractFeature "AbstractFeature<3, Float>" -@see @ref AbstractFeature2D, @ref AbstractFeature3D +@see @ref AbstractBasicFeature2D, @ref AbstractBasicFeature3D, + @ref AbstractFeature2D, @ref AbstractFeature3D */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature -#ifndef DOXYGEN_GENERATING_OUTPUT -: private Containers::LinkedListItem, AbstractObject> -#endif +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature + #ifndef DOXYGEN_GENERATING_OUTPUT + : private Containers::LinkedListItem, AbstractObject> + #endif { - friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractObject>; + friend class Containers::LinkedList>; + friend class Containers::LinkedListItem, AbstractObject>; template friend class Object; public: @@ -173,38 +174,38 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Constructor * @param object %Object holding this feature */ - explicit AbstractBasicFeature(AbstractObject* object); + explicit AbstractFeature(AbstractObject* object); - virtual ~AbstractBasicFeature() = 0; + virtual ~AbstractFeature() = 0; /** @brief %Object holding this feature */ AbstractObject* object() { - return Containers::LinkedListItem, AbstractObject>::list(); + return Containers::LinkedListItem, AbstractObject>::list(); } /** @overload */ const AbstractObject* object() const { - return Containers::LinkedListItem, AbstractObject>::list(); + return Containers::LinkedListItem, AbstractObject>::list(); } /** @brief Previous feature or `nullptr`, if this is first feature */ - AbstractBasicFeature* previousFeature() { - return Containers::LinkedListItem, AbstractObject>::previous(); + AbstractFeature* previousFeature() { + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @overload */ - const AbstractBasicFeature* previousFeature() const { - return Containers::LinkedListItem, AbstractObject>::previous(); + const AbstractFeature* previousFeature() const { + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @brief Next feature or `nullptr`, if this is last feature */ - AbstractBasicFeature* nextFeature() { - return Containers::LinkedListItem, AbstractObject>::next(); + AbstractFeature* nextFeature() { + return Containers::LinkedListItem, AbstractObject>::next(); } /** @overload */ - const AbstractBasicFeature* nextFeature() const { - return Containers::LinkedListItem, AbstractObject>::next(); + const AbstractFeature* nextFeature() const { + return Containers::LinkedListItem, AbstractObject>::next(); } /** @@ -282,19 +283,51 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac CachedTransformations _cachedTransformations; }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base feature for two-dimensional scenes + +Convenience alternative to %AbstractFeature<2, T>. See AbstractFeature +for more information. +@note Not available on GCC < 4.7. Use %AbstractFeature<2, T> instead. +@see @ref AbstractFeature2D, @ref AbstractBasicFeature3D +*/ +template using AbstractBasicFeature2D = AbstractFeature<2, T>; +#endif + /** @brief Base feature for two-dimensional float scenes @see @ref AbstractFeature3D */ -typedef AbstractBasicFeature<2, Float> AbstractFeature2D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicFeature2D AbstractFeature2D; +#else +typedef AbstractFeature<2, Float> AbstractFeature2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base feature for three-dimensional scenes + +Convenience alternative to %AbstractFeature<3, T>. See AbstractFeature +for more information. +@note Not available on GCC < 4.7. Use %AbstractFeature<3, T> instead. +@see AbstractFeature2D +*/ +template using AbstractBasicFeature3D = AbstractFeature<3, T>; +#endif /** @brief Base feature for three-dimensional float scenes @see @ref AbstractFeature2D */ -typedef AbstractBasicFeature<3, Float> AbstractFeature3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicFeature3D AbstractFeature3D; +#else +typedef AbstractFeature<3, Float> AbstractFeature3D; +#endif }} diff --git a/src/SceneGraph/AbstractFeature.hpp b/src/SceneGraph/AbstractFeature.hpp index 837aee192..f0da6915e 100644 --- a/src/SceneGraph/AbstractFeature.hpp +++ b/src/SceneGraph/AbstractFeature.hpp @@ -32,17 +32,17 @@ namespace Magnum { namespace SceneGraph { -template AbstractBasicFeature::AbstractBasicFeature(AbstractObject* object) { - object->Containers::template LinkedList>::insert(this); +template AbstractFeature::AbstractFeature(AbstractObject* object) { + object->Containers::template LinkedList>::insert(this); } -template AbstractBasicFeature::~AbstractBasicFeature() = default; +template AbstractFeature::~AbstractFeature() = default; -template void AbstractBasicFeature::markDirty() {} +template void AbstractFeature::markDirty() {} -template void AbstractBasicFeature::clean(const typename DimensionTraits::MatrixType&) {} +template void AbstractFeature::clean(const typename DimensionTraits::MatrixType&) {} -template void AbstractBasicFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} +template void AbstractFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} }} diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index 4b45f4ff5..dd589c8b2 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicGroupedFeature, alias Magnum::SceneGraph::AbstractGroupedFeature2D, Magnum::SceneGraph::AbstractGroupedFeature3D + * @brief Class Magnum::SceneGraph::AbstractGroupedFeature, alias Magnum::SceneGraph::AbstractBasicGroupedFeature2D, Magnum::SceneGraph::AbstractBasicGroupedFeature3D, Magnum::SceneGraph::AbstractGroupedFeature2D, Magnum::SceneGraph::AbstractGroupedFeature3D */ #include @@ -38,12 +38,12 @@ namespace Magnum { namespace SceneGraph { /** @brief Base for grouped features -Used together with BasicFeatureGroup. +Used together with FeatureGroup. @section AbstractGroupedFeature-subclassing Subclassing Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) -and typedef'ing BasicFeatureGroup to accept only given type, e.g.: +and typedef'ing FeatureGroup to accept only given type, e.g.: @code class Drawable: public SceneGraph::AbstractGroupedFeature3D { // ... @@ -59,15 +59,15 @@ For other specializations (e.g. using Double type) you have to use AbstractGroupedFeature.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref AbstractBasicFeatureGroup "AbstractBasicFeatureGroup<2, Float>" - - @ref AbstractBasicFeatureGroup "AbstractBasicFeatureGroup<3, Float>" + - @ref AbstractFeatureGroup "AbstractFeatureGroup<2, Float>" + - @ref AbstractFeatureGroup "AbstractFeatureGroup<3, Float>" -@see @ref AbstractGroupedFeature2D, @ref AbstractGroupedFeature3D, - @ref scenegraph, @ref BasicFeatureGroup, @ref FeatureGroup2D, - @ref FeatureGroup3D +@see @ref scenegraph, @ref AbstractBasicGroupedFeature2D, + @ref AbstractBasicGroupedFeature3D, @ref AbstractGroupedFeature2D, + @ref AbstractGroupedFeature3D, @ref FeatureGroup */ -template class AbstractBasicGroupedFeature: public AbstractBasicFeature { - friend class BasicFeatureGroup; +template class AbstractGroupedFeature: public AbstractFeature { + friend class FeatureGroup; public: /** @@ -78,7 +78,7 @@ template class AbstractBasicGrou * Adds the feature to the object and to group, if specified. * @see FeatureGroup::add() */ - explicit AbstractBasicGroupedFeature(AbstractObject* object, BasicFeatureGroup* group = nullptr): AbstractBasicFeature(object), _group(nullptr) { + explicit AbstractGroupedFeature(AbstractObject* object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { if(group) group->add(static_cast(this)); } @@ -88,44 +88,68 @@ template class AbstractBasicGrou * Removes the feature from object and from group, if it belongs to * any. */ - ~AbstractBasicGroupedFeature() { + ~AbstractGroupedFeature() { if(_group) _group->remove(static_cast(this)); } /** @brief Group this feature belongs to */ - BasicFeatureGroup* group() { + FeatureGroup* group() { return _group; } /** @overload */ - const BasicFeatureGroup* group() const { + const FeatureGroup* group() const { return _group; } private: - BasicFeatureGroup* _group; + FeatureGroup* _group; }; #ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base grouped feature for two-dimensional scenes + +Convenience alternative to %AbstractGroupedFeature<2, Derived, T>. See +AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<2, Derived, T> + instead. +@see @ref AbstractGroupedFeature2D, @ref AbstractBasicGroupedFeature3D +*/ +template using AbstractBasicGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; + /** @brief Base grouped feature for two-dimensional float scenes -Convenience alternative to %AbstractBasicGroupedFeature<2, Derived, Float>. -@note Not available on GCC < 4.7. Use %AbstractBasicGroupedFeature<2, Derived, Float> +Convenience alternative to %AbstractBasicGroupedFeature2D. +See AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<2, Derived, Float> instead. @see @ref AbstractGroupedFeature3D */ -template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature<2, Derived, Float>; +template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature2D; + +/** +@brief Base grouped feature for three-dimensional scenes + +Convenience alternative to %AbstractGroupedFeature<3, Derived, T>. See +AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<3, Derived, T> + instead. +@see @ref AbstractGroupedFeature3D, @ref AbstractBasicGroupedFeature2D +*/ +template using AbstractBasicGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; /** -@brief Base for three-dimensional grouped features +@brief Base grouped feature for three-dimensional float scenes -Convenience alternative to %AbstractBasicGroupedFeature<3, Derived, Float>. -@note Not available on GCC < 4.7. Use %AbstractBasicGroupedFeature<3, Derived, Float> +Convenience alternative to %AbstractBasicGroupedFeature3D. +See AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<3, Derived, Float> instead. @see @ref AbstractGroupedFeature2D */ -template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature<3, Derived, Float>; +template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature3D; #endif }} diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 080515e06..0c5398707 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -59,46 +59,46 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne */ template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject #ifndef DOXYGEN_GENERATING_OUTPUT - : private Containers::LinkedList> + : private Containers::LinkedList> #endif { - friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractObject>; - friend class AbstractBasicFeature; + friend class Containers::LinkedList>; + friend class Containers::LinkedListItem, AbstractObject>; + friend class AbstractFeature; public: /** @brief Matrix type */ typedef typename DimensionTraits::MatrixType MatrixType; /** @brief Feature object type */ - typedef AbstractBasicFeature FeatureType; + typedef AbstractFeature FeatureType; explicit AbstractObject(); virtual ~AbstractObject(); /** @brief Whether this object has features */ bool hasFeatures() const { - return !Containers::LinkedList>::isEmpty(); + return !Containers::LinkedList>::isEmpty(); } /** @brief First object feature or `nullptr`, if this object has no features */ FeatureType* firstFeature() { - return Containers::LinkedList>::first(); + return Containers::LinkedList>::first(); } /** @overload */ const FeatureType* firstFeature() const { - return Containers::LinkedList>::first(); + return Containers::LinkedList>::first(); } /** @brief Last object feature or `nullptr`, if this object has no features */ FeatureType* lastFeature() { - return Containers::LinkedList>::last(); + return Containers::LinkedList>::last(); } /** @overload */ const FeatureType* lastFeature() const { - return Containers::LinkedList>::last(); + return Containers::LinkedList>::last(); } /** diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index daa1870ca..3f7ca174b 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -138,9 +138,9 @@ Animable.hpp implementation file to avoid linker errors. See also - @ref Animable "Animable<3, Float>", @ref AnimableGroup "AnimableGroup<3, Float>" @see @ref scenegraph, @ref BasicAnimable2D, @ref BasicAnimable3D, - @ref Animable2D, @ref Animable3D + @ref Animable2D, @ref Animable3D, @ref AnimableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractBasicGroupedFeature, T> { +template class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature, T> { friend class AnimableGroup; public: diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 8e5cf3bdf..598959bac 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { -template Animable::Animable(AbstractObject* object, AnimableGroup* group): AbstractBasicGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} +template Animable::Animable(AbstractObject* object, AnimableGroup* group): AbstractGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} template Animable::~Animable() {} @@ -53,11 +53,11 @@ template Animable* Animable AnimableGroup* Animable::group() { - return static_cast*>(AbstractBasicGroupedFeature, T>::group()); + return static_cast*>(AbstractGroupedFeature, T>::group()); } template const AnimableGroup* Animable::group() const { - return static_cast*>(AbstractBasicGroupedFeature, T>::group()); + return static_cast*>(AbstractGroupedFeature, T>::group()); } template void AnimableGroup::step(const Float time, const Float delta) { diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index cbf47af49..39af7a1e6 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -41,7 +41,7 @@ See Animable for more information. @see @ref scenegraph, @ref BasicAnimableGroup2D, @ref BasicAnimableGroup3D, @ref AnimableGroup2D, @ref AnimableGroup3D */ -template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public BasicFeatureGroup, T> { +template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup, T> { friend class Animable; public: diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index ee9595e70..c67a22bae 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -116,7 +116,7 @@ void MyApplication::drawEvent() { @see Drawable2D, Drawable3D, @ref scenegraph, DrawableGroup2D, DrawableGroup3D */ -template class BasicDrawable: public AbstractBasicGroupedFeature, T> { +template class BasicDrawable: public AbstractGroupedFeature, T> { public: /** * @brief Constructor @@ -126,7 +126,7 @@ template class BasicDrawable: public AbstractBa * Adds the feature to the object and also to the group, if specified. * Otherwise you can use BasicDrawableGroup::add(). */ - explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractBasicGroupedFeature, T>(object, drawables) {} + explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} /** * @brief Draw the object using given camera @@ -160,9 +160,9 @@ See Drawable for more information. @see @ref scenegraph, DrawableGroup2D, DrawableGroup3D */ #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicDrawableGroup = BasicFeatureGroup, T>; +template using BasicDrawableGroup = FeatureGroup, T>; #else -template class BasicDrawableGroup: public BasicFeatureGroup, T> {}; +template class BasicDrawableGroup: public FeatureGroup, T> {}; #endif /** diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index c07825b0a..19cf67412 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicFeatureGroup, Magnum::SceneGraph::BasicFeatureGroup, alias Magnum::SceneGraph::FeatureGroup2D, Magnum::SceneGraph::FeatureGroup3D + * @brief Class Magnum::SceneGraph::AbstractFeatureGroup, Magnum::SceneGraph::FeatureGroup, alias Magnum::SceneGraph::BasicFeatureGroup2D, Magnum::SceneGraph::BasicFeatureGroup3D, Magnum::SceneGraph::FeatureGroup2D, Magnum::SceneGraph::FeatureGroup3D */ #include @@ -39,38 +39,39 @@ namespace Magnum { namespace SceneGraph { /** @brief Base for group of features -See BasicFeatureGroup. +See FeatureGroup. */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeatureGroup { - template friend class BasicFeatureGroup; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup { + template friend class FeatureGroup; - explicit AbstractBasicFeatureGroup(); - virtual ~AbstractBasicFeatureGroup(); + explicit AbstractFeatureGroup(); + virtual ~AbstractFeatureGroup(); - void add(AbstractBasicFeature* feature); - void remove(AbstractBasicFeature* feature); + void add(AbstractFeature* feature); + void remove(AbstractFeature* feature); - std::vector*> features; + std::vector*> features; }; /** @brief Group of features -See AbstractBasicGroupedFeature for more information. -@see @ref FeatureGroup2D, @ref FeatureGroup3D, @ref scenegraph +See AbstractGroupedFeature for more information. +@see @ref scenegraph, @ref BasicFeatureGroup2D, @ref BasicFeatureGroup3D, + @ref FeatureGroup2D, @ref FeatureGroup3D */ -template class BasicFeatureGroup: public AbstractBasicFeatureGroup { - friend class AbstractBasicGroupedFeature; +template class FeatureGroup: public AbstractFeatureGroup { + friend class AbstractGroupedFeature; public: - explicit BasicFeatureGroup() = default; + explicit FeatureGroup() = default; /** * @brief Destructor * * Removes all features belonging to this group, but not deletes them. */ - ~BasicFeatureGroup(); + ~FeatureGroup(); /** @brief Whether the group is empty */ bool isEmpty() const { return this->features.empty(); } @@ -93,9 +94,9 @@ template class BasicFeatureGroup * @return Pointer to self (for method chaining) * * If the features is part of another group, it is removed from it. - * @see remove(), AbstractBasicGroupedFeature::AbstractBasicGroupedFeature() + * @see remove(), AbstractGroupedFeature::AbstractGroupedFeature() */ - BasicFeatureGroup* add(Feature* feature); + FeatureGroup* add(Feature* feature); /** * @brief Remove feature from the group @@ -104,51 +105,75 @@ template class BasicFeatureGroup * The feature must be part of the group. * @see add() */ - BasicFeatureGroup* remove(Feature* feature); + FeatureGroup* remove(Feature* feature); }; #ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Base feature for two-dimensional float scenes +@brief Base feature group for two-dimensional scenes -Convenience alternative to %BasicFeatureGroup<2, Feature, Float>. -@note Not available on GCC < 4.7. Use %BasicFeatureGroup<2, Feature, Float> +Convenience alternative to %FeatureGroup<2, Feature, T>. See +AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %FeatureGroup<2, Feature, T> + instead. +@see @ref FeatureGroup2D, @ref BasicFeatureGroup3D +*/ +template using BasicFeatureGroup2D = FeatureGroup<2, Feature, T>; + +/** +@brief Base feature group for two-dimensional float scenes + +Convenience alternative to %BasicFeatureGroup2D. See +AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %FeatureGroup<2, Feature, Float> instead. @see @ref FeatureGroup3D */ -template using FeatureGroup2D = BasicFeatureGroup<2, Feature, Float>; +template using FeatureGroup2D = BasicFeatureGroup2D; + +/** +@brief Base feature group for three-dimensional scenes + +Convenience alternative to %FeatureGroup<3, Feature, T>. See +AbstractGroupedFeature for more information. +@note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, T> + instead. +@see @ref FeatureGroup3D, @ref BasicFeatureGroup2D +*/ +template using BasicFeatureGroup3D = FeatureGroup<3, Feature, T>; /** -@brief Base feature for three-dimensional float scenes +@brief Base feature group for three-dimensional float scenes -Convenience alternative to %BasicFeatureGroup<3, Feature, Float>. +Convenience alternative to %BasicFeatureGroup3D. See +AbstractGroupedFeature for more information. @note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, Float> instead. @see @ref FeatureGroup2D */ -template using FeatureGroup3D = BasicFeatureGroup<3, Feature, Float>; +template using FeatureGroup3D = BasicFeatureGroup3D; #endif -template BasicFeatureGroup::~BasicFeatureGroup() { +template FeatureGroup::~FeatureGroup() { for(auto i: this->features) static_cast(i)->_group = nullptr; } -template BasicFeatureGroup* BasicFeatureGroup::add(Feature* feature) { +template FeatureGroup* FeatureGroup::add(Feature* feature) { /* Remove from previous group */ if(feature->_group) feature->_group->remove(feature); /* Crossreference the feature and group together */ - AbstractBasicFeatureGroup::add(feature); + AbstractFeatureGroup::add(feature); feature->_group = this; return this; } -template BasicFeatureGroup* BasicFeatureGroup::remove(Feature* feature) { +template FeatureGroup* FeatureGroup::remove(Feature* feature) { CORRADE_ASSERT(feature->_group == this, - "SceneGraph::AbstractBasicFeatureGroup::remove(): feature is not part of this group", this); + "SceneGraph::AbstractFeatureGroup::remove(): feature is not part of this group", this); - AbstractBasicFeatureGroup::remove(feature); + AbstractFeatureGroup::remove(feature); feature->_group = nullptr; return this; } diff --git a/src/SceneGraph/FeatureGroup.hpp b/src/SceneGraph/FeatureGroup.hpp index 494af730f..0f2cd1f1f 100644 --- a/src/SceneGraph/FeatureGroup.hpp +++ b/src/SceneGraph/FeatureGroup.hpp @@ -34,14 +34,14 @@ namespace Magnum { namespace SceneGraph { -template AbstractBasicFeatureGroup::AbstractBasicFeatureGroup() = default; -template AbstractBasicFeatureGroup::~AbstractBasicFeatureGroup() = default; +template AbstractFeatureGroup::AbstractFeatureGroup() = default; +template AbstractFeatureGroup::~AbstractFeatureGroup() = default; -template void AbstractBasicFeatureGroup::add(AbstractBasicFeature* feature) { +template void AbstractFeatureGroup::add(AbstractFeature* feature) { features.push_back(feature); } -template void AbstractBasicFeatureGroup::remove(AbstractBasicFeature* feature) { +template void AbstractFeatureGroup::remove(AbstractFeature* feature) { features.erase(std::find(features.begin(), features.end(), feature)); } diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 0fa140ae6..957bfffc4 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -112,7 +112,7 @@ template void Object::setDirty() { Object* self = static_cast*>(this); /* Make all features dirty */ - for(AbstractBasicFeature* i = self->firstFeature(); i; i = i->nextFeature()) + for(AbstractFeature* i = self->firstFeature(); i; i = i->nextFeature()) i->markDirty(); /* Make all children dirty */ @@ -376,7 +376,7 @@ template void Object::setClean(const typen MatrixType matrix, invertedMatrix; /* Clean all features */ - for(AbstractBasicFeature* i = this->firstFeature(); i; i = i->nextFeature()) { + for(AbstractFeature* i = this->firstFeature(); i; i = i->nextFeature()) { /* Cached absolute transformation, compute it if it wasn't computed already */ if(i->cachedTransformations() & CachedTransformation::Absolute) { diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index d5577b3a6..7f8abc2ca 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -44,18 +44,25 @@ typedef AbstractBasicCamera<3, Float> AbstractCamera3D; /* Enum CachedTransformation and CachedTransformations used only directly */ -template class AbstractBasicFeature; -typedef AbstractBasicFeature<2, Float> AbstractFeature2D; -typedef AbstractBasicFeature<3, Float> AbstractFeature3D; +template class AbstractFeature; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using AbstractBasicFeature2D = AbstractFeature<2, T>; +template using AbstractBasicFeature3D = AbstractFeature<3, T>; +typedef AbstractBasicFeature2D AbstractFeature2D; +typedef AbstractBasicFeature3D AbstractFeature3D; +#else +typedef AbstractFeature<2, Float> AbstractFeature2D; +typedef AbstractFeature<3, Float> AbstractFeature3D; +#endif -template class AbstractBasicFeatureGroup; -typedef AbstractBasicFeatureGroup<2, Float> AbstractFeatureGroup2D; -typedef AbstractBasicFeatureGroup<3, Float> AbstractFeatureGroup3D; +/* AbstractFeatureGroup shouldn't be used directly */ -template class AbstractBasicGroupedFeature; +template class AbstractGroupedFeature; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature<2, Derived, Float>; -template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature<3, Derived, Float>; +template using AbstractBasicGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; +template using AbstractBasicGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; +template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature2D; +template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature3D; #endif template class AbstractObject; @@ -123,14 +130,16 @@ template class BasicDualQuaternionTransformation; typedef BasicDualComplexTransformation DualComplexTransformation; typedef BasicDualQuaternionTransformation DualQuaternionTransformation; -template class BasicFeatureGroup; +template class FeatureGroup; #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicFeatureGroup2D = BasicFeatureGroup<2, Feature, Float>; -template using BasicFeatureGroup3D = BasicFeatureGroup<3, Feature, Float>; +template using BasicFeatureGroup2D = FeatureGroup<2, Feature, T>; +template using BasicFeatureGroup3D = FeatureGroup<3, Feature, T>; +template using FeatureGroup2D = BasicFeatureGroup2D; +template using FeatureGroup3D = BasicFeatureGroup3D; #endif #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicDrawableGroup = BasicFeatureGroup, T>; +template using BasicDrawableGroup = FeatureGroup, T>; #else template class BasicDrawableGroup; #endif diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index ab056b10c..d230cbe83 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -42,10 +42,10 @@ template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<3, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<3, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeatureGroup<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeatureGroup<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<3, Float>; template class AbstractBasicCamera<2, Float>; template class AbstractBasicCamera<3, Float>; diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index 0c969964f..d9d6ef0db 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -31,16 +31,16 @@ namespace Magnum { namespace Shapes { -template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractBasicGroupedFeature, Float>(object, group) { +template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature, Float>(object, group) { this->setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } template ShapeGroup* AbstractShape::group() { - return static_cast*>(SceneGraph::AbstractBasicGroupedFeature, Float>::group()); + return static_cast*>(SceneGraph::AbstractGroupedFeature, Float>::group()); } template const ShapeGroup* AbstractShape::group() const { - return static_cast*>(SceneGraph::AbstractBasicGroupedFeature, Float>::group()); + return static_cast*>(SceneGraph::AbstractGroupedFeature, Float>::group()); } template auto AbstractShape::type() const -> Type { diff --git a/src/Shapes/AbstractShape.h b/src/Shapes/AbstractShape.h index b114ec23d..b4e30e8e6 100644 --- a/src/Shapes/AbstractShape.h +++ b/src/Shapes/AbstractShape.h @@ -49,7 +49,7 @@ This class is not directly instantiable, see Shape instead. See @ref shapes for brief introduction. @see AbstractShape2D, AbstractShape3D */ -template class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractBasicGroupedFeature, Float> { +template class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractGroupedFeature, Float> { friend const Implementation::AbstractShape* Implementation::getAbstractShape<>(const AbstractShape*); public: diff --git a/src/Shapes/ShapeGroup.h b/src/Shapes/ShapeGroup.h index 6b4a3a8be..bd181def2 100644 --- a/src/Shapes/ShapeGroup.h +++ b/src/Shapes/ShapeGroup.h @@ -43,7 +43,7 @@ namespace Magnum { namespace Shapes { See Shape for more information. See @ref shapes for brief introduction. @see @ref scenegraph, ShapeGroup2D, ShapeGroup3D */ -template class MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::BasicFeatureGroup, Float> { +template class MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::FeatureGroup, Float> { friend class AbstractShape; public: From 35fc4684d47a34483094b1e8d914a301cd40b245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 18:09:22 +0200 Subject: [PATCH 26/90] Better usage of *Basic* in class names, part 4: SceneGraph transformations. Use AbstractTransformation like before and add two kinds of aliases instead of only one: AbstractBasicTransformation2D/AbstractBasicTransformation3D for abstract type and AbstractTransformation2D/AbstractTransformation3D for Float. Partially reverts commit 346ea2feb699876ee18d00655d8732b52ea30be5. --- src/SceneGraph/AbstractTransformation.h | 53 +++++++++++++++---- .../AbstractTranslationRotation2D.h | 5 +- .../AbstractTranslationRotation3D.h | 5 +- .../AbstractTranslationRotationScaling3D.h | 2 +- src/SceneGraph/Object.hpp | 2 +- src/SceneGraph/SceneGraph.h | 13 +++-- src/SceneGraph/instantiation.cpp | 4 +- 7 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index f429a021e..ee96fc440 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicTransformation, enum Magnum::SceneGraph::TransformationType, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D + * @brief Class Magnum::SceneGraph::AbstractTransformation, alias Magnum::SceneGraph::AbstractBasicTransformation2D, Magnum::SceneGraph::AbstractBasicTransformation3D, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D, enum Magnum::SceneGraph::TransformationType */ #include @@ -50,10 +50,11 @@ When subclassing, you have to: - Implement all members listed in **Subclass implementation** group above - Provide implicit (parameterless) constructor -@see @ref AbstractTransformation2D, @ref AbstractTransformation3D, - @ref scenegraph +@see @ref scenegraph, @ref AbstractBasicTransformation2D, + @ref AbstractBasicTransformation3D, @ref AbstractTransformation2D, + @ref AbstractTransformation3D */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation { +template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { public: /** @brief Underlying floating-point type */ typedef T Type; @@ -61,7 +62,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /** @brief Dimension count */ static const UnsignedInt Dimensions = dimensions; - explicit AbstractBasicTransformation(); + explicit AbstractTransformation(); #ifdef DOXYGEN_GENERATING_OUTPUT /** @@ -137,13 +138,13 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Reset object transformation * @return Pointer to self (for method chaining) */ - AbstractBasicTransformation* resetTransformation() { + AbstractTransformation* resetTransformation() { doResetTransformation(); return this; } protected: - ~AbstractBasicTransformation() = default; + ~AbstractTransformation() = default; #ifdef DOXYGEN_GENERATING_OUTPUT protected: @@ -163,19 +164,53 @@ enum class TransformationType: UnsignedByte { Local = 0x01 }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base transformation for two-dimensional scenes + +Convenience alternative to %AbstractTransformation<2, T>. See +AbstractTransformation for more information. +@note Not available on GCC < 4.7. Use %AbstractTransformation<2, T> + instead. +@see @ref AbstractTransformation2D, @ref AbstractBasicTransformation3D +*/ +template using AbstractBasicTransformation2D = AbstractTransformation<2, T>; +#endif + /** @brief Base transformation for two-dimensional float scenes @see @ref AbstractTransformation3D */ -typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicTransformation2D AbstractTransformation2D; +#else +typedef AbstractTransformation<2, Float> AbstractTransformation2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base transformation for three-dimensional scenes + +Convenience alternative to %AbstractTransformation<3, T>. See +AbstractTransformation for more information. +@note Not available on GCC < 4.7. Use %AbstractTransformation<3, T> + instead. +@see @ref AbstractTransformation3D, @ref AbstractBasicTransformation3D +*/ +template using AbstractBasicTransformation3D = AbstractTransformation<3, T>; +#endif /** @brief Base transformation for three-dimensional float scenes @see @ref AbstractTransformation2D */ -typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicTransformation3D AbstractTransformation3D; +#else +typedef AbstractTransformation<3, Float> AbstractTransformation3D; +#endif }} diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/SceneGraph/AbstractTranslationRotation2D.h index 661400784..2fd787365 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/SceneGraph/AbstractTranslationRotation2D.h @@ -36,8 +36,9 @@ namespace Magnum { namespace SceneGraph { @brief Base translation for two-dimensional scenes supporting translation and rotation @see @ref AbstractTranslationRotation2D, @ref scenegraph, @ref AbstractBasicTranslationRotation3D +@todo Use AbstractBasicTransformation2D when support for GCC 4.6 is dropped */ -template class AbstractBasicTranslationRotation2D: public AbstractBasicTransformation<2, T> { +template class AbstractBasicTranslationRotation2D: public AbstractTransformation<2, T> { public: explicit AbstractBasicTranslationRotation2D() = default; @@ -68,7 +69,7 @@ template class AbstractBasicTranslationRotation2D: public AbstractBasic /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT AbstractBasicTranslationRotation2D* resetTransformation() { - AbstractBasicTransformation<2, T>::resetTransformation(); + AbstractTransformation<2, T>::resetTransformation(); return this; } #endif diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/SceneGraph/AbstractTranslationRotation3D.h index 604e3cc66..0e36b0c9b 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/SceneGraph/AbstractTranslationRotation3D.h @@ -37,8 +37,9 @@ namespace Magnum { namespace SceneGraph { @brief Base translation for three-dimensional scenes supporting translation and rotation @see @ref AbstractTranslationRotation3D @ref scenegraph, @ref AbstractBasicTranslationRotation2D +@todo Use AbstractBasicTransformation3D when support for GCC 4.6 is dropped */ -template class AbstractBasicTranslationRotation3D: public AbstractBasicTransformation<3, T> { +template class AbstractBasicTranslationRotation3D: public AbstractTransformation<3, T> { public: explicit AbstractBasicTranslationRotation3D() = default; @@ -115,7 +116,7 @@ template class AbstractBasicTranslationRotation3D: public AbstractBasic /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT AbstractBasicTranslationRotation3D* resetTransformation() { - AbstractBasicTransformation<3, T>::resetTransformation(); + AbstractTransformation<3, T>::resetTransformation(); return this; } #endif diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/SceneGraph/AbstractTranslationRotationScaling3D.h index 63719fa38..11a37b7b4 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -33,7 +33,7 @@ namespace Magnum { namespace SceneGraph { /** -@brief Base for three-dimensional transformations supporting translation, rotation and scaling +@brief Base transformation for three-dimensional scenes supporting translation, rotation and scaling @see @ref AbstractTranslationRotationScaling3D, @ref scenegraph, @ref AbstractBasicTranslationRotationScaling2D */ diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 957bfffc4..ba60a6341 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -41,7 +41,7 @@ namespace Magnum { namespace SceneGraph { template AbstractObject::AbstractObject() {} template AbstractObject::~AbstractObject() {} -template AbstractBasicTransformation::AbstractBasicTransformation() {} +template AbstractTransformation::AbstractTransformation() {} template Object::~Object() = default; diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 7f8abc2ca..cb520efe7 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -78,9 +78,16 @@ typedef AbstractObject<3, Float> AbstractObject3D; enum class TransformationType: UnsignedByte; -template class AbstractBasicTransformation; -typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D; -typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D; +template class AbstractTransformation; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using AbstractBasicTransformation2D = AbstractTransformation<2, T>; +template using AbstractBasicTransformation3D = AbstractTransformation<3, T>; +typedef AbstractBasicTransformation2D AbstractTransformation2D; +typedef AbstractBasicTransformation3D AbstractTransformation3D; +#else +typedef AbstractTransformation<2, Float> AbstractTransformation2D; +typedef AbstractTransformation<3, Float> AbstractTransformation3D; +#endif template class AbstractBasicTranslationRotation2D; template class AbstractBasicTranslationRotation3D; diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index d230cbe83..75ae63633 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -39,8 +39,8 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<3, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>; From 9450ec6e1e526b30d42d2660f33fe9d23ad77461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:03:52 +0200 Subject: [PATCH 27/90] Better usage of *Basic* in class names, part 5: SceneGraph drawables. Use AbstractCamera, Drawable and DrawableGroup like before and add two kinds of aliases instead of only one: AbstractBasicCamera2D/AbstractBasicCamera3D, BasicDrawable2D/BasicDrawable3D and BasicDrawableGroup2D/BasicDrawableGroup3D for abstract type and AbstractCamera2D/AbstractCamera3D, Drawable2D/Drawable3D and DrawableGroup2D/DrawableGroup3D for Float. Also fixed some find&replace errors in documentation and include guards. Partially reverts commit a0d60bbaa75df9dbd8172a6b8936019b15b2c807. --- src/DebugTools/ForceRenderer.cpp | 4 +- src/DebugTools/ForceRenderer.h | 6 +- src/DebugTools/ObjectRenderer.cpp | 4 +- src/DebugTools/ObjectRenderer.h | 6 +- src/DebugTools/ShapeRenderer.cpp | 4 +- src/DebugTools/ShapeRenderer.h | 6 +- src/SceneGraph/AbstractCamera.h | 64 ++++++++++++---- src/SceneGraph/AbstractCamera.hpp | 10 +-- src/SceneGraph/Camera2D.h | 19 ++--- src/SceneGraph/Camera2D.hpp | 8 +- src/SceneGraph/Camera3D.h | 15 ++-- src/SceneGraph/Camera3D.hpp | 16 ++-- src/SceneGraph/Drawable.h | 118 +++++++++++++++++++++++------- src/SceneGraph/SceneGraph.h | 35 ++++++--- src/SceneGraph/instantiation.cpp | 4 +- 15 files changed, 220 insertions(+), 99 deletions(-) diff --git a/src/DebugTools/ForceRenderer.cpp b/src/DebugTools/ForceRenderer.cpp index da72e3501..c5357f9dd 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/DebugTools/ForceRenderer.cpp @@ -64,7 +64,7 @@ const std::array indices{{ } -template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance()->get(options)) { +template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance()->get(options)) { /* Shader */ shader = ResourceManager::instance()->get>(shaderKey()); if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::Flat); @@ -94,7 +94,7 @@ template ForceRenderer::ForceRenderer(SceneG ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { +template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { shader->setTransformationProjectionMatrix(camera->projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), *force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) ->setColor(options->color()) ->use(); diff --git a/src/DebugTools/ForceRenderer.h b/src/DebugTools/ForceRenderer.h index 1b70c545c..9dacd0986 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/DebugTools/ForceRenderer.h @@ -101,7 +101,7 @@ new DebugTools::ForceRenderer2D(object, {0.3f, 1.5f, -0.7f}, &force, "my", debug @see ForceRenderer2D, ForceRenderer3D */ -template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: public SceneGraph::BasicDrawable { +template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: public SceneGraph::Drawable { public: /** * @brief Constructor @@ -117,10 +117,10 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p * saved as reference to original vector and thus it must be available * for the whole lifetime of the renderer. */ - explicit ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); + explicit ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); protected: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; private: const typename DimensionTraits::VectorType forcePosition; diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/DebugTools/ObjectRenderer.cpp index 3f4573452..834ce60db 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/DebugTools/ObjectRenderer.cpp @@ -142,7 +142,7 @@ const std::array Renderer<3>::indices{{ } -template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(object, drawables), options(ResourceManager::instance()->get(options)) { +template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), options(ResourceManager::instance()->get(options)) { /* Shader */ shader = ResourceManager::instance()->get>(Renderer::shader()); if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::VertexColor); @@ -173,7 +173,7 @@ template ObjectRenderer::ObjectRenderer(Scen ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) { +template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { shader->setTransformationProjectionMatrix(camera->projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) ->use(); diff --git a/src/DebugTools/ObjectRenderer.h b/src/DebugTools/ObjectRenderer.h index eb92f723b..cfc48c73e 100644 --- a/src/DebugTools/ObjectRenderer.h +++ b/src/DebugTools/ObjectRenderer.h @@ -84,7 +84,7 @@ new DebugTools::ObjectRenderer2D(object, "my", debugDrawables); @see ObjectRenderer2D, ObjectRenderer3D */ -template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: public SceneGraph::BasicDrawable { +template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: public SceneGraph::Drawable { public: /** * @brief Constructor @@ -96,10 +96,10 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: * * The renderer is automatically added to object's features. */ - explicit ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); + explicit ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); protected: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; private: Resource options; diff --git a/src/DebugTools/ShapeRenderer.cpp b/src/DebugTools/ShapeRenderer.cpp index 52cf39947..1c36ff272 100644 --- a/src/DebugTools/ShapeRenderer.cpp +++ b/src/DebugTools/ShapeRenderer.cpp @@ -97,7 +97,7 @@ template<> void createDebugMesh(ShapeRenderer<3>* renderer, const Shapes::Implem } -template ShapeRenderer::ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options, SceneGraph::BasicDrawableGroup* drawables): SceneGraph::BasicDrawable(shape->object(), drawables), options(ResourceManager::instance()->get(options)) { +template ShapeRenderer::ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(shape->object(), drawables), options(ResourceManager::instance()->get(options)) { Implementation::createDebugMesh(this, Shapes::Implementation::getAbstractShape(shape)); } @@ -105,7 +105,7 @@ template ShapeRenderer::~ShapeRenderer() { for(auto i: renderers) delete i; } -template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractBasicCamera* camera) { +template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractCamera* camera) { typename DimensionTraits::MatrixType projectionMatrix = camera->projectionMatrix()*camera->cameraMatrix(); for(auto i: renderers) i->draw(options, projectionMatrix); } diff --git a/src/DebugTools/ShapeRenderer.h b/src/DebugTools/ShapeRenderer.h index 9c8e0eaf1..d3af6f438 100644 --- a/src/DebugTools/ShapeRenderer.h +++ b/src/DebugTools/ShapeRenderer.h @@ -138,7 +138,7 @@ new DebugTools::ShapeRenderer2D(shape, "red", debugDrawables); @see ShapeRenderer2D, ShapeRenderer3D */ -template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::BasicDrawable { +template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::Drawable { friend void Implementation::createDebugMesh<>(ShapeRenderer*, const Shapes::Implementation::AbstractShape*); public: @@ -154,13 +154,13 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p * @p shape must be available for the whole lifetime of the renderer * and if it is group, it must not change its internal structure. */ - explicit ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options = ResourceKey(), SceneGraph::BasicDrawableGroup* drawables = nullptr); + explicit ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); ~ShapeRenderer(); protected: /** @todoc Remove Float when Doxygen properly treats this as override */ - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractBasicCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; private: Resource options; diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index e7e71fb25..c504986dd 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractBasicCamera, enum Magnum::SceneGraph::AspectRatioPolicy, typedef Magnum::SceneGraph::AbstractCamera2D, Magnum::SceneGraph::AbstractCamera3D + * @brief Class Magnum::SceneGraph::AbstractCamera, enum Magnum::SceneGraph::AspectRatioPolicy, alias Magnum::SceneGraph::AbstractBasicCamera2D, Magnum::SceneGraph::AbstractBasicCamera3D, typedef Magnum::SceneGraph::AbstractCamera2D, Magnum::SceneGraph::AbstractCamera3D */ #include "Math/Matrix3.h" @@ -39,7 +39,7 @@ namespace Magnum { namespace SceneGraph { /** @brief Camera aspect ratio policy -@see AbstractBasicCamera::setAspectRatioPolicy() +@see AbstractCamera::setAspectRatioPolicy() */ enum class AspectRatioPolicy: UnsignedByte { NotPreserved, /**< Don't preserve aspect ratio (default) */ @@ -55,7 +55,8 @@ namespace Implementation { @brief Base for cameras See Drawable documentation for more information. This class is not directly -instantiatable, use Camera2D or Camera3D subclasses instead. +instantiatable, use @ref BasicCamera2D or @ref BasicCamera3D subclasses +instead. @section AbstractCamera-explicit-specializations Explicit template specializations @@ -67,20 +68,21 @@ relevant sections in @ref Camera3D-explicit-specializations "Camera3D" class documentation or @ref compilation-speedup-hpp for more information. - - @ref AbstractBasicCamera "AbstractBasicCamera<2, Float>" - - @ref AbstractBasicCamera "AbstractBasicCamera<3, Float>" + - @ref AbstractCamera "AbstractCamera<2, Float>" + - @ref AbstractCamera "AbstractCamera<3, Float>" -@see AbstractCamera2D, AbstractCamera3D, @ref scenegraph, Drawable, DrawableGroup +@see @ref scenegraph, @ref AbstractBasicCamera2D, @ref AbstractBasicCamera3D, + @ref Drawable, @ref DrawableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicCamera: public AbstractFeature { +template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature { public: /** * @brief Constructor * @param object Object holding the camera */ - explicit AbstractBasicCamera(AbstractObject* object); + explicit AbstractCamera(AbstractObject* object); - virtual ~AbstractBasicCamera() = 0; + virtual ~AbstractCamera() = 0; /** @brief Aspect ratio policy */ AspectRatioPolicy aspectRatioPolicy() const { return _aspectRatioPolicy; } @@ -89,7 +91,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Set aspect ratio policy * @return Pointer to self (for method chaining) */ - AbstractBasicCamera* setAspectRatioPolicy(AspectRatioPolicy policy); + AbstractCamera* setAspectRatioPolicy(AspectRatioPolicy policy); /** * @brief Camera matrix @@ -138,7 +140,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * * Draws given group of drawables. */ - virtual void draw(BasicDrawableGroup& group); + virtual void draw(DrawableGroup& group); protected: /** Recalculates camera matrix */ @@ -162,19 +164,51 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac Vector2i _viewport; }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base camera for two-dimensional scenes + +Convenience alternative to %AbstractCamera<2, T>. See AbstractCamera +for more information. +@note Not available on GCC < 4.7. Use %AbstractCamera<2, T> instead. +@see @ref AbstractCamera2D, @ref AbstractBasicCamera3D +*/ +template using AbstractBasicCamera2D = AbstractCamera<2, T>; +#endif + /** @brief Base camera for two-dimensional float scenes -@see AbstractCamera3D +@see @ref AbstractCamera3D +*/ +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicCamera2D AbstractCamera2D; +#else +typedef AbstractCamera<2, Float> AbstractCamera2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Base camera for three-dimensional scenes + +Convenience alternative to %AbstractCamera<3, T>. See AbstractCamera +for more information. +@note Not available on GCC < 4.7. Use %AbstractCamera<3, T> instead. +@see @ref AbstractCamera3D, @ref AbstractBasicCamera2D */ -typedef AbstractBasicCamera<2, Float> AbstractCamera2D; +template using AbstractBasicCamera3D = AbstractCamera<3, T>; +#endif /** @brief Base camera for three-dimensional float scenes -@see AbstractBasicCamera2D +@see @ref AbstractCamera2D */ -typedef AbstractBasicCamera<3, Float> AbstractCamera3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef AbstractBasicCamera3D AbstractCamera3D; +#else +typedef AbstractCamera<3, Float> AbstractCamera3D; +#endif }} diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 91d7ed59a..413cc4b86 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -70,24 +70,24 @@ template typename DimensionTraits AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { +template AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } -template AbstractBasicCamera::~AbstractBasicCamera() {} +template AbstractCamera::~AbstractCamera() {} -template AbstractBasicCamera* AbstractBasicCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { +template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { _aspectRatioPolicy = policy; fixAspectRatio(); return this; } -template void AbstractBasicCamera::setViewport(const Vector2i& size) { +template void AbstractCamera::setViewport(const Vector2i& size) { _viewport = size; fixAspectRatio(); } -template void AbstractBasicCamera::draw(BasicDrawableGroup& group) { +template void AbstractCamera::draw(DrawableGroup& group) { AbstractObject* scene = AbstractFeature::object()->scene(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 17dc1cf06..991a6b8e5 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -1,5 +1,5 @@ -#ifndef Magnum_SceneGraph_BasicCamera2D_h -#define Magnum_SceneGraph_BasicCamera2D_h +#ifndef Magnum_SceneGraph_Camera2D_h +#define Magnum_SceneGraph_Camera2D_h /* This file is part of Magnum. @@ -39,7 +39,7 @@ See Drawable documentation for introduction. The camera by default displays OpenGL unit cube `[(-1, -1, -1); (1, 1, 1)]` and doesn't do any aspect ratio correction. Common setup example: @code -SceneGraph::BasicCamera2D* camera = new SceneGraph::BasicCamera2D(&cameraObject); +SceneGraph::Camera2D* camera = new SceneGraph::Camera2D(&cameraObject); camera->setProjection({4.0f/3.0f, 1.0f}) ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode @@ -47,15 +47,16 @@ camera->setProjection({4.0f/3.0f, 1.0f}) @section Camera2D-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using Double type) you have to use -BasicCamera2D.hpp implementation file to avoid linker errors. See -@ref compilation-speedup-hpp for more information. +For other specializations (e.g. using Double type) you have to use Camera2D.hpp +implementation file to avoid linker errors. See @ref compilation-speedup-hpp +for more information. - @ref BasicCamera2D "BasicCamera2D" -@see @ref Camera2D, @ref scenegraph, @ref BasicCamera3D, @ref BasicDrawable, @ref BasicDrawableGroup +@see @ref scenegraph, @ref Camera2D, @ref BasicCamera3D, @ref Drawable, + @ref DrawableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractBasicCamera<2, T> { +template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractCamera<2, T> { public: /** * @brief Constructor @@ -78,7 +79,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractB /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT BasicCamera2D* setAspectRatioPolicy(AspectRatioPolicy policy) { - AbstractBasicCamera<2, T>::setAspectRatioPolicy(policy); + AbstractCamera<2, T>::setAspectRatioPolicy(policy); return this; } #endif diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 16926a89d..94b785770 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -33,14 +33,16 @@ using namespace std; +/** @todo Use AbstractBasicCamera2D when support for GCC 4.6 is dropped (also in header) */ + namespace Magnum { namespace SceneGraph { -template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>* object): AbstractBasicCamera<2, T>(object) {} +template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} template BasicCamera2D* BasicCamera2D::setProjection(const Math::Vector2& size) { - AbstractBasicCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); + AbstractCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); - AbstractBasicCamera<2, T>::fixAspectRatio(); + AbstractCamera<2, T>::fixAspectRatio(); return this; } diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 66e66158c..0a8cb2b0d 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -44,7 +44,7 @@ See Drawable documentation for introduction. The camera by default displays OpenGL unit cube `[(-1, -1, -1); (1, 1, 1)]` with orthographic projection and doesn't do any aspect ratio correction. Common setup example: @code -SceneGraph::BasicCamera3D* camera = new SceneGraph::BasicCamera3D(&cameraObject); +SceneGraph::Camera3D* camera = new SceneGraph::Camera3D(&cameraObject); camera->setPerspective({}, 0.001f, 100.0f) ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode @@ -52,15 +52,16 @@ camera->setPerspective({}, 0.001f, 100.0f) @section Camera3D-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using Double type) you have to use -BasicCamera3D.hpp implementation file to avoid linker errors. See -@ref compilation-speedup-hpp for more information. +For other specializations (e.g. using Double type) you have to use Camera3D.hpp +implementation file to avoid linker errors. See @ref compilation-speedup-hpp +for more information. - @ref BasicCamera3D "BasicCamera3D" -@see @ref Camera3D, @ref scenegraph, @ref BasicCamera2D, @ref BasicDrawable, @ref BasicDrawableGroup +@see @ref scenegraph, @ref Camera3D, @ref BasicCamera2D, @ref Drawable, + @ref DrawableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractBasicCamera<3, T> { +template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractCamera<3, T> { public: /** * @brief Constructor @@ -111,7 +112,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractB /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT BasicCamera3D* setAspectRatioPolicy(AspectRatioPolicy policy) { - AbstractBasicCamera<3, T>::setAspectRatioPolicy(policy); + AbstractCamera<3, T>::setAspectRatioPolicy(policy); return this; } #endif diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index 81f15bfa0..73fd88b53 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -31,17 +31,19 @@ #include "AbstractCamera.hpp" #include "Camera3D.h" +/** @todo Use AbstractBasicCamera3D when support for GCC 4.6 is dropped (also in header) */ + namespace Magnum { namespace SceneGraph { -template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>* object): AbstractBasicCamera<3, T>(object), _near(T(0)), _far(T(0)) {} +template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(T(0)), _far(T(0)) {} template BasicCamera3D* BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far; - AbstractBasicCamera<3, T>::rawProjectionMatrix = Math::Matrix4::orthographicProjection(size, near, far); - AbstractBasicCamera<3, T>::fixAspectRatio(); + AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::orthographicProjection(size, near, far); + AbstractCamera<3, T>::fixAspectRatio(); return this; } @@ -50,8 +52,8 @@ template BasicCamera3D* BasicCamera3D::setPerspective(const Math: _near = near; _far = far; - AbstractBasicCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(size, near, far); - AbstractBasicCamera<3, T>::fixAspectRatio(); + AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(size, near, far); + AbstractCamera<3, T>::fixAspectRatio(); return this; } @@ -60,8 +62,8 @@ template BasicCamera3D* BasicCamera3D::setPerspective(Math::Rad::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(fov, aspectRatio, near, far); - AbstractBasicCamera<3, T>::fixAspectRatio(); + AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(fov, aspectRatio, near, far); + AbstractCamera<3, T>::fixAspectRatio(); return this; } diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index c67a22bae..1678d1ff4 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::BasicDrawable, Magnum::SceneGraph::BasicDrawableGroup, typedef Magnum::SceneGraph::Drawable2D, Magnum::SceneGraph::Drawable3D, Magnum::SceneGraph::DrawableGroup2D, Magnum::SceneGraph::DrawableGroup3D + * @brief Class Magnum::SceneGraph::Drawable, Magnum::SceneGraph::DrawableGroup, alias Magnum::SceneGraph::BasicDrawable2D, Magnum::SceneGraph::BasicDrawable3D, Magnum::SceneGraph::BasicDrawableGroup2D, Magnum::SceneGraph::BasicDrawableGroup3D, typedef Magnum::SceneGraph::Drawable2D, Magnum::SceneGraph::Drawable3D, Magnum::SceneGraph::DrawableGroup2D, Magnum::SceneGraph::DrawableGroup3D */ #include "AbstractGroupedFeature.h" @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { /** @brief %Drawable -Adds drawing function to the object. Each Drawable is part of some DrawableGroup +Adds drawing function to the object. Each %Drawable is part of some DrawableGroup and the whole group is drawn with particular camera using AbstractCamera::draw(). @section Drawable-usage Usage @@ -60,8 +60,8 @@ class DrawableObject: public Object3D, SceneGraph::Drawable3D { @endcode Then you add these objects to your scene and some drawable group and transform -them as you like. You can also use BasicDrawableGroup::add() and -BasicDrawableGroup::remove(). +them as you like. You can also use DrawableGroup::add() and +DrawableGroup::remove(). @code Scene3D scene; SceneGraph::DrawableGroup3D drawables; @@ -78,7 +78,7 @@ The last thing you need is Camera attached to some object (thus using its transformation) and with it you can perform drawing in your draw event implementation. See Camera2D and Camera3D documentation for more information. @code -Camera3D<> camera(&cameraObject); +Camera3D camera(&cameraObject); void MyApplication::drawEvent() { camera.draw(drawables); @@ -114,9 +114,10 @@ void MyApplication::drawEvent() { } @endcode -@see Drawable2D, Drawable3D, @ref scenegraph, DrawableGroup2D, DrawableGroup3D +@see @ref scenegraph, @ref BasicDrawable2D, @ref BasicDrawable3D, + @ref Drawable2D, @ref Drawable3D, @ref DrawableGroup */ -template class BasicDrawable: public AbstractGroupedFeature, T> { +template class Drawable: public AbstractGroupedFeature, T> { public: /** * @brief Constructor @@ -124,9 +125,9 @@ template class BasicDrawable: public AbstractGr * @param drawables Group this drawable belongs to * * Adds the feature to the object and also to the group, if specified. - * Otherwise you can use BasicDrawableGroup::add(). + * Otherwise you can use DrawableGroup::add(). */ - explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} + explicit Drawable(AbstractObject* object, DrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} /** * @brief Draw the object using given camera @@ -136,48 +137,113 @@ template class BasicDrawable: public AbstractGr * * Projection matrix can be retrieved from AbstractCamera::projectionMatrix(). */ - virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractBasicCamera* camera) = 0; + virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractCamera* camera) = 0; }; +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief %Drawable for two-dimensional scenes + +Convenience alternative to %Drawable<2, T>. See Drawable for more +information. +@note Not available on GCC < 4.7. Use %Drawable<2, T> instead. +@see @ref Drawable2D, @ref BasicDrawable3D +*/ +template using BasicDrawable2D = Drawable<2, T>; +#endif + +/** +@brief %Drawable for two-dimensional float scenes + +@see @ref Drawable3D +*/ +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicDrawable2D Drawable2D; +#else +typedef Drawable<2, Float> Drawable2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Two-dimensional drawable for float scenes +@brief %Drawable for three-dimensional scenes -@see Drawable3D +Convenience alternative to %Drawable<3, T>. See Drawable for more +information. +@note Not available on GCC < 4.7. Use %Drawable<3, T> instead. +@see @ref Drawable3D, @ref BasicDrawable3D */ -typedef BasicDrawable<2, Float> Drawable2D; +template using BasicDrawable3D = Drawable<3, T>; +#endif /** -@brief Three-dimensional drawable for float scenes +@brief %Drawable for three-dimensional float scenes -@see Drawable2D +@see @ref Drawable2D */ -typedef BasicDrawable<3, Float> Drawable3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicDrawable3D Drawable3D; +#else +typedef Drawable<3, Float> Drawable3D; +#endif /** @brief Group of drawables -See Drawable for more information. -@see @ref scenegraph, DrawableGroup2D, DrawableGroup3D +See @ref Drawable for more information. +@see @ref scenegraph, @ref BasicDrawableGroup2D, @ref BasicDrawableGroup3D, + @ref DrawableGroup2D, @ref DrawableGroup3D */ #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicDrawableGroup = FeatureGroup, T>; +template using DrawableGroup = FeatureGroup, T>; #else -template class BasicDrawableGroup: public FeatureGroup, T> {}; +template class DrawableGroup: public FeatureGroup, T> {}; #endif +#ifndef CORRADE_GCC46_COMPATIBILITY +/** +@brief Group of drawables for two-dimensional scenes + +Convenience alternative to %DrawableGroup<2, T>. See Drawable for +more information. +@note Not available on GCC < 4.7. Use %Drawable<2, T> instead. +@see @ref DrawableGroup2D, @ref BasicDrawableGroup3D +*/ +template using BasicDrawableGroup2D = DrawableGroup<2, T>; +#endif + +/** +@brief Group of drawables for two-dimensional float scenes + +@see @ref DrawableGroup3D +*/ +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicDrawableGroup2D DrawableGroup2D; +#else +typedef DrawableGroup<2, Float> DrawableGroup2D; +#endif + +#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Group of two-dimensional drawables for float scenes +@brief Group of drawables for three-dimensional scenes -@see DrawableGroup3D +Convenience alternative to %DrawableGroup<3, T>. See Drawable for +more information. +@note Not available on GCC < 4.7. Use %Drawable<3, T> instead. +@see @ref DrawableGroup3D, @ref BasicDrawableGroup2D */ -typedef BasicDrawableGroup<2, Float> DrawableGroup2D; +template using BasicDrawableGroup3D = DrawableGroup<3, T>; +#endif /** -@brief Group of three-dimensional drawables for float scenes +@brief Group of drawables for three-dimensional float scenes -@see DrawableGroup2D +@see @ref DrawableGroup2D */ -typedef BasicDrawableGroup<3, Float> DrawableGroup3D; +#ifndef CORRADE_GCC46_COMPATIBILITY +typedef BasicDrawableGroup3D DrawableGroup3D; +#else +typedef DrawableGroup<3, Float> DrawableGroup3D; +#endif }} diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index cb520efe7..fa5ec383b 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -38,9 +38,16 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT enum class AspectRatioPolicy: UnsignedByte; -template class AbstractBasicCamera; -typedef AbstractBasicCamera<2, Float> AbstractCamera2D; -typedef AbstractBasicCamera<3, Float> AbstractCamera3D; +template class AbstractCamera; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using AbstractBasicCamera2D = AbstractCamera<2, T>; +template using AbstractBasicCamera3D = AbstractCamera<3, T>; +typedef AbstractBasicCamera2D AbstractCamera2D; +typedef AbstractBasicCamera3D AbstractCamera3D; +#else +typedef AbstractCamera<2, Float> AbstractCamera2D; +typedef AbstractCamera<3, Float> AbstractCamera3D; +#endif /* Enum CachedTransformation and CachedTransformations used only directly */ @@ -128,9 +135,13 @@ template class BasicCamera3D; typedef BasicCamera2D Camera2D; typedef BasicCamera3D Camera3D; -template class BasicDrawable; -typedef BasicDrawable<2, Float> Drawable2D; -typedef BasicDrawable<3, Float> Drawable3D; +template class Drawable; +#ifndef CORRADE_GCC46_COMPATIBILITY +template using BasicDrawable2D = Drawable<2, T>; +template using BasicDrawable3D = Drawable<3, T>; +typedef BasicDrawable2D Drawable2D; +typedef BasicDrawable3D Drawable3D; +#endif template class BasicDualComplexTransformation; template class BasicDualQuaternionTransformation; @@ -146,12 +157,16 @@ template using FeatureGroup3D = BasicFeatureGroup3D using BasicDrawableGroup = FeatureGroup, T>; +template using DrawableGroup = FeatureGroup, T>; +template using BasicDrawableGroup2D = DrawableGroup<2, T>; +template using BasicDrawableGroup3D = DrawableGroup<3, T>; +typedef BasicDrawableGroup2D DrawableGroup2D; +typedef BasicDrawableGroup3D DrawableGroup3D; #else -template class BasicDrawableGroup; +template class DrawableGroup; +typedef DrawableGroup<2, Float> DrawableGroup2D; +typedef DrawableGroup<3, Float> DrawableGroup3D; #endif -typedef BasicDrawableGroup<2, Float> DrawableGroup2D; -typedef BasicDrawableGroup<3, Float> DrawableGroup3D; template class BasicMatrixTransformation2D; template class BasicMatrixTransformation3D; diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index 75ae63633..5e4565cb4 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -47,8 +47,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<2, Float>; template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<3, Float>; -template class AbstractBasicCamera<2, Float>; -template class AbstractBasicCamera<3, Float>; +template class AbstractCamera<2, Float>; +template class AbstractCamera<3, Float>; template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D; template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D; From e2efad2e187c659cb8d0c57a99ee00a8e0e3c4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:31:18 +0200 Subject: [PATCH 28/90] No `using namespace std` anywhere. Remains from the dark old times. --- src/SceneGraph/AbstractCamera.hpp | 2 -- src/SceneGraph/Camera2D.hpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 413cc4b86..dacc6fc5c 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -32,8 +32,6 @@ #include "Drawable.h" -using namespace std; - namespace Magnum { namespace SceneGraph { namespace Implementation { diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 94b785770..745e2d2f8 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -31,8 +31,6 @@ #include "AbstractCamera.hpp" #include "Camera2D.h" -using namespace std; - /** @todo Use AbstractBasicCamera2D when support for GCC 4.6 is dropped (also in header) */ namespace Magnum { namespace SceneGraph { From f937be8646a0938516f817ad397eadeaef6ef77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:35:51 +0200 Subject: [PATCH 29/90] Make also constructor protected when destructor is protected. Creating given object on heap (via new) (and then not deleting it) would be possible that way, which shouldn't be. --- src/AbstractFramebuffer.h | 3 +-- src/AbstractImage.h | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index 184e70ae3..25f4efa09 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -189,8 +189,6 @@ class MAGNUM_EXPORT AbstractFramebuffer { blit(source, destination, rectangle, rectangle, mask, FramebufferBlitFilter::Nearest); } - explicit AbstractFramebuffer() = default; - /** * @brief Bind framebuffer for rendering * @@ -268,6 +266,7 @@ class MAGNUM_EXPORT AbstractFramebuffer { #else protected: #endif + explicit AbstractFramebuffer() = default; ~AbstractFramebuffer() = default; void MAGNUM_LOCAL bindInternal(FramebufferTarget target); diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 412ee4179..17cfce16f 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -56,13 +56,6 @@ class MAGNUM_EXPORT AbstractImage { */ static std::size_t pixelSize(ImageFormat format, ImageType type); - /** - * @brief Constructor - * @param format Format of pixel data - * @param type Data type of pixel data - */ - constexpr explicit AbstractImage(ImageFormat format, ImageType type): _format(format), _type(type) {} - /** @brief Format of pixel data */ constexpr ImageFormat format() const { return _format; } @@ -77,6 +70,13 @@ class MAGNUM_EXPORT AbstractImage { std::size_t pixelSize() const { return pixelSize(_format, _type); } protected: + /** + * @brief Constructor + * @param format Format of pixel data + * @param type Data type of pixel data + */ + constexpr explicit AbstractImage(ImageFormat format, ImageType type): _format(format), _type(type) {} + ~AbstractImage() = default; #ifdef DOXYGEN_GENERATING_OUTPUT From a50bda090a37a8d60deee80a68eddcf0789b9c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:38:04 +0200 Subject: [PATCH 30/90] No need to have virtual destructor for AbstractTexture. Protected constructor and destructor is sufficient, AbstractTexture isn't meant to be used via AbstractTexture* anyway. --- src/AbstractTexture.cpp | 4 ++++ src/AbstractTexture.h | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 44fbc5c51..b4134c49e 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -99,6 +99,10 @@ void AbstractTexture::move() { _id = 0; } +AbstractTexture::AbstractTexture(GLenum target): _target(target) { + glGenTextures(1, &_id); +} + AbstractTexture::~AbstractTexture() { destroy(); } AbstractTexture::AbstractTexture(AbstractTexture&& other): _target(other._target), _id(other._id) { diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index e4b13f069..422086634 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -107,20 +107,6 @@ class MAGNUM_EXPORT AbstractTexture { */ static Int maxSupportedLayerCount(); - #ifndef DOXYGEN_GENERATING_OUTPUT - explicit AbstractTexture(GLenum target): _target(target) { - glGenTextures(1, &_id); - } - #endif - - /** - * @brief Destructor - * - * Deletes assigned OpenGL texture. - * @see @fn_gl{DeleteTextures} - */ - virtual ~AbstractTexture() = 0; - /** @brief Copying is not allowed */ AbstractTexture(const AbstractTexture&) = delete; @@ -260,6 +246,23 @@ class MAGNUM_EXPORT AbstractTexture { */ AbstractTexture* generateMipmap(); + protected: + /** + * @brief Constructor + * + * Creates new OpenGL texture. + * @see @fn_gl{GenTextures} + */ + explicit AbstractTexture(GLenum target); + + /** + * @brief Destructor + * + * Deletes assigned OpenGL texture. + * @see @fn_gl{DeleteTextures} + */ + ~AbstractTexture(); + #ifdef DOXYGEN_GENERATING_OUTPUT private: #else From 9890c6018a868f9336a2941ee5b7298dad1db6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:39:21 +0200 Subject: [PATCH 31/90] No need to have this Doxygen voodoo. Why not show in docs that AbstractQuery itself isn't instantiable or destructible. --- src/Query.h | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/Query.h b/src/Query.h index 7433d30fe..21d0e5924 100644 --- a/src/Query.h +++ b/src/Query.h @@ -47,24 +47,6 @@ information. */ class MAGNUM_EXPORT AbstractQuery { public: - #ifdef DOXYGEN_GENERATING_OUTPUT - /** - * @brief Constructor - * - * Generates one OpenGL query. - * @see @fn_gl{GenQueries} - */ - explicit AbstractQuery(); - - /** - * @brief Destructor - * - * Deletes assigned OpenGL query. - * @see @fn_gl{DeleteQueries} - */ - ~AbstractQuery(); - #endif - /** @brief OpenGL query ID */ GLuint id() const { return _id; } @@ -101,10 +83,21 @@ class MAGNUM_EXPORT AbstractQuery { void end(); protected: - #ifndef DOXYGEN_GENERATING_OUTPUT + /** + * @brief Constructor + * + * Generates one OpenGL query. + * @see @fn_gl{GenQueries} + */ explicit AbstractQuery(); + + /** + * @brief Destructor + * + * Deletes assigned OpenGL query. + * @see @fn_gl{DeleteQueries} + */ ~AbstractQuery(); - #endif void begin(GLenum target); From 6a877375d4d6aa2bdcd7fa46b246dff7b2f8192b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:40:22 +0200 Subject: [PATCH 32/90] No need to have virtual destructor in Buffer. --- src/Buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Buffer.h b/src/Buffer.h index 0fe35faaa..c16ac8c87 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -480,7 +480,7 @@ class MAGNUM_EXPORT Buffer { * Deletes associated OpenGL buffer. * @see @fn_gl{DeleteBuffers} */ - virtual ~Buffer(); + ~Buffer(); /** @brief OpenGL buffer ID */ GLuint id() const { return _id; } From b7ff40554c485280e6e9227ec742d2f8d506ac3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:44:33 +0200 Subject: [PATCH 33/90] SceneGraph: no need to have virtual destructor in AbstractCamera. Protected constructor and destructor is sufficient, AbstractCamera itself isn't meant to be deleted (via pointer). --- src/SceneGraph/AbstractCamera.h | 16 ++++++++-------- src/SceneGraph/AbstractCamera.hpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index c504986dd..b66ec8aad 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -76,14 +76,6 @@ relevant sections in */ template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature { public: - /** - * @brief Constructor - * @param object Object holding the camera - */ - explicit AbstractCamera(AbstractObject* object); - - virtual ~AbstractCamera() = 0; - /** @brief Aspect ratio policy */ AspectRatioPolicy aspectRatioPolicy() const { return _aspectRatioPolicy; } @@ -143,6 +135,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac virtual void draw(DrawableGroup& group); protected: + /** + * @brief Constructor + * @param object Object holding the camera + */ + explicit AbstractCamera(AbstractObject* object); + + ~AbstractCamera(); + /** Recalculates camera matrix */ void cleanInverted(const typename DimensionTraits::MatrixType& invertedAbsoluteTransformationMatrix) override { _cameraMatrix = invertedAbsoluteTransformationMatrix; diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index dacc6fc5c..891108d4a 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -72,7 +72,7 @@ template AbstractCamera::Abstrac AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } -template AbstractCamera::~AbstractCamera() {} +template AbstractCamera::~AbstractCamera() = default; template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { _aspectRatioPolicy = policy; From 1fea7c3aa2e4a46f1bfa1c37177d65b19b7abaaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:45:29 +0200 Subject: [PATCH 34/90] SceneGraph: clarify why there _is_ virtual destructor. --- src/SceneGraph/AbstractObject.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 0c5398707..fc8cfcf93 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -73,6 +73,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /** @brief Feature object type */ typedef AbstractFeature FeatureType; + /* This isn't protected because having virtual destructor here is + better than having it duplicated in all Object specializations */ explicit AbstractObject(); virtual ~AbstractObject(); From e5d090441731b190a75ebc43808708cce30500e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:46:01 +0200 Subject: [PATCH 35/90] Shaders: no need to have virtual destructor here. Protected constructor and destructor is sufficient, AbstractVector itself isn't meant to be deleted (via pointer). --- src/Shaders/AbstractVector.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Shaders/AbstractVector.h b/src/Shaders/AbstractVector.h index 2d23586e4..a90a14e1e 100644 --- a/src/Shaders/AbstractVector.h +++ b/src/Shaders/AbstractVector.h @@ -51,11 +51,11 @@ template class AbstractVector: public AbstractShaderProg VectorTextureLayer = 16 /**< Layer for vector texture */ }; - virtual ~AbstractVector() = 0; + protected: + explicit AbstractVector() = default; + ~AbstractVector() = default; }; -template inline AbstractVector::~AbstractVector() {} - /** @brief Base for two-dimensional text shaders */ typedef AbstractVector<2> AbstractVector2D; From 3482c451aca41fd61ee4746fe991f1baab8ae84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Jul 2013 23:46:55 +0200 Subject: [PATCH 36/90] Text: no need to have virtual destructor here. Protected constructor and destructor is sufficient, AbstractTextRenderer itself isn't meant to be deleted (via pointer). --- src/Text/TextRenderer.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Text/TextRenderer.h b/src/Text/TextRenderer.h index ce0d0b0db..3c38429ad 100644 --- a/src/Text/TextRenderer.h +++ b/src/Text/TextRenderer.h @@ -62,16 +62,6 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { */ static std::tuple, std::vector, std::vector, Rectangle> render(AbstractFont* font, const GlyphCache* cache, Float size, const std::string& text); - /** - * @brief Constructor - * @param font Font - * @param cache Glyph cache - * @param size Font size - */ - explicit AbstractTextRenderer(AbstractFont* font, const GlyphCache* cache, Float size); - - virtual ~AbstractTextRenderer() = 0; - /** * @brief Capacity for rendered glyphs * @@ -118,6 +108,17 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { */ void render(const std::string& text); + protected: + /** + * @brief Constructor + * @param font Font + * @param cache Glyph cache + * @param size Font size + */ + explicit AbstractTextRenderer(AbstractFont* font, const GlyphCache* cache, Float size); + + ~AbstractTextRenderer(); + #ifndef DOXYGEN_GENERATING_OUTPUT protected: #else From b57a8e9264a2f84b0ed073a5fbf9db90f44e6ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 01:08:40 +0200 Subject: [PATCH 37/90] Trade: use strongly typed enum for AbstractMaterialData::Type. --- src/Trade/AbstractMaterialData.cpp | 2 +- src/Trade/AbstractMaterialData.h | 3 ++- src/Trade/PhongMaterialData.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Trade/AbstractMaterialData.cpp b/src/Trade/AbstractMaterialData.cpp index 39135072c..d62afcf40 100644 --- a/src/Trade/AbstractMaterialData.cpp +++ b/src/Trade/AbstractMaterialData.cpp @@ -26,7 +26,7 @@ namespace Magnum { namespace Trade { -AbstractMaterialData::AbstractMaterialData(AbstractMaterialData::Type type): _type(type) {} +AbstractMaterialData::AbstractMaterialData(Type type): _type(type) {} AbstractMaterialData::~AbstractMaterialData() {} diff --git a/src/Trade/AbstractMaterialData.h b/src/Trade/AbstractMaterialData.h index 4c4cd9903..23654384e 100644 --- a/src/Trade/AbstractMaterialData.h +++ b/src/Trade/AbstractMaterialData.h @@ -29,6 +29,7 @@ */ #include "magnumVisibility.h" +#include "Types.h" namespace Magnum { namespace Trade { @@ -45,7 +46,7 @@ class MAGNUM_EXPORT AbstractMaterialData { public: /** @brief Material type */ - enum Type { + enum class Type: UnsignedByte { Phong /**< Phong shading */ }; diff --git a/src/Trade/PhongMaterialData.cpp b/src/Trade/PhongMaterialData.cpp index 5f640a4fa..339ced677 100644 --- a/src/Trade/PhongMaterialData.cpp +++ b/src/Trade/PhongMaterialData.cpp @@ -26,6 +26,6 @@ namespace Magnum { namespace Trade { -PhongMaterialData::PhongMaterialData(const Vector3& ambientColor, const Vector3& diffuseColor, const Vector3& specularColor, Float shininess): AbstractMaterialData(Phong), _ambientColor(ambientColor), _diffuseColor(diffuseColor), _specularColor(specularColor), _shininess(shininess) {} +PhongMaterialData::PhongMaterialData(const Vector3& ambientColor, const Vector3& diffuseColor, const Vector3& specularColor, Float shininess): AbstractMaterialData(Type::Phong), _ambientColor(ambientColor), _diffuseColor(diffuseColor), _specularColor(specularColor), _shininess(shininess) {} }} From 97b8d38e9ef7d7a79a68ec1fe02534518aeda3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 11:16:17 +0200 Subject: [PATCH 38/90] Trade: document ability to copy and move. --- src/Trade/AbstractMaterialData.h | 17 ++++++++++++----- src/Trade/MeshObjectData2D.h | 17 ++++++++++++----- src/Trade/MeshObjectData3D.h | 17 ++++++++++++----- src/Trade/ObjectData2D.cpp | 4 ++++ src/Trade/ObjectData2D.h | 17 ++++++++++++----- src/Trade/ObjectData3D.cpp | 4 ++++ src/Trade/ObjectData3D.h | 17 ++++++++++++----- src/Trade/SceneData.cpp | 4 ++++ src/Trade/SceneData.h | 17 ++++++++++++----- src/Trade/TextureData.h | 18 +++++++++++++----- 10 files changed, 97 insertions(+), 35 deletions(-) diff --git a/src/Trade/AbstractMaterialData.h b/src/Trade/AbstractMaterialData.h index 23654384e..e737c57da 100644 --- a/src/Trade/AbstractMaterialData.h +++ b/src/Trade/AbstractMaterialData.h @@ -39,11 +39,6 @@ namespace Magnum { namespace Trade { Subclasses provide access to parameters for given material type. */ class MAGNUM_EXPORT AbstractMaterialData { - AbstractMaterialData(const AbstractMaterialData&) = delete; - AbstractMaterialData(AbstractMaterialData&&) = delete; - AbstractMaterialData& operator=(const AbstractMaterialData&) = delete; - AbstractMaterialData& operator=(AbstractMaterialData&&) = delete; - public: /** @brief Material type */ enum class Type: UnsignedByte { @@ -59,6 +54,18 @@ class MAGNUM_EXPORT AbstractMaterialData { /** @brief Destructor */ virtual ~AbstractMaterialData() = 0; + /** @brief Copying is not allowed */ + AbstractMaterialData(const AbstractMaterialData&) = delete; + + /** @brief Move constructor */ + AbstractMaterialData(AbstractMaterialData&&) = default; + + /** @brief Copying is not allowed */ + AbstractMaterialData& operator=(const AbstractMaterialData&) = delete; + + /** @brief Move assignment */ + AbstractMaterialData& operator=(AbstractMaterialData&&) = default; + /** @brief Material type */ Type type() const { return _type; } diff --git a/src/Trade/MeshObjectData2D.h b/src/Trade/MeshObjectData2D.h index b250e28df..77f819b18 100644 --- a/src/Trade/MeshObjectData2D.h +++ b/src/Trade/MeshObjectData2D.h @@ -39,11 +39,6 @@ Provides access to material information for given mesh instance. @see MeshObjectData3D */ class MAGNUM_EXPORT MeshObjectData2D: public ObjectData2D { - MeshObjectData2D(const MeshObjectData2D&) = delete; - MeshObjectData2D(MeshObjectData2D&&) = delete; - MeshObjectData2D& operator=(const MeshObjectData2D&) = delete; - MeshObjectData2D& operator=(MeshObjectData2D&&) = delete; - public: /** * @brief Constructor @@ -56,6 +51,18 @@ class MAGNUM_EXPORT MeshObjectData2D: public ObjectData2D { */ explicit MeshObjectData2D(std::vector children, const Matrix3& transformation, UnsignedInt instance, UnsignedInt material); + /** @brief Copying is not allowed */ + MeshObjectData2D(const MeshObjectData2D&) = delete; + + /** @brief Move constructor */ + MeshObjectData2D(MeshObjectData2D&&) = default; + + /** @brief Copying is not allowed */ + MeshObjectData2D& operator=(const MeshObjectData2D&) = delete; + + /** @brief Move assignment */ + MeshObjectData2D& operator=(MeshObjectData2D&&) = default; + /** @brief Material ID */ UnsignedInt material() const { return _material; } diff --git a/src/Trade/MeshObjectData3D.h b/src/Trade/MeshObjectData3D.h index e29250553..1a5b820af 100644 --- a/src/Trade/MeshObjectData3D.h +++ b/src/Trade/MeshObjectData3D.h @@ -39,11 +39,6 @@ Provides access to material information for given mesh instance. @see MeshObjectData2D */ class MAGNUM_EXPORT MeshObjectData3D: public ObjectData3D { - MeshObjectData3D(const MeshObjectData3D&) = delete; - MeshObjectData3D(MeshObjectData3D&&) = delete; - MeshObjectData3D& operator=(const MeshObjectData3D&) = delete; - MeshObjectData3D& operator=(MeshObjectData3D&&) = delete; - public: /** * @brief Constructor @@ -56,6 +51,18 @@ class MAGNUM_EXPORT MeshObjectData3D: public ObjectData3D { */ explicit MeshObjectData3D(std::vector children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material); + /** @brief Copying is not allowed */ + MeshObjectData3D(const MeshObjectData3D&) = delete; + + /** @brief Move constructor */ + MeshObjectData3D(MeshObjectData3D&&) = default; + + /** @brief Copying is not allowed */ + MeshObjectData3D& operator=(const MeshObjectData3D&) = delete; + + /** @brief Move assignment */ + MeshObjectData3D& operator=(MeshObjectData3D&&) = default; + /** @brief Material ID */ UnsignedInt material() const { return _material; } diff --git a/src/Trade/ObjectData2D.cpp b/src/Trade/ObjectData2D.cpp index e4d8413b9..a9fb2e861 100644 --- a/src/Trade/ObjectData2D.cpp +++ b/src/Trade/ObjectData2D.cpp @@ -30,8 +30,12 @@ ObjectData2D::ObjectData2D(std::vector children, const Matrix3& tra ObjectData2D::ObjectData2D(std::vector children, const Matrix3& transformation): _children(children), _transformation(transformation), _instanceType(InstanceType::Empty), _instanceId(-1) {} +ObjectData2D::ObjectData2D(ObjectData2D&&) = default; + ObjectData2D::~ObjectData2D() = default; +ObjectData2D& ObjectData2D::operator=(ObjectData2D&&) = default; + #ifndef DOXYGEN_GENERATING_OUTPUT Debug operator<<(Debug debug, ObjectData2D::InstanceType value) { switch(value) { diff --git a/src/Trade/ObjectData2D.h b/src/Trade/ObjectData2D.h index ec44b0181..0ee54dd5b 100644 --- a/src/Trade/ObjectData2D.h +++ b/src/Trade/ObjectData2D.h @@ -43,11 +43,6 @@ MeshObjectData2D, which is specialized for objects with mesh instance type. @see ObjectData3D */ class MAGNUM_EXPORT ObjectData2D { - ObjectData2D(const ObjectData2D&) = delete; - ObjectData2D(ObjectData2D&&) = delete; - ObjectData2D& operator=(const ObjectData2D&) = delete; - ObjectData2D& operator=(ObjectData2D&&) = delete; - public: /** @brief Instance type */ enum class InstanceType { @@ -72,9 +67,21 @@ class MAGNUM_EXPORT ObjectData2D { */ explicit ObjectData2D(std::vector children, const Matrix3& transformation); + /** @brief Copying is not allowed */ + ObjectData2D(const ObjectData2D&) = delete; + + /** @brief Move constructor */ + ObjectData2D(ObjectData2D&&); + /** @brief Destructor */ virtual ~ObjectData2D(); + /** @brief Copying is not allowed */ + ObjectData2D& operator=(const ObjectData2D&) = delete; + + /** @brief Move assignment */ + ObjectData2D& operator=(ObjectData2D&&); + /** @brief Child objects */ std::vector& children() { return _children; } diff --git a/src/Trade/ObjectData3D.cpp b/src/Trade/ObjectData3D.cpp index 81b5e2dde..217eaee73 100644 --- a/src/Trade/ObjectData3D.cpp +++ b/src/Trade/ObjectData3D.cpp @@ -30,6 +30,10 @@ ObjectData3D::ObjectData3D(std::vector children, const Matrix4& tra ObjectData3D::ObjectData3D(std::vector children, const Matrix4& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(InstanceType::Empty), _instanceId(-1) {} +ObjectData3D::ObjectData3D(ObjectData3D&&) = default; + +ObjectData3D& ObjectData3D::operator=(ObjectData3D&&) = default; + #ifndef DOXYGEN_GENERATING_OUTPUT Debug operator<<(Debug debug, ObjectData3D::InstanceType value) { switch(value) { diff --git a/src/Trade/ObjectData3D.h b/src/Trade/ObjectData3D.h index a2ccffe21..e3ff8d821 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Trade/ObjectData3D.h @@ -43,11 +43,6 @@ MeshObjectData3D, which is specialized for objects with mesh instance type. @see ObjectData2D */ class MAGNUM_EXPORT ObjectData3D { - ObjectData3D(const ObjectData3D&) = delete; - ObjectData3D(ObjectData3D&&) = delete; - ObjectData3D& operator=(const ObjectData3D&) = delete; - ObjectData3D& operator=(ObjectData3D&&) = delete; - public: /** @brief Instance type */ enum class InstanceType { @@ -73,9 +68,21 @@ class MAGNUM_EXPORT ObjectData3D { */ explicit ObjectData3D(std::vector children, const Matrix4& transformation); + /** @brief Copying is not allowed */ + ObjectData3D(const ObjectData3D&) = delete; + + /** @brief Move constructor */ + ObjectData3D(ObjectData3D&&); + /** @brief Destructor */ virtual ~ObjectData3D() {} + /** @brief Copying is not allowed */ + ObjectData3D& operator=(const ObjectData3D&) = delete; + + /** @brief Move assignment */ + ObjectData3D& operator=(ObjectData3D&&); + /** @brief Child objects */ std::vector& children() { return _children; } diff --git a/src/Trade/SceneData.cpp b/src/Trade/SceneData.cpp index 889085bb0..5289be73e 100644 --- a/src/Trade/SceneData.cpp +++ b/src/Trade/SceneData.cpp @@ -28,4 +28,8 @@ namespace Magnum { namespace Trade { SceneData::SceneData(std::vector children2D, std::vector children3D): _children2D(std::move(children2D)), _children3D(std::move(children3D)) {} +SceneData::SceneData(SceneData&&) = default; + +SceneData& SceneData::operator=(SceneData&&) = default; + }} diff --git a/src/Trade/SceneData.h b/src/Trade/SceneData.h index ba81ff8c8..2a2a5d7fa 100644 --- a/src/Trade/SceneData.h +++ b/src/Trade/SceneData.h @@ -40,11 +40,6 @@ namespace Magnum { namespace Trade { @brief %Scene data */ class MAGNUM_EXPORT SceneData { - SceneData(const SceneData&) = delete; - SceneData(SceneData&&) = delete; - SceneData& operator=(const SceneData&) = delete; - SceneData& operator=(SceneData&&) = delete; - public: /** * @brief Constructor @@ -53,6 +48,18 @@ class MAGNUM_EXPORT SceneData { */ explicit SceneData(std::vector children2D, std::vector children3D); + /** @brief Copying is not allowed */ + SceneData(const SceneData&) = delete; + + /** @brief Move constructor */ + SceneData(SceneData&&); + + /** @brief Copying is not allowed */ + SceneData& operator=(const SceneData&) = delete; + + /** @brief Move assignment */ + SceneData& operator=(SceneData&&); + /** @brief Two-dimensional child objects */ const std::vector& children2D() const { return _children2D; } diff --git a/src/Trade/TextureData.h b/src/Trade/TextureData.h index 870ab392d..996198c42 100644 --- a/src/Trade/TextureData.h +++ b/src/Trade/TextureData.h @@ -33,11 +33,19 @@ namespace Magnum { namespace Trade { /** @brief %Texture data */ -class MAGNUM_EXPORT TextureData { - TextureData(const TextureData&) = delete; - TextureData(TextureData&&) = delete; - TextureData& operator=(const TextureData&) = delete; - TextureData& operator=(TextureData&&) = delete; +class TextureData { + public: + /** @brief Copying is not allowed */ + TextureData(const TextureData&) = delete; + + /** @brief Move constructor */ + TextureData(TextureData&&) = default; + + /** @brief Copying is not allowed */ + TextureData& operator=(const TextureData&) = delete; + + /** @brief Move assignment */ + TextureData& operator=(TextureData&&) = default; }; }} From 9875f49a99161eaea8e07f66c40e845263057bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 11:25:26 +0200 Subject: [PATCH 39/90] Trade: properly specify underlying enum type. --- src/Trade/ObjectData2D.h | 2 +- src/Trade/ObjectData3D.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Trade/ObjectData2D.h b/src/Trade/ObjectData2D.h index 0ee54dd5b..7bdae6f1c 100644 --- a/src/Trade/ObjectData2D.h +++ b/src/Trade/ObjectData2D.h @@ -45,7 +45,7 @@ MeshObjectData2D, which is specialized for objects with mesh instance type. class MAGNUM_EXPORT ObjectData2D { public: /** @brief Instance type */ - enum class InstanceType { + enum class InstanceType: UnsignedByte { Camera, /**< Camera instance (see CameraData) */ Mesh, /**< Three-dimensional mesh instance (see MeshData2D) */ Empty /**< Empty */ diff --git a/src/Trade/ObjectData3D.h b/src/Trade/ObjectData3D.h index e3ff8d821..12e5388d4 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Trade/ObjectData3D.h @@ -45,7 +45,7 @@ MeshObjectData3D, which is specialized for objects with mesh instance type. class MAGNUM_EXPORT ObjectData3D { public: /** @brief Instance type */ - enum class InstanceType { + enum class InstanceType: UnsignedByte { Camera, /**< Camera instance (see CameraData) */ Light, /**< Light instance (see LightData) */ Mesh, /**< Three-dimensional mesh instance (see MeshData3D) */ From 5b842d11a3929f638f632d743187c046d4404418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 11:26:06 +0200 Subject: [PATCH 40/90] Trade: de-inline virtual destructor. Less generated code. --- src/Trade/ObjectData3D.cpp | 2 ++ src/Trade/ObjectData3D.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Trade/ObjectData3D.cpp b/src/Trade/ObjectData3D.cpp index 217eaee73..f12fa9206 100644 --- a/src/Trade/ObjectData3D.cpp +++ b/src/Trade/ObjectData3D.cpp @@ -32,6 +32,8 @@ ObjectData3D::ObjectData3D(std::vector children, const Matrix4& tra ObjectData3D::ObjectData3D(ObjectData3D&&) = default; +ObjectData3D::~ObjectData3D() = default; + ObjectData3D& ObjectData3D::operator=(ObjectData3D&&) = default; #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/Trade/ObjectData3D.h b/src/Trade/ObjectData3D.h index 12e5388d4..0f296fc14 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Trade/ObjectData3D.h @@ -75,7 +75,7 @@ class MAGNUM_EXPORT ObjectData3D { ObjectData3D(ObjectData3D&&); /** @brief Destructor */ - virtual ~ObjectData3D() {} + virtual ~ObjectData3D(); /** @brief Copying is not allowed */ ObjectData3D& operator=(const ObjectData3D&) = delete; From dcebf1a7b9de7afe251d0309b116bf1ca8b40d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 00:30:52 +0200 Subject: [PATCH 41/90] Trade: added TextureData parameters. Not adding border color (yet), as it is not supported in ES. --- src/Trade/TextureData.h | 59 +++++++++++++++++++++++++++++++++++++++++ src/Trade/Trade.h | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/Trade/TextureData.h b/src/Trade/TextureData.h index 996198c42..faa98a31a 100644 --- a/src/Trade/TextureData.h +++ b/src/Trade/TextureData.h @@ -28,6 +28,9 @@ * @brief Class Magnum::Trade::TextureData */ +#include "Array.h" +#include "Sampler.h" + namespace Magnum { namespace Trade { /** @@ -35,6 +38,29 @@ namespace Magnum { namespace Trade { */ class TextureData { public: + /** + * @brief Texture type + * + * @see type() + */ + enum class Type: UnsignedByte { + Texture1D, /**< One-dimensional texture */ + Texture2D, /**< Two-dimensional texture */ + Texture3D, /**< Three-dimensional texture */ + Cube, /**< Cube map texture */ + }; + + /** + * @brief Constructor + * @param type Texture type + * @param minificationFilter Minification filter + * @param magnificationFilter Magnification filter + * @param mipmapFilter Mipmap filter + * @param wrapping Wrapping + * @param image Texture image ID + */ + TextureData(Type type, Sampler::Filter minificationFilter, Sampler::Filter magnificationFilter, Sampler::Mipmap mipmapFilter, Array3D wrapping, UnsignedInt image): _type(type), _minificationFilter(minificationFilter), _magnificationFilter(magnificationFilter), _mipmapFilter(mipmapFilter), _wrapping(wrapping), _image(image) {} + /** @brief Copying is not allowed */ TextureData(const TextureData&) = delete; @@ -46,6 +72,39 @@ class TextureData { /** @brief Move assignment */ TextureData& operator=(TextureData&&) = default; + + /** @brief Texture type */ + Type type() const { return _type; } + + /** @brief Minification filter */ + Sampler::Filter minificationFilter() const { return _minificationFilter; } + + /** @brief Magnification filter */ + Sampler::Filter magnificationFilter() const { return _magnificationFilter; } + + /** @brief Mipmap filter */ + Sampler::Mipmap mipmapFilter() const { return _mipmapFilter; } + + /** @brief Wrapping */ + Array3D wrapping() const { return _wrapping; } + + /** + * @brief Image ID + * + * ID of 1D, 2D or 3D image based on texture type. If type is + * @ref Type "Type::Cube" the function returns first of six consecutive + * IDs of cube map sides, ordered +X, -X, +Y, -Y, +Z, -Z. + * @see @ref type(), @ref AbstractImporter::image1D(), + * @ref AbstractImporter::image2D(), @ref AbstractImporter::image3D() + */ + UnsignedInt image() const { return _image; } + + private: + Type _type; + Sampler::Filter _minificationFilter, _magnificationFilter; + Sampler::Mipmap _mipmapFilter; + Array3D _wrapping; + UnsignedInt _image; }; }} diff --git a/src/Trade/Trade.h b/src/Trade/Trade.h index a12b47f79..ba82c7a97 100644 --- a/src/Trade/Trade.h +++ b/src/Trade/Trade.h @@ -52,8 +52,8 @@ class MeshObjectData3D; class ObjectData2D; class ObjectData3D; class PhongMaterialData; -class SceneData; class TextureData; +class SceneData; #endif }} From e62afc1b6ce3d3467e18c55f333ea34c760f736e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 12:08:43 +0200 Subject: [PATCH 42/90] Trade: ability to have either color or texture in PhongMaterialData. --- src/Trade/PhongMaterialData.cpp | 30 ++++++- src/Trade/PhongMaterialData.h | 137 ++++++++++++++++++++++++++++---- 2 files changed, 152 insertions(+), 15 deletions(-) diff --git a/src/Trade/PhongMaterialData.cpp b/src/Trade/PhongMaterialData.cpp index 339ced677..04c3bd749 100644 --- a/src/Trade/PhongMaterialData.cpp +++ b/src/Trade/PhongMaterialData.cpp @@ -26,6 +26,34 @@ namespace Magnum { namespace Trade { -PhongMaterialData::PhongMaterialData(const Vector3& ambientColor, const Vector3& diffuseColor, const Vector3& specularColor, Float shininess): AbstractMaterialData(Type::Phong), _ambientColor(ambientColor), _diffuseColor(diffuseColor), _specularColor(specularColor), _shininess(shininess) {} +Vector3& PhongMaterialData::ambientColor() { + CORRADE_ASSERT(!(_flags & Flag::AmbientTexture), "Trade::PhongMaterialData::ambientColor(): the material has ambient texture", _ambient.color); + return _ambient.color; +} + +UnsignedInt& PhongMaterialData::ambientTexture() { + CORRADE_ASSERT(_flags & Flag::AmbientTexture, "Trade::PhongMaterialData::ambientTexture(): the material doesn't have ambient texture", _ambient.texture); + return _ambient.texture; +} + +Vector3& PhongMaterialData::diffuseColor() { + CORRADE_ASSERT(!(_flags & Flag::DiffuseTexture), "Trade::PhongMaterialData::diffuseColor(): the material has diffuse texture", _diffuse.color); + return _diffuse.color; +} + +UnsignedInt& PhongMaterialData::diffuseTexture() { + CORRADE_ASSERT(_flags & Flag::DiffuseTexture, "Trade::PhongMaterialData::diffuseTexture(): the material doesn't have diffuse texture", _diffuse.texture); + return _diffuse.texture; +} + +Vector3& PhongMaterialData::specularColor() { + CORRADE_ASSERT(!(_flags & Flag::SpecularTexture), "Trade::PhongMaterialData::specularColor(): the material has specular texture", _specular.color); + return _specular.color; +} + +UnsignedInt& PhongMaterialData::specularTexture() { + CORRADE_ASSERT(_flags & Flag::SpecularTexture, "Trade::PhongMaterialData::specularTexture(): the material doesn't have specular texture", _specular.texture); + return _specular.texture; +} }} diff --git a/src/Trade/PhongMaterialData.h b/src/Trade/PhongMaterialData.h index d648c51ee..92ef09a49 100644 --- a/src/Trade/PhongMaterialData.h +++ b/src/Trade/PhongMaterialData.h @@ -39,34 +39,143 @@ namespace Magnum { namespace Trade { */ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData { public: + enum: UnsignedInt { + AmbientTextureID = 0, /**< Ambient texture ID for mapping with texture coordinates */ + DiffuseTextureID = 1, /**< Diffuse texture ID for mapping with texture coordinates */ + SpecularTextureID = 3 /**< Specular texture ID for mapping with texture coordinates */ + }; + + /** + * @brief Material flag + * + * @see @ref Flags, @ref flags() + */ + enum class Flag: UnsignedByte { + AmbientTexture = 1 << 0, /**< The material has ambient texture instead of color */ + DiffuseTexture = 1 << 1, /**< The material has diffuse texture instead of color */ + SpecularTexture = 1 << 2 /**< The material has specular texture instead of color */ + }; + + /** + * @brief Material flags + * + * @see @ref flags() + */ + typedef Containers::EnumSet Flags; + /** * @brief Constructor - * @param ambientColor Ambient color - * @param diffuseColor Diffuse color - * @param specularColor Specular color - * @param shininess Shininess + * @param flags Material flags + * @param shininess Shininess + * + * Colors and textures should be specified using member functions based + * on what flags are set. */ - explicit PhongMaterialData(const Vector3& ambientColor, const Vector3& diffuseColor, const Vector3& specularColor, Float shininess); + explicit PhongMaterialData(Flags flags, Float shininess): AbstractMaterialData(Type::Phong), _shininess(shininess), _flags(flags) {} - /** @brief Ambient color */ - Vector3 ambientColor() const { return _ambientColor; } + /** @brief Material flags */ + Flags flags() const { return _flags; } - /** @brief Diffuse color */ - Vector3 diffuseColor() const { return _diffuseColor; } + /** + * @brief Ambient color + * + * Available only if the material doesn't have @ref Flag "Flag::AmbientTexture". + * @see @ref flags() + */ + Vector3& ambientColor(); + Vector3 ambientColor() const; /**< @overload */ - /** @brief Specular color */ - Vector3 specularColor() const { return _specularColor; } + /** + * @brief Ambient texture ID + * + * Available only if the material has @ref Flag "Flag::AmbientTexture". + * @see @ref flags(), @ref AbstractImporter::texture() + */ + UnsignedInt& ambientTexture(); + UnsignedInt ambientTexture() const; /**< @overload */ + + /** + * @brief Diffuse color + * + * Available only if the material doesn't have @ref Flag "Flag::DiffuseTexture". + * @see @ref flags() + */ + Vector3& diffuseColor(); + Vector3 diffuseColor() const; /**< @overload */ + + /** + * @brief Diffuse texture ID + * + * Available only if the material has @ref Flag "Flag::DiffuseTexture". + * @see @ref flags(), @ref AbstractImporter::texture() + */ + UnsignedInt& diffuseTexture(); + UnsignedInt diffuseTexture() const; /**< @overload */ + + /** + * @brief Specular color + * + * Available only if the material doesn't have @ref Flag "Flag::SpecularTexture". + * @see @ref flags() + */ + Vector3& specularColor(); + Vector3 specularColor() const; /**< @overload */ + + /** + * @brief Specular texture ID + * + * Available only if the material has @ref Flag "Flag::SpecularTexture". + * @see @ref flags(), @ref AbstractImporter::texture() + */ + UnsignedInt& specularTexture(); + UnsignedInt specularTexture() const; /**< @overload */ /** @brief Shininess */ Float shininess() const { return _shininess; } private: - Vector3 _ambientColor, - _diffuseColor, - _specularColor; + union Source { + Source() {} + + Vector3 color; + UnsignedInt texture; + }; + + Source _ambient, + _diffuse, + _specular; Float _shininess; + Flags _flags; }; +CORRADE_ENUMSET_OPERATORS(PhongMaterialData::Flags) + +/* Ugly as hell. */ + +inline Vector3 PhongMaterialData::ambientColor() const { + return const_cast(this)->ambientColor(); +} + +inline UnsignedInt PhongMaterialData::ambientTexture() const { + return const_cast(this)->ambientTexture(); +} + +inline Vector3 PhongMaterialData::diffuseColor() const { + return const_cast(this)->diffuseColor(); +} + +inline UnsignedInt PhongMaterialData::diffuseTexture() const { + return const_cast(this)->diffuseTexture(); +} + +inline Vector3 PhongMaterialData::specularColor() const { + return const_cast(this)->specularColor(); +} + +inline UnsignedInt PhongMaterialData::specularTexture() const { + return const_cast(this)->specularTexture(); +} + }} #endif From 105dbc90e9417b97b7b3f91b1960b15f00054a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 12:15:34 +0200 Subject: [PATCH 43/90] Trade: move the data instead of copying. --- src/Trade/MeshObjectData3D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Trade/MeshObjectData3D.cpp b/src/Trade/MeshObjectData3D.cpp index dfd6e766b..905c628e4 100644 --- a/src/Trade/MeshObjectData3D.cpp +++ b/src/Trade/MeshObjectData3D.cpp @@ -26,6 +26,6 @@ namespace Magnum { namespace Trade { -MeshObjectData3D::MeshObjectData3D(std::vector< UnsignedInt > children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material): ObjectData3D(children, transformation, InstanceType::Mesh, instance), _material(material) {} +MeshObjectData3D::MeshObjectData3D(std::vector children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material): ObjectData3D(std::move(children), transformation, InstanceType::Mesh, instance), _material(material) {} }} From e8e0582e516206c3b6fedd358d226c713a3d4420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 26 Jul 2013 12:18:49 +0200 Subject: [PATCH 44/90] Debug output operators for Sampler enums. --- src/Sampler.cpp | 43 ++++++++++++++++++++++++ src/Sampler.h | 12 ++++++- src/Test/CMakeLists.txt | 1 + src/Test/SamplerTest.cpp | 70 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 src/Test/SamplerTest.cpp diff --git a/src/Sampler.cpp b/src/Sampler.cpp index 43160854e..0d1c5bb4e 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -24,6 +24,8 @@ #include "Sampler.h" +#include + #include "Context.h" #include "Implementation/State.h" #include "Implementation/TextureState.h" @@ -58,4 +60,45 @@ Float Sampler::maxSupportedAnisotropy() { } #endif +Debug operator<<(Debug debug, const Sampler::Filter value) { + switch(value) { + #define _c(value) case Sampler::Filter::value: return debug << "Sampler::Filter::" #value; + _c(Nearest) + _c(Linear) + #undef _c + } + + return debug << "Sampler::Filter::(invalid)"; +} + +Debug operator<<(Debug debug, const Sampler::Mipmap value) { + switch(value) { + #define _c(value) case Sampler::Mipmap::value: return debug << "Sampler::Mipmap::" #value; + _c(Base) + _c(Nearest) + _c(Linear) + #undef _c + } + + return debug << "Sampler::Mipmap::(invalid)"; +} + +Debug operator<<(Debug debug, const Sampler::Wrapping value) { + switch(value) { + #define _c(value) case Sampler::Wrapping::value: return debug << "Sampler::Wrapping::" #value; + _c(Repeat) + _c(MirroredRepeat) + _c(ClampToEdge) + #ifndef MAGNUM_TARGET_GLES3 + _c(ClampToBorder) + #endif + #ifndef MAGNUM_TARGET_GLES + _c(MirrorClampToEdge) + #endif + #undef _c + } + + return debug << "Sampler::Wrapping::(invalid)"; +} + } diff --git a/src/Sampler.h b/src/Sampler.h index 0c771b4f1..54780efd4 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -28,8 +28,9 @@ * @brief Class Magnum::Sampler */ -#include "Types.h" +#include "Magnum.h" #include "OpenGL.h" +#include "magnumVisibility.h" namespace Magnum { @@ -147,6 +148,15 @@ class Sampler { #endif }; +/** @debugoperator{Magnum::Sampler} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Filter value); + +/** @debugoperator{Magnum::Sampler} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Mipmap value); + +/** @debugoperator{Magnum::Sampler} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, Sampler::Wrapping value); + } #endif diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index ca308059b..89f08d701 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -32,6 +32,7 @@ corrade_add_test(ImageTest ImageTest.cpp LIBRARIES Magnum) corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum) corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum) corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES MagnumTestLib) +corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum) corrade_add_test(SwizzleTest SwizzleTest.cpp LIBRARIES MagnumMathTestLib) if(BUILD_GL_TESTS) diff --git a/src/Test/SamplerTest.cpp b/src/Test/SamplerTest.cpp new file mode 100644 index 000000000..961b16f1c --- /dev/null +++ b/src/Test/SamplerTest.cpp @@ -0,0 +1,70 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "Sampler.h" + +namespace Magnum { namespace Test { + +class SamplerTest: public TestSuite::Tester { + public: + explicit SamplerTest(); + + void debugFilter(); + void debugMipmap(); + void debugWrapping(); +}; + +SamplerTest::SamplerTest() { + addTests({&SamplerTest::debugFilter, + &SamplerTest::debugMipmap, + &SamplerTest::debugWrapping}); +} + +void SamplerTest::debugFilter() { + std::ostringstream out; + + Debug(&out) << Sampler::Filter::Linear; + CORRADE_COMPARE(out.str(), "Sampler::Filter::Linear\n"); +} + +void SamplerTest::debugMipmap() { + std::ostringstream out; + + Debug(&out) << Sampler::Mipmap::Base; + CORRADE_COMPARE(out.str(), "Sampler::Mipmap::Base\n"); +} + +void SamplerTest::debugWrapping() { + std::ostringstream out; + + Debug(&out) << Sampler::Wrapping::ClampToEdge; + CORRADE_COMPARE(out.str(), "Sampler::Wrapping::ClampToEdge\n"); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::SamplerTest) From b937c2bf4e7e39d29dccadaf74c1cfc1daed4d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 26 Jul 2013 12:19:49 +0200 Subject: [PATCH 45/90] Trade: debug output operator for AbstractMaterialData::Type enum. --- src/Trade/AbstractMaterialData.cpp | 12 +++++ src/Trade/AbstractMaterialData.h | 5 +- src/Trade/Test/AbstractMaterialDataTest.cpp | 52 +++++++++++++++++++++ src/Trade/Test/CMakeLists.txt | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/Trade/Test/AbstractMaterialDataTest.cpp diff --git a/src/Trade/AbstractMaterialData.cpp b/src/Trade/AbstractMaterialData.cpp index d62afcf40..7df183d61 100644 --- a/src/Trade/AbstractMaterialData.cpp +++ b/src/Trade/AbstractMaterialData.cpp @@ -24,10 +24,22 @@ #include "AbstractMaterialData.h" +#include + namespace Magnum { namespace Trade { AbstractMaterialData::AbstractMaterialData(Type type): _type(type) {} AbstractMaterialData::~AbstractMaterialData() {} +Debug operator<<(Debug debug, const AbstractMaterialData::Type value) { + switch(value) { + #define _c(value) case AbstractMaterialData::Type::value: return debug << "Trade::AbstractMaterialData::Type::" #value; + _c(Phong) + #undef _c + } + + return debug << "Trade::AbstractMaterialData::Type::(unknown)"; +} + }} diff --git a/src/Trade/AbstractMaterialData.h b/src/Trade/AbstractMaterialData.h index e737c57da..2cf22eddf 100644 --- a/src/Trade/AbstractMaterialData.h +++ b/src/Trade/AbstractMaterialData.h @@ -29,7 +29,7 @@ */ #include "magnumVisibility.h" -#include "Types.h" +#include "Magnum.h" namespace Magnum { namespace Trade { @@ -73,6 +73,9 @@ class MAGNUM_EXPORT AbstractMaterialData { Type _type; }; +/** @debugoperator{Magnum::Trade::AbstractMaterialData} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, AbstractMaterialData::Type value); + }} #endif diff --git a/src/Trade/Test/AbstractMaterialDataTest.cpp b/src/Trade/Test/AbstractMaterialDataTest.cpp new file mode 100644 index 000000000..be2ab6ec8 --- /dev/null +++ b/src/Trade/Test/AbstractMaterialDataTest.cpp @@ -0,0 +1,52 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "Trade/AbstractMaterialData.h" + +namespace Magnum { namespace Trade { namespace Test { + +class AbstractMaterialDataTest: public TestSuite::Tester { + public: + explicit AbstractMaterialDataTest(); + + void debug(); +}; + +AbstractMaterialDataTest::AbstractMaterialDataTest() { + addTests({&AbstractMaterialDataTest::debug}); +} + +void AbstractMaterialDataTest::debug() { + std::ostringstream out; + + Debug(&out) << AbstractMaterialData::Type::Phong; + CORRADE_COMPARE(out.str(), "Trade::AbstractMaterialData::Type::Phong\n"); +} + +}}} + +CORRADE_TEST_MAIN(Magnum::Trade::Test::AbstractMaterialDataTest) diff --git a/src/Trade/Test/CMakeLists.txt b/src/Trade/Test/CMakeLists.txt index beb1c2ccf..9efdaffeb 100644 --- a/src/Trade/Test/CMakeLists.txt +++ b/src/Trade/Test/CMakeLists.txt @@ -29,6 +29,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) corrade_add_test(TradeAbstractImageConverterTest AbstractImageConverterTest.cpp LIBRARIES Magnum) corrade_add_test(TradeAbstractImporterTest AbstractImporterTest.cpp LIBRARIES Magnum) +corrade_add_test(TradeAbstractMaterialDataTest AbstractMaterialDataTest.cpp LIBRARIES Magnum) corrade_add_test(TradeImageDataTest ImageDataTest.cpp LIBRARIES Magnum) corrade_add_test(TradeObjectData2DTest ObjectData2DTest.cpp LIBRARIES Magnum) corrade_add_test(TradeObjectData3DTest ObjectData3DTest.cpp LIBRARIES Magnum) From 50ef1df21345c961adf8d7d326b16935b90d4dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 26 Jul 2013 12:22:19 +0200 Subject: [PATCH 46/90] Trade: debug output operator for TextureData::Type enum. --- src/CMakeLists.txt | 3 +- src/Trade/Test/CMakeLists.txt | 1 + src/Trade/Test/TextureDataTest.cpp | 52 ++++++++++++++++++++++++++++++ src/Trade/TextureData.cpp | 42 ++++++++++++++++++++++++ src/Trade/TextureData.h | 4 +++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 src/Trade/Test/TextureDataTest.cpp create mode 100644 src/Trade/TextureData.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cee41dec2..bb6c8fb12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,7 +81,8 @@ set(Magnum_SRCS Trade/ObjectData2D.cpp Trade/ObjectData3D.cpp Trade/PhongMaterialData.cpp - Trade/SceneData.cpp) + Trade/SceneData.cpp + Trade/TextureData.cpp) # Desktop-only code if(NOT TARGET_GLES) diff --git a/src/Trade/Test/CMakeLists.txt b/src/Trade/Test/CMakeLists.txt index 9efdaffeb..d1a162e92 100644 --- a/src/Trade/Test/CMakeLists.txt +++ b/src/Trade/Test/CMakeLists.txt @@ -33,3 +33,4 @@ corrade_add_test(TradeAbstractMaterialDataTest AbstractMaterialDataTest.cpp LIBR corrade_add_test(TradeImageDataTest ImageDataTest.cpp LIBRARIES Magnum) corrade_add_test(TradeObjectData2DTest ObjectData2DTest.cpp LIBRARIES Magnum) corrade_add_test(TradeObjectData3DTest ObjectData3DTest.cpp LIBRARIES Magnum) +corrade_add_test(TradeTextureDataTest TextureDataTest.cpp LIBRARIES Magnum) diff --git a/src/Trade/Test/TextureDataTest.cpp b/src/Trade/Test/TextureDataTest.cpp new file mode 100644 index 000000000..3fb83bd70 --- /dev/null +++ b/src/Trade/Test/TextureDataTest.cpp @@ -0,0 +1,52 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "Trade/TextureData.h" + +namespace Magnum { namespace Trade { namespace Test { + +class TextureDataTest: public TestSuite::Tester { + public: + explicit TextureDataTest(); + + void debug(); +}; + +TextureDataTest::TextureDataTest() { + addTests({&TextureDataTest::debug}); +} + +void TextureDataTest::debug() { + std::ostringstream out; + + Debug(&out) << TextureData::Type::Texture3D; + CORRADE_COMPARE(out.str(), "Trade::TextureData::Type::Texture3D\n"); +} + +}}} + +CORRADE_TEST_MAIN(Magnum::Trade::Test::TextureDataTest) diff --git a/src/Trade/TextureData.cpp b/src/Trade/TextureData.cpp new file mode 100644 index 000000000..96da87c2d --- /dev/null +++ b/src/Trade/TextureData.cpp @@ -0,0 +1,42 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "TextureData.h" + +namespace Magnum { namespace Trade { + +Debug operator<<(Debug debug, const TextureData::Type value) { + switch(value) { + #define _c(value) case TextureData::Type::value: return debug << "Trade::TextureData::Type::" #value; + _c(Texture1D) + _c(Texture2D) + _c(Texture3D) + _c(Cube) + #undef _c + } + + return debug << "Trade::TextureData::Type::(unknown)"; +} + +}} diff --git a/src/Trade/TextureData.h b/src/Trade/TextureData.h index faa98a31a..8a9bcd3fc 100644 --- a/src/Trade/TextureData.h +++ b/src/Trade/TextureData.h @@ -30,6 +30,7 @@ #include "Array.h" #include "Sampler.h" +#include "magnumVisibility.h" namespace Magnum { namespace Trade { @@ -107,6 +108,9 @@ class TextureData { UnsignedInt _image; }; +/** @debugoperator{Magnum::Trade::TextureData} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, TextureData::Type value); + }} #endif From 450975be510732b8528338bfa75bbd2d5146c251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 14:59:37 +0200 Subject: [PATCH 47/90] Added Tegra best practices to documentation. --- doc/best-practices.dox | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/best-practices.dox b/doc/best-practices.dox index 6dba060be..5e5c31ca1 100644 --- a/doc/best-practices.dox +++ b/doc/best-practices.dox @@ -69,5 +69,9 @@ vertex and index buffers. - [PowerVR Performance Recommendations](http://www.imgtec.com/powervr/insider/docs/PowerVR.Performance%20Recommendations.1.0.28.External.pdf) [PDF] +@subsection best-practices-tegra NVidia Tegra hardware + +- [Optimize OpenGL ES 2.0 Performance for Tegra](http://docs.nvidia.com/tegra/data/Optimize_OpenGL_ES_2_0_Performance_for_Tegra.html) + */ } From b349ca54ad33071d3c83581fb39a7e8a406a2944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 15:00:28 +0200 Subject: [PATCH 48/90] Shaders: explicitly setting normal matrix in Phong shader. Currently the most used scene graph transformation implementation are dual quaternions, which don't allow any scaling. The original code normalized the rotation matrix, involving three dot products and one sqrt, even if it wasn't needed in most cases -- even if using scene graph with matrices mostly you don't scale at all and thus the shader internally renormalized already normalized vectors for _each object_ in each frame. This _will_ break things, don't forget to update the code and call `setNormalMatrix()` along with `setTransformationMatrix()`. --- src/Shaders/Phong.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Shaders/Phong.h b/src/Shaders/Phong.h index f153dc761..417611152 100644 --- a/src/Shaders/Phong.h +++ b/src/Shaders/Phong.h @@ -93,12 +93,20 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { } /** - * @brief Set transformation and normal matrix + * @brief Set transformation matrix * @return Pointer to self (for method chaining) */ Phong* setTransformationMatrix(const Matrix4& matrix) { setUniform(transformationMatrixUniform, matrix); - setUniform(normalMatrixUniform, matrix.rotation()); + return this; + } + + /** + * @brief Set normal matrix + * @return Pointer to self (for method chaining) + */ + Phong* setNormalMatrix(const Math::Matrix<3, Float>& matrix) { + setUniform(normalMatrixUniform, matrix); return this; } From 20dcab0c88ced65093dd3a56cddf1352a5abf2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 16:30:05 +0200 Subject: [PATCH 49/90] Math: added Matrix[34]::rotationNormalized(). Useful to pass normal matrices to shader, namely with recent commit b349ca54ad33071d3c83581fb39a7e8a406a2944. --- src/Math/Matrix3.h | 24 ++++++++++++++++++++---- src/Math/Matrix4.h | 25 +++++++++++++++++++++---- src/Math/Test/Matrix3Test.cpp | 20 ++++++++++++++++++++ src/Math/Test/Matrix4Test.cpp | 22 ++++++++++++++++++++++ 4 files changed, 83 insertions(+), 8 deletions(-) diff --git a/src/Math/Matrix3.h b/src/Math/Matrix3.h index ae49a62b9..d977a79c1 100644 --- a/src/Math/Matrix3.h +++ b/src/Math/Matrix3.h @@ -163,20 +163,36 @@ template class Matrix3: public Matrix<3, T> { * @brief 2D rotation and scaling part of the matrix * * Upper-left 2x2 part of the matrix. - * @see from(const Matrix<2, T>&, const Vector2&), rotation() const, - * rotation(T), Matrix4::rotationScaling() const - * @todo extract rotation with assert for no scaling + * @see from(const Matrix<2, T>&, const Vector2&), rotation() const + * rotationNormalized(), rotation(T), + * Matrix4::rotationScaling() const */ constexpr Matrix<2, T> rotationScaling() const { return {(*this)[0].xy(), (*this)[1].xy()}; } + /** + * @brief 2D rotation part of the matrix assuming there is no scaling + * + * Similar to @ref rotationScaling(), but additionally checks that the + * base vectors are normalized. + * @see rotation() const, @ref Matrix4::rotationNormalized() + * @todo assert also orthogonality or this is good enough? + */ + Matrix<2, T> rotationNormalized() const { + CORRADE_ASSERT((*this)[0].xy().isNormalized() && (*this)[1].xy().isNormalized(), + "Math::Matrix3::rotationNormalized(): the rotation part is not normalized", {}); + return {(*this)[0].xy(), + (*this)[1].xy()}; + } + /** * @brief 2D rotation part of the matrix * * Normalized upper-left 2x2 part of the matrix. - * @see rotationScaling() const, rotation(T), Matrix4::rotation() const + * @see rotationNormalized(), rotationScaling() const, rotation(T), + * Matrix4::rotation() const * @todo assert uniform scaling (otherwise this would be garbage) */ Matrix<2, T> rotation() const { diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 23028357d..dec15dbfc 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -227,8 +227,8 @@ template class Matrix4: public Matrix<4, T> { * * Upper-left 3x3 part of the matrix. * @see from(const Matrix<3, T>&, const Vector3&), rotation() const, - * rotation(T, const Vector3&), Matrix3::rotationScaling() const - * @todo extract rotation with assert for no scaling + * rotationNormalized(), rotation(T, const Vector3&), + * Matrix3::rotationScaling() const */ /* Not Matrix3, because it is for affine 2D transformations */ constexpr Matrix<3, T> rotationScaling() const { @@ -237,12 +237,29 @@ template class Matrix4: public Matrix<4, T> { (*this)[2].xyz()}; } + /** + * @brief 3D rotation part of the matrix assuming there is no scaling + * + * Similar to @ref rotationScaling(), but additionally checks that the + * base vectors are normalized. + * @see rotation() const, @ref Matrix3::rotationNormalized() + * @todo assert also orthogonality or this is good enough? + */ + /* Not Matrix3, because it is for affine 2D transformations */ + Matrix<3, T> rotationNormalized() const { + CORRADE_ASSERT((*this)[0].xyz().isNormalized() && (*this)[1].xyz().isNormalized() && (*this)[2].xyz().isNormalized(), + "Math::Matrix4::rotationNormalized(): the rotation part is not normalized", {}); + return {(*this)[0].xyz(), + (*this)[1].xyz(), + (*this)[2].xyz()}; + } + /** * @brief 3D rotation part of the matrix * * Normalized upper-left 3x3 part of the matrix. - * @see rotationScaling() const, rotation(T, const Vector3&), - * Matrix3::rotation() const + * @see rotationNormalized(), rotationScaling() const, + * rotation(T, const Vector3&), Matrix3::rotation() const * @todo assert uniform scaling (otherwise this would be garbage) */ /* Not Matrix3, because it is for affine 2D transformations */ diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index 7546434ca..e7884f2b5 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -76,6 +76,7 @@ class Matrix3Test: public Corrade::TestSuite::Tester { void projection(); void fromParts(); void rotationScalingPart(); + void rotationNormalizedPart(); void rotationPart(); void vectorParts(); void invertedRigid(); @@ -110,6 +111,7 @@ Matrix3Test::Matrix3Test() { &Matrix3Test::projection, &Matrix3Test::fromParts, &Matrix3Test::rotationScalingPart, + &Matrix3Test::rotationNormalizedPart, &Matrix3Test::rotationPart, &Matrix3Test::vectorParts, &Matrix3Test::invertedRigid, @@ -285,6 +287,24 @@ void Matrix3Test::rotationScalingPart() { Vector2(4.0f, 4.0f))); } +void Matrix3Test::rotationNormalizedPart() { + std::ostringstream o; + Error::setOutput(&o); + + Matrix3 a({1.0f, 0.0f, 8.0f}, + {1.0f, 0.1f, 7.0f}, + {7.0f, -1.0f, 8.0f}); + a.rotationNormalized(); + + CORRADE_COMPARE(o.str(), "Math::Matrix3::rotationNormalized(): the rotation part is not normalized\n"); + + Matrix3 b({ 0.965926f, 0.258819f, 1.0f}, + {-0.258819f, 0.965926f, 3.0f}, + { 0.0f, 0.0f, 1.0f}); + CORRADE_COMPARE(b.rotationNormalized(), Matrix2(Vector2( 0.965926f, 0.258819f), + Vector2(-0.258819f, 0.965926f))); +} + void Matrix3Test::rotationPart() { Matrix3 rotation = Matrix3::rotation(Deg(15.0f)); Matrix2 expectedRotationPart(Vector2( 0.965926f, 0.258819f), diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index d5bbfa70b..1f05a383f 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -83,6 +83,7 @@ class Matrix4Test: public Corrade::TestSuite::Tester { void perspectiveProjectionFov(); void fromParts(); void rotationScalingPart(); + void rotationNormalizedPart(); void rotationPart(); void vectorParts(); void invertedRigid(); @@ -122,6 +123,7 @@ Matrix4Test::Matrix4Test() { &Matrix4Test::perspectiveProjectionFov, &Matrix4Test::fromParts, &Matrix4Test::rotationScalingPart, + &Matrix4Test::rotationNormalizedPart, &Matrix4Test::rotationPart, &Matrix4Test::vectorParts, &Matrix4Test::invertedRigid, @@ -368,6 +370,26 @@ void Matrix4Test::rotationScalingPart() { Vector3(7.0f, -1.0f, 8.0f))); } +void Matrix4Test::rotationNormalizedPart() { + std::ostringstream o; + Error::setOutput(&o); + + Matrix4 a({0.0f, 0.0f, 1.0f, 4.0f}, + {1.0f, 0.0f, 0.0f, 3.0f}, + {0.0f, -1.0f, 0.1f, 0.0f}, + {9.0f, 4.0f, 5.0f, 9.0f}); + a.rotationNormalized(); + CORRADE_COMPARE(o.str(), "Math::Matrix4::rotationNormalized(): the rotation part is not normalized\n"); + + Matrix4 b({ 0.35612214f, -0.80181062f, 0.47987163f, 1.0f}, + { 0.47987163f, 0.59757638f, 0.6423595f, 3.0f}, + {-0.80181062f, 0.0015183985f, 0.59757638f, 4.0f}, + { 0.0f, 0.0f, 0.0f, 1.0f}); + CORRADE_COMPARE(b.rotationNormalized(), Matrix3(Vector3( 0.35612214f, -0.80181062f, 0.47987163f), + Vector3( 0.47987163f, 0.59757638f, 0.6423595f), + Vector3(-0.80181062f, 0.0015183985f, 0.59757638f))); +} + void Matrix4Test::rotationPart() { Matrix4 rotation = Matrix4::rotation(Deg(-74.0f), Vector3(-1.0f, 2.0f, 2.0f).normalized()); Matrix3 expectedRotationPart(Vector3( 0.35612214f, -0.80181062f, 0.47987163f), From 9311d80614cf709f942d5b53422e8848ecb543cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 17:41:00 +0200 Subject: [PATCH 50/90] MeshTools: better assertion message for interleave(). Print expected and actual count to simplify debugging. Also the phrase "nothing done." is useless, as nothing is _ever_ done after assertion failure. Probably remains from the times where that wasn't assertion but merely harmless warning. --- src/MeshTools/Interleave.h | 2 +- src/MeshTools/Test/InterleaveTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MeshTools/Interleave.h b/src/MeshTools/Interleave.h index e95ec8ebd..8396219ae 100644 --- a/src/MeshTools/Interleave.h +++ b/src/MeshTools/Interleave.h @@ -76,7 +76,7 @@ class Interleave { } template static typename std::enable_if::value, std::size_t>::type attributeCount(const T& first, const U&... next) { - CORRADE_ASSERT(sizeof...(next) == 0 || attributeCount(next...) == first.size() || attributeCount(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.", 0); + CORRADE_ASSERT(sizeof...(next) == 0 || attributeCount(next...) == first.size() || attributeCount(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << attributeCount(next...), 0); return first.size(); } diff --git a/src/MeshTools/Test/InterleaveTest.cpp b/src/MeshTools/Test/InterleaveTest.cpp index d987be6ee..13375461f 100644 --- a/src/MeshTools/Test/InterleaveTest.cpp +++ b/src/MeshTools/Test/InterleaveTest.cpp @@ -57,7 +57,7 @@ void InterleaveTest::attributeCount() { Error::setOutput(&ss); CORRADE_COMPARE((Implementation::Interleave::attributeCount(std::vector{0, 1, 2}, std::vector{0, 1, 2, 3, 4, 5})), std::size_t(0)); - CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.\n"); + CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, expected 3 but got 6\n"); CORRADE_COMPARE((Implementation::Interleave::attributeCount(std::vector{0, 1, 2}, std::vector{3, 4, 5})), std::size_t(3)); From da134c97a66696dbdc1f25f5e77ffca6522e637c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 17:43:18 +0200 Subject: [PATCH 51/90] Primitives: fix empty Icosphere position array. Positions and normals have the same data, thus the data were simply copied to positions and then moved to normals in return to save one needless copying. However it seems that these two operations were swapped by the compiler (C++ standard?) and thus there were no positions to be copied. Now explicitly creating copy of position array and then moving them in return. While at it, renamed also `vertices` to `positions` to be consistent with the rest of the engine. Also added simple (count only) unit test to avoid this error in the future. --- src/Primitives/Icosphere.cpp | 10 +++-- src/Primitives/Test/CMakeLists.txt | 1 + src/Primitives/Test/IcosphereTest.cpp | 57 +++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/Primitives/Test/IcosphereTest.cpp diff --git a/src/Primitives/Icosphere.cpp b/src/Primitives/Icosphere.cpp index b6f09d32c..452e38eb3 100644 --- a/src/Primitives/Icosphere.cpp +++ b/src/Primitives/Icosphere.cpp @@ -55,7 +55,7 @@ Trade::MeshData3D Icosphere::solid(const UnsignedInt subdivisions) { 4, 8, 0 }; - std::vector vertices{ + std::vector positions{ {0.0f, -0.525731f, 0.850651f}, {0.850651f, 0.0f, 0.525731f}, {0.850651f, 0.0f, -0.525731f}, @@ -71,12 +71,14 @@ Trade::MeshData3D Icosphere::solid(const UnsignedInt subdivisions) { }; for(std::size_t i = 0; i != subdivisions; ++i) - MeshTools::subdivide(indices, vertices, [](const Vector3& a, const Vector3& b) { + MeshTools::subdivide(indices, positions, [](const Vector3& a, const Vector3& b) { return (a+b).normalized(); }); - MeshTools::removeDuplicates(indices, vertices); - return Trade::MeshData3D(Mesh::Primitive::Triangles, std::move(indices), {vertices}, {std::move(vertices)}, {}); + MeshTools::removeDuplicates(indices, positions); + + std::vector normals(positions); + return Trade::MeshData3D(Mesh::Primitive::Triangles, std::move(indices), {std::move(positions)}, {std::move(normals)}, {}); } }} diff --git a/src/Primitives/Test/CMakeLists.txt b/src/Primitives/Test/CMakeLists.txt index b12e72032..c47b2a92b 100644 --- a/src/Primitives/Test/CMakeLists.txt +++ b/src/Primitives/Test/CMakeLists.txt @@ -25,4 +25,5 @@ corrade_add_test(PrimitivesCapsuleTest CapsuleTest.cpp LIBRARIES MagnumPrimitives) corrade_add_test(PrimitivesCircleTest CircleTest.cpp LIBRARIES MagnumPrimitives) corrade_add_test(PrimitivesCylinderTest CylinderTest.cpp LIBRARIES MagnumPrimitives) +corrade_add_test(PrimitivesIcosphereTest IcosphereTest.cpp LIBRARIES MagnumPrimitives) corrade_add_test(PrimitivesUVSphereTest UVSphereTest.cpp LIBRARIES MagnumPrimitives) diff --git a/src/Primitives/Test/IcosphereTest.cpp b/src/Primitives/Test/IcosphereTest.cpp new file mode 100644 index 000000000..e6f6d13db --- /dev/null +++ b/src/Primitives/Test/IcosphereTest.cpp @@ -0,0 +1,57 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "Math/Vector3.h" +#include "Primitives/Icosphere.h" +#include "Trade/MeshData3D.h" + +namespace Magnum { namespace Primitives { namespace Test { + +class IcosphereTest: public TestSuite::Tester { + public: + explicit IcosphereTest(); + + void count(); +}; + +IcosphereTest::IcosphereTest() { + addTests({&IcosphereTest::count}); +} + +void IcosphereTest::count() { + Trade::MeshData3D data = Primitives::Icosphere::solid(2); + + CORRADE_COMPARE(data.positionArrayCount(), 1); + CORRADE_COMPARE(data.normalArrayCount(), 1); + + CORRADE_COMPARE(data.indices().size(), 960); + CORRADE_COMPARE(data.positions(0).size(), 162); + CORRADE_COMPARE(data.normals(0).size(), 162); +} + +}}} + +CORRADE_TEST_MAIN(Magnum::Primitives::Test::IcosphereTest) From 68dd5b589bbdeb982f3def4c1928145fedb4f43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 18:16:10 +0200 Subject: [PATCH 52/90] Doxygen fixes. --- src/Sampler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Sampler.cpp b/src/Sampler.cpp index 0d1c5bb4e..648822415 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -60,6 +60,7 @@ Float Sampler::maxSupportedAnisotropy() { } #endif +#ifndef DOXYGEN_GENERATING_OUTPUT Debug operator<<(Debug debug, const Sampler::Filter value) { switch(value) { #define _c(value) case Sampler::Filter::value: return debug << "Sampler::Filter::" #value; @@ -100,5 +101,6 @@ Debug operator<<(Debug debug, const Sampler::Wrapping value) { return debug << "Sampler::Wrapping::(invalid)"; } +#endif } From e97b2a79f9afc7a33816c220fbc0e9c754658046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 18:32:21 +0200 Subject: [PATCH 53/90] Typo fix: additionaly -> additionally. --- src/AbstractTexture.cpp | 2 +- src/Text/DistanceFieldGlyphCache.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index b4134c49e..3bffa9ed5 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -726,7 +726,7 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G levelSize = Math::max(Vector2i(1), levelSize/2); } - /* Cube map additionaly needs to specify all faces */ + /* Cube map additionally needs to specify all faces */ } else if(target == GL_TEXTURE_CUBE_MAP) { Vector2i levelSize = size; for(GLsizei level = 0; level != levels; ++level) { diff --git a/src/Text/DistanceFieldGlyphCache.h b/src/Text/DistanceFieldGlyphCache.h index 892f20da9..868e949fe 100644 --- a/src/Text/DistanceFieldGlyphCache.h +++ b/src/Text/DistanceFieldGlyphCache.h @@ -41,7 +41,7 @@ is red channel only. @section GlyphCache-usage Usage -Usage is similar to GlyphCache, additionaly you need to specify size of +Usage is similar to GlyphCache, additionally you need to specify size of resulting distance field texture. @code Text::AbstractFont* font; From 8a2d769dd139919f1a7e1a149506a0f21720f734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 18:44:19 +0200 Subject: [PATCH 54/90] Added some C++14 TODOs. --- src/DefaultFramebuffer.cpp | 3 +++ src/Framebuffer.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/DefaultFramebuffer.cpp b/src/DefaultFramebuffer.cpp index fe7a7d75a..60a628f30 100644 --- a/src/DefaultFramebuffer.cpp +++ b/src/DefaultFramebuffer.cpp @@ -44,6 +44,7 @@ DefaultFramebuffer* DefaultFramebuffer::mapForDraw(std::initializer_list max) max = attachment.first; /* Create linear array from associative */ + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[max+1]; std::fill_n(_attachments, max, GL_NONE); for(const auto& attachment: attachments) @@ -56,6 +57,7 @@ DefaultFramebuffer* DefaultFramebuffer::mapForDraw(std::initializer_list attachments) { + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[attachments.size()]; for(std::size_t i = 0; i != attachments.size(); ++i) _attachments[i] = GLenum(*(attachments.begin()+i)); @@ -66,6 +68,7 @@ void DefaultFramebuffer::invalidate(std::initializer_list attachments, const Rectanglei& rectangle) { + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[attachments.size()]; for(std::size_t i = 0; i != attachments.size(); ++i) _attachments[i] = GLenum(*(attachments.begin()+i)); diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index ae727c33f..001f8d71a 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -74,6 +74,7 @@ Framebuffer* Framebuffer::mapForDraw(std::initializer_list max) max = attachment.first; /* Create linear array from associative */ + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[max+1]; std::fill_n(_attachments, max, GL_NONE); for(const auto& attachment: attachments) @@ -85,6 +86,7 @@ Framebuffer* Framebuffer::mapForDraw(std::initializer_list attachments) { + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[attachments.size()]; for(std::size_t i = 0; i != attachments.size(); ++i) _attachments[i] = GLenum(*(attachments.begin()+i)); @@ -95,6 +97,7 @@ void Framebuffer::invalidate(std::initializer_list attac } void Framebuffer::invalidate(std::initializer_list attachments, const Rectanglei& rectangle) { + /** @todo C++14: use VLA to avoid heap allocation */ GLenum* _attachments = new GLenum[attachments.size()]; for(std::size_t i = 0; i != attachments.size(); ++i) _attachments[i] = GLenum(*(attachments.begin()+i)); From 091efebaa174289ade2a13b34ac8f9188c1bc683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:07:30 +0200 Subject: [PATCH 55/90] Make explicit `std::hash` specialization for ResourceKey. Allows users to use ResourceKey in `std::unordered_map` more conveniently. --- src/Magnum.h | 7 +++++++ src/Resource.h | 11 +++++++++++ src/ResourceManager.h | 8 +------- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Magnum.h b/src/Magnum.h index a54c2467c..13eeb2b92 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -419,4 +419,11 @@ class Timeline; } +namespace std { + #ifndef DOXYGEN_GENERATING_OUTPUT + template struct hash; + #endif + template<> struct hash; +} + #endif diff --git a/src/Resource.h b/src/Resource.h index cf71f7998..888f2b6dd 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -277,6 +277,17 @@ template void Resource::acquire() { } +namespace std { + /** @brief `std::hash` specialization for @ref Magnum::ResourceKey */ + template<> struct hash { + #ifndef DOXYGEN_GENERATING_OUTPUT + std::size_t operator()(Magnum::ResourceKey key) const { + return *reinterpret_cast(key.byteArray()); + } + #endif + }; +} + /* Make the definition complete */ #include "ResourceManager.h" diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 0831ac727..acb3a1553 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -91,12 +91,6 @@ template class AbstractResourceLoader; namespace Implementation { -struct ResourceKeyHash { - std::size_t operator()(ResourceKey key) const { - return *reinterpret_cast(key.byteArray()); - } -}; - template class ResourceManagerData { template friend class Magnum::Resource; friend class AbstractResourceLoader; @@ -147,7 +141,7 @@ template class ResourceManagerData { void decrementReferenceCount(ResourceKey key); - std::unordered_map _data; + std::unordered_map _data; T* _fallback; AbstractResourceLoader* _loader; std::size_t _lastChange; From 92e77978239dd5fdecbeb7afaaa277f6bce7afb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:12:01 +0200 Subject: [PATCH 56/90] Fix example code in documentation, added TODO. --- src/AbstractResourceLoader.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index ae38375b5..ee222d335 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -88,11 +88,14 @@ You can then add it to resource manager instance like this: MyResourceManager manager; MeshResourceLoader loader; -manager->setLoader(loader); +manager->setLoader(&loader); // This will now automatically request the mesh from loader by calling load() Resource myMesh = manager->get("my-mesh"); @endcode + +@todoc How about working with resources of different data types (i.e. mesh + buffers), should that be allowed? */ template class AbstractResourceLoader { friend class Implementation::ResourceManagerData; From 77dca430c35e4236c20df198370040a48c096f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:17:05 +0200 Subject: [PATCH 57/90] Make virtual AbstractResourceLoader functions private. Removes the need to call AbstractResourceLoader::load() from reimplementation. --- src/AbstractResourceLoader.h | 64 +++++++++++++++++++------------- src/Test/ResourceManagerTest.cpp | 38 +++++++++---------- 2 files changed, 58 insertions(+), 44 deletions(-) diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index ee222d335..64fcbc8c2 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -47,39 +47,34 @@ each call to ResourceManager::get() will call load() implementation unless the resource is already loaded (or loading is in progress). Note that resources requested before the loader was added are not be affected by the loader. -Subclassing is done by implementing at least load() function. The loading can +Subclassing is done by implementing at least doLoad() function. The loading can be done synchronously or asynchronously (i.e., in another thread). The base implementation provides interface to ResourceManager and manages loading progress (which is then available through functions requestedCount(), loadedCount() and notFoundCount()). You shouldn't access the ResourceManager directly when loading the data. -Your load() implementation must call the base implementation at the beginning -so ResourceManager is informed about loading state. Then, after your resources -are loaded, call set() to pass them to ResourceManager or call setNotFound() -to indicate that the resource was not found. +In your doLoad() implementation, after your resources are loaded, call set() to +pass them to ResourceManager or call setNotFound() to indicate that the +resource was not found. You can also implement name() to provide meaningful names for resource keys. Example implementation for synchronous mesh loader: @code class MeshResourceLoader: public AbstractResourceLoader { - public: - void load(ResourceKey key) { - // Indicate that loading has begun - AbstractResourceLoader::load(key); - - // Load the mesh... - - // Not found - if(!found) { - setNotFound(key); - return; - } + void doLoad(ResourceKey key) override { + // Load the mesh... - // Found, pass it to resource manager - set(key, mesh, state, policy); + // Not found + if(!found) { + setNotFound(key); + return; } + + // Found, pass it to resource manager + set(key, mesh, state, policy); + } }; @endcode @@ -132,9 +127,9 @@ template class AbstractResourceLoader { * @brief %Resource name corresponding to given key * * If no such resource exists or the resource name is not available, - * returns empty string. Default implementation returns empty string. + * returns empty string. */ - virtual std::string name(ResourceKey key) const; + std::string name(ResourceKey key) const { return doName(key); } /** * @brief Request resource to be loaded @@ -144,12 +139,10 @@ template class AbstractResourceLoader { * requested features is incremented. Depending on implementation the * resource might be loaded synchronously or asynchronously. * - * See class documentation for reimplementation guide. - * * @see ResourceManager::state(), requestedCount(), notFoundCount(), * loadedCount() */ - virtual void load(ResourceKey key) = 0; + void load(ResourceKey key); protected: /** @@ -172,6 +165,25 @@ template class AbstractResourceLoader { */ void setNotFound(ResourceKey key); + #ifndef DOXYGEN_GENERATING_OUTPUT + private: + #else + protected: + #endif + /** + * @brief Implementation for name() + * + * Default implementation returns empty string. + */ + virtual std::string doName(ResourceKey key) const; + + /** + * @brief Implementation for load() + * + * See class documentation for reimplementation guide. + */ + virtual void doLoad(ResourceKey key) = 0; + private: Implementation::ResourceManagerData* manager; std::size_t _requestedCount; @@ -183,12 +195,14 @@ template AbstractResourceLoader::~AbstractResourceLoader() { if(manager) manager->_loader = nullptr; } -template std::string AbstractResourceLoader::name(ResourceKey) const { return {}; } +template std::string AbstractResourceLoader::doName(ResourceKey) const { return {}; } template void AbstractResourceLoader::load(ResourceKey key) { ++_requestedCount; /** @todo What policy for loading resources? */ manager->set(key, nullptr, ResourceDataState::Loading, ResourcePolicy::Resident); + + doLoad(key); } template void AbstractResourceLoader::set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy) { diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index a99956e6b..8235d2328 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -56,18 +56,6 @@ class Data { typedef Magnum::ResourceManager ResourceManager; -class IntResourceLoader: public AbstractResourceLoader { - public: - void load(ResourceKey key) override { - AbstractResourceLoader::load(key); - } - - void load() { - set("hello", new Int(773), ResourceDataState::Final, ResourcePolicy::Resident); - setNotFound("world"); - } -}; - size_t Data::count = 0; ResourceManagerTest::ResourceManagerTest() { @@ -239,18 +227,30 @@ void ResourceManagerTest::manualPolicy() { } void ResourceManagerTest::loader() { - ResourceManager rm; - IntResourceLoader loader; - rm.setLoader(&loader); + class IntResourceLoader: public AbstractResourceLoader { + public: - Resource data = rm.get("data"); - Resource hello = rm.get("hello"); - Resource world = rm.get("world"); + void load() { + set("hello", new Int(773), ResourceDataState::Final, ResourcePolicy::Resident); + setNotFound("world"); + } + + private: + void doLoad(ResourceKey) override {} + }; + + auto rm = new ResourceManager; + auto loader = new IntResourceLoader; + rm->setLoader(loader); + + Resource data = rm->get("data"); + Resource hello = rm->get("hello"); + Resource world = rm->get("world"); CORRADE_COMPARE(data.state(), ResourceState::NotLoaded); CORRADE_COMPARE(hello.state(), ResourceState::Loading); CORRADE_COMPARE(world.state(), ResourceState::Loading); - loader.load(); + loader->load(); CORRADE_COMPARE(hello.state(), ResourceState::Final); CORRADE_COMPARE(*hello, 773); CORRADE_COMPARE(world.state(), ResourceState::NotFound); From 26504480b23b4ea0a2c5e2a01519b47c9340315b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:19:10 +0200 Subject: [PATCH 58/90] Test whole AbstractResourceLoader API. --- src/Test/ResourceManagerTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index 8235d2328..11e9c8f8c 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -237,6 +237,11 @@ void ResourceManagerTest::loader() { private: void doLoad(ResourceKey) override {} + + std::string doName(ResourceKey key) const override { + if(key == ResourceKey("hello")) return "hello"; + return ""; + } }; auto rm = new ResourceManager; @@ -250,10 +255,19 @@ void ResourceManagerTest::loader() { CORRADE_COMPARE(hello.state(), ResourceState::Loading); CORRADE_COMPARE(world.state(), ResourceState::Loading); + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 0); + CORRADE_COMPARE(loader->notFoundCount(), 0); + CORRADE_COMPARE(loader->name(ResourceKey("hello")), "hello"); + loader->load(); CORRADE_COMPARE(hello.state(), ResourceState::Final); CORRADE_COMPARE(*hello, 773); CORRADE_COMPARE(world.state(), ResourceState::NotFound); + + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 1); + CORRADE_COMPARE(loader->notFoundCount(), 1); } }} From b7bcf0dc5903f30a867d57b5b5189269d6ff4d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:09:58 +0200 Subject: [PATCH 59/90] Simplified internal ResourceManager::free() implementation. No need to explicitly create all the pointers and then juggle with `std::common_type<>` and whatnot. --- src/ResourceManager.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ResourceManager.h b/src/ResourceManager.h index acb3a1553..6038d32dd 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -348,7 +348,7 @@ template class ResourceManager: private Implementation::Resource * @return Pointer to self (for method chaining) */ ResourceManager* free() { - freeInternal(std::common_type()...); + freeInternal(); return this; } @@ -374,11 +374,11 @@ template class ResourceManager: private Implementation::Resource } private: - template void freeInternal(std::common_type, std::common_type... t) { + template void freeInternal() { free(); - freeInternal(t...); + freeInternal(); } - void freeInternal() const {} + template void freeInternal() const {} static ResourceManager*& internalInstance(); }; From 8bce5114dae38f96f562c3fe85c8a2e9129a2638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:20:38 +0200 Subject: [PATCH 60/90] Deleting all resource loaders before unloading any resource data. Previously was done per type (i.e. for each type delete loader and then the data), wasn't usable when the loader stored different resource type (which is the only case where it is useful). --- src/AbstractResourceLoader.h | 7 ++++- src/ResourceManager.h | 24 +++++++++++--- src/Test/ResourceManagerTest.cpp | 54 ++++++++++++++++++++------------ 3 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index 64fcbc8c2..994633a5e 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -78,7 +78,12 @@ class MeshResourceLoader: public AbstractResourceLoader { }; @endcode -You can then add it to resource manager instance like this: +You can then add it to resource manager instance like this. Note that the +manager automatically deletes the all loaders on destruction before unloading +all resources. It allows you to use resources in the loader itself without +having to delete the loader explicitly to ensure proper resource unloading. In +the following code, however, the loader destroys itself (and removes itself +from the manager) before the manager is destroyed. @code MyResourceManager manager; MeshResourceLoader loader; diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 6038d32dd..1c800f0c6 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -125,6 +125,8 @@ template class ResourceManagerData { AbstractResourceLoader* loader() { return _loader; } const AbstractResourceLoader* loader() const { return _loader; } + void freeLoader(); + void setLoader(AbstractResourceLoader* loader); protected: @@ -367,6 +369,8 @@ template class ResourceManager: private Implementation::Resource * @return Pointer to self (for method chaining) * * See AbstractResourceLoader documentation for more information. + * @attention The loader is deleted on destruction before unloading + * all resources. */ template ResourceManager* setLoader(AbstractResourceLoader* loader) { this->Implementation::ResourceManagerData::setLoader(loader); @@ -380,6 +384,12 @@ template class ResourceManager: private Implementation::Resource } template void freeInternal() const {} + template void freeLoaders() { + Implementation::ResourceManagerData::freeLoader(); + freeLoaders(); + } + template void freeLoaders() const {} + static ResourceManager*& internalInstance(); }; @@ -393,12 +403,8 @@ template ResourceManager*& ResourceManager:: namespace Implementation { template ResourceManagerData::~ResourceManagerData() { + /* Loaders are already deleted via freeLoaders() from ResourceManager */ delete _fallback; - - if(_loader) { - _loader->manager = nullptr; - delete _loader; - } } template std::size_t ResourceManagerData::referenceCount(const ResourceKey key) const { @@ -499,6 +505,13 @@ template void ResourceManagerData::setLoader(AbstractResourceLoader< if((_loader = loader)) _loader->manager = this; } +template void ResourceManagerData::freeLoader() { + if(!_loader) return; + + _loader->manager = nullptr; + delete _loader; +} + template void ResourceManagerData::decrementReferenceCount(ResourceKey key) { auto it = _data.find(key); @@ -546,6 +559,7 @@ template ResourceManager::ResourceManager() { } template ResourceManager::~ResourceManager() { + freeLoaders(); CORRADE_INTERNAL_ASSERT(internalInstance() == this); internalInstance() = nullptr; } diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index 11e9c8f8c..ccfe57b8f 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -229,6 +229,7 @@ void ResourceManagerTest::manualPolicy() { void ResourceManagerTest::loader() { class IntResourceLoader: public AbstractResourceLoader { public: + IntResourceLoader(): resource(ResourceManager::instance()->get("data")) {} void load() { set("hello", new Int(773), ResourceDataState::Final, ResourcePolicy::Resident); @@ -242,32 +243,45 @@ void ResourceManagerTest::loader() { if(key == ResourceKey("hello")) return "hello"; return ""; } + + /* To verify that the loader is destroyed before unloading + _all types of_ resources */ + Resource resource; }; auto rm = new ResourceManager; auto loader = new IntResourceLoader; rm->setLoader(loader); - Resource data = rm->get("data"); - Resource hello = rm->get("hello"); - Resource world = rm->get("world"); - CORRADE_COMPARE(data.state(), ResourceState::NotLoaded); - CORRADE_COMPARE(hello.state(), ResourceState::Loading); - CORRADE_COMPARE(world.state(), ResourceState::Loading); - - CORRADE_COMPARE(loader->requestedCount(), 2); - CORRADE_COMPARE(loader->loadedCount(), 0); - CORRADE_COMPARE(loader->notFoundCount(), 0); - CORRADE_COMPARE(loader->name(ResourceKey("hello")), "hello"); - - loader->load(); - CORRADE_COMPARE(hello.state(), ResourceState::Final); - CORRADE_COMPARE(*hello, 773); - CORRADE_COMPARE(world.state(), ResourceState::NotFound); - - CORRADE_COMPARE(loader->requestedCount(), 2); - CORRADE_COMPARE(loader->loadedCount(), 1); - CORRADE_COMPARE(loader->notFoundCount(), 1); + { + Resource data = rm->get("data"); + Resource hello = rm->get("hello"); + Resource world = rm->get("world"); + CORRADE_COMPARE(data.state(), ResourceState::NotLoaded); + CORRADE_COMPARE(hello.state(), ResourceState::Loading); + CORRADE_COMPARE(world.state(), ResourceState::Loading); + + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 0); + CORRADE_COMPARE(loader->notFoundCount(), 0); + CORRADE_COMPARE(loader->name(ResourceKey("hello")), "hello"); + + loader->load(); + CORRADE_COMPARE(hello.state(), ResourceState::Final); + CORRADE_COMPARE(*hello, 773); + CORRADE_COMPARE(world.state(), ResourceState::NotFound); + + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 1); + CORRADE_COMPARE(loader->notFoundCount(), 1); + + /* Verify that the loader is deleted at proper time */ + rm->set("data", new Data); + CORRADE_COMPARE(Data::count, 1); + } + + delete rm; + CORRADE_COMPARE(Data::count, 0); } }} From 655f069221a500e58d527c669e81f2cb8055d938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:27:50 +0200 Subject: [PATCH 61/90] Simplified ResourceManager::set() convenience function. --- src/ResourceManager.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 1c800f0c6..8451472a5 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -313,8 +313,7 @@ template class ResourceManager: private Implementation::Resource * and policy to @ref ResourcePolicy "ResourcePolicy::Resident". */ template ResourceManager* set(ResourceKey key, T* data) { - this->Implementation::ResourceManagerData::set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); - return this; + return set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); } /** @brief Fallback for not found resources */ From b32c39aa44ebd98ba31d7df0ba282a999bedf5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:28:11 +0200 Subject: [PATCH 62/90] Added convience AbstractResourceLoader::set() overload. Similar to ResourceManager::set() one. --- src/AbstractResourceLoader.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index 994633a5e..6270e062d 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -161,6 +161,16 @@ template class AbstractResourceLoader { */ void set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy); + /** + * @brief Set loaded resource to resource manager + * + * Same as above function with state set to @ref ResourceDataState "ResourceDataState::Final" + * and policy to @ref ResourcePolicy "ResourcePolicy::Resident". + */ + void set(ResourceKey key, T* data) { + set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); + } + /** * @brief Mark resource as not found * From a31badc570c0960715038f2280a49f1fd9b6886e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 00:58:42 +0200 Subject: [PATCH 63/90] Minor cleanup in ResourceManagerTest. --- src/Test/ResourceManagerTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index ccfe57b8f..e9bfafbf2 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -168,7 +168,7 @@ void ResourceManagerTest::basic() { void ResourceManagerTest::residentPolicy() { ResourceManager* rm = new ResourceManager; - rm->set("blah", new Data(), ResourceDataState::Mutable, ResourcePolicy::Resident); + rm->set("blah", new Data, ResourceDataState::Mutable, ResourcePolicy::Resident); CORRADE_COMPARE(Data::count, 1); rm->free(); @@ -210,7 +210,7 @@ void ResourceManagerTest::manualPolicy() { /* Manual free */ { - rm.set(dataKey, new Data(), ResourceDataState::Mutable, ResourcePolicy::Manual); + rm.set(dataKey, new Data, ResourceDataState::Mutable, ResourcePolicy::Manual); Resource data = rm.get(dataKey); rm.free(); } @@ -221,7 +221,7 @@ void ResourceManagerTest::manualPolicy() { CORRADE_COMPARE(rm.count(), 0); CORRADE_COMPARE(Data::count, 0); - rm.set(dataKey, new Data(), ResourceDataState::Mutable, ResourcePolicy::Manual); + rm.set(dataKey, new Data, ResourceDataState::Mutable, ResourcePolicy::Manual); CORRADE_COMPARE(rm.count(), 1); CORRADE_COMPARE(Data::count, 1); } From c1c4788e88b8fee7094da5d19b685ccf8b80745e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 01:04:56 +0200 Subject: [PATCH 64/90] Ability to force cleanup of ResourceManager. Assumes that no resources of given type are referenced. The test case for this is awful, as I can't think of a way to test which would work without trying to decrement reference counter on already deleted resource. Added just-to-be-sure assertion to make it fail early and not somewhere deep in STL. --- src/ResourceManager.h | 33 +++++++++++++++++++++++++++++++- src/Test/ResourceManagerTest.cpp | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 8451472a5..2c28df4a1 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -122,6 +122,8 @@ template class ResourceManagerData { void free(); + void clear() { _data.clear(); } + AbstractResourceLoader* loader() { return _loader; } const AbstractResourceLoader* loader() const { return _loader; } @@ -353,6 +355,28 @@ template class ResourceManager: private Implementation::Resource return this; } + /** + * @brief Clear all resources of given type + * @return Pointer to self (for method chaining) + * + * Unlike free() this function assumes that no resource is referenced. + */ + template ResourceManager* clear() { + this->Implementation::ResourceManagerData::clear(); + return this; + } + + /** + * @brief Clear all resources + * @return Pointer to self (for method chaining) + * + * Unlike free() this function assumes that no resource is referenced. + */ + ResourceManager* clear() { + clearInternal(); + return this; + } + /** @brief Loader for given type of resources */ template AbstractResourceLoader* loader() { return this->Implementation::ResourceManagerData::loader(); @@ -383,6 +407,12 @@ template class ResourceManager: private Implementation::Resource } template void freeInternal() const {} + template void clearInternal() { + clear(); + clearInternal(); + } + template void clearInternal() const {} + template void freeLoaders() { Implementation::ResourceManagerData::freeLoader(); freeLoaders(); @@ -513,6 +543,7 @@ template void ResourceManagerData::freeLoader() { template void ResourceManagerData::decrementReferenceCount(ResourceKey key) { auto it = _data.find(key); + CORRADE_INTERNAL_ASSERT(it != _data.end()); /* Free the resource if it is reference counted */ if(--it->second.referenceCount == 0 && it->second.policy == ResourcePolicy::ReferenceCounted) @@ -541,7 +572,7 @@ template struct ResourceManagerData::Data { template inline ResourceManagerData::Data::~Data() { CORRADE_ASSERT(referenceCount == 0, - "ResourceManager::~ResourceManager(): destroyed while data are still referenced", ); + "ResourceManager: cleared/destroyed while data are still referenced", ); delete data; } diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index e9bfafbf2..1e977c70e 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -43,6 +43,8 @@ class ResourceManagerTest: public TestSuite::Tester { void residentPolicy(); void referenceCountedPolicy(); void manualPolicy(); + void clear(); + void clearWhileReferenced(); void loader(); }; @@ -66,6 +68,8 @@ ResourceManagerTest::ResourceManagerTest() { &ResourceManagerTest::residentPolicy, &ResourceManagerTest::referenceCountedPolicy, &ResourceManagerTest::manualPolicy, + &ResourceManagerTest::clear, + &ResourceManagerTest::clearWhileReferenced, &ResourceManagerTest::loader}); } @@ -226,6 +230,35 @@ void ResourceManagerTest::manualPolicy() { CORRADE_COMPARE(Data::count, 1); } +void ResourceManagerTest::clear() { + ResourceManager rm; + + rm.set("blah", new Data); + CORRADE_COMPARE(Data::count, 1); + + rm.free(); + CORRADE_COMPARE(Data::count, 1); + + rm.clear(); + CORRADE_COMPARE(Data::count, 0); +} + +void ResourceManagerTest::clearWhileReferenced() { + /* Should cover also the destruction case */ + + std::ostringstream out; + Error::setOutput(&out); + + ResourceManager rm; + rm.set("blah", new Int); + /** @todo this will leak, is there any better solution without hitting + assertion in decrementReferenceCount()? */ + new Resource(rm.get("blah")); + + rm.clear(); + CORRADE_COMPARE(out.str(), "ResourceManager: cleared/destroyed while data are still referenced\n"); +} + void ResourceManagerTest::loader() { class IntResourceLoader: public AbstractResourceLoader { public: From 4937b5171332786ee42107836681175768fc01e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 01:08:39 +0200 Subject: [PATCH 65/90] Trade: use instance() instead of instanceId() for consistency. Nowhere else is `Id` suffix. --- src/Trade/ObjectData2D.cpp | 4 ++-- src/Trade/ObjectData2D.h | 8 ++++---- src/Trade/ObjectData3D.cpp | 4 ++-- src/Trade/ObjectData3D.h | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Trade/ObjectData2D.cpp b/src/Trade/ObjectData2D.cpp index a9fb2e861..098e3655f 100644 --- a/src/Trade/ObjectData2D.cpp +++ b/src/Trade/ObjectData2D.cpp @@ -26,9 +26,9 @@ namespace Magnum { namespace Trade { -ObjectData2D::ObjectData2D(std::vector children, const Matrix3& transformation, ObjectData2D::InstanceType instanceType, UnsignedInt instanceId): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instanceId(instanceId) {} +ObjectData2D::ObjectData2D(std::vector children, const Matrix3& transformation, ObjectData2D::InstanceType instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {} -ObjectData2D::ObjectData2D(std::vector children, const Matrix3& transformation): _children(children), _transformation(transformation), _instanceType(InstanceType::Empty), _instanceId(-1) {} +ObjectData2D::ObjectData2D(std::vector children, const Matrix3& transformation): _children(children), _transformation(transformation), _instanceType(InstanceType::Empty), _instance(-1) {} ObjectData2D::ObjectData2D(ObjectData2D&&) = default; diff --git a/src/Trade/ObjectData2D.h b/src/Trade/ObjectData2D.h index 7bdae6f1c..e80f2a01a 100644 --- a/src/Trade/ObjectData2D.h +++ b/src/Trade/ObjectData2D.h @@ -56,9 +56,9 @@ class MAGNUM_EXPORT ObjectData2D { * @param children Child objects * @param transformation Transformation (relative to parent) * @param instanceType Instance type - * @param instanceId Instance ID + * @param instance Instance ID */ - explicit ObjectData2D(std::vector children, const Matrix3& transformation, InstanceType instanceType, UnsignedInt instanceId); + explicit ObjectData2D(std::vector children, const Matrix3& transformation, InstanceType instanceType, UnsignedInt instance); /** * @brief Constructor for empty instance @@ -102,13 +102,13 @@ class MAGNUM_EXPORT ObjectData2D { * @return ID of given camera / light / mesh etc., specified by * instanceType() */ - Int instanceId() const { return _instanceId; } + Int instance() const { return _instance; } private: std::vector _children; Matrix3 _transformation; InstanceType _instanceType; - Int _instanceId; + Int _instance; }; /** @debugoperator{Magnum::Trade::ObjectData2D} */ diff --git a/src/Trade/ObjectData3D.cpp b/src/Trade/ObjectData3D.cpp index f12fa9206..777c2b378 100644 --- a/src/Trade/ObjectData3D.cpp +++ b/src/Trade/ObjectData3D.cpp @@ -26,9 +26,9 @@ namespace Magnum { namespace Trade { -ObjectData3D::ObjectData3D(std::vector children, const Matrix4& transformation, ObjectData3D::InstanceType instanceType, UnsignedInt instanceId): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instanceId(instanceId) {} +ObjectData3D::ObjectData3D(std::vector children, const Matrix4& transformation, ObjectData3D::InstanceType instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {} -ObjectData3D::ObjectData3D(std::vector children, const Matrix4& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(InstanceType::Empty), _instanceId(-1) {} +ObjectData3D::ObjectData3D(std::vector children, const Matrix4& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(InstanceType::Empty), _instance(-1) {} ObjectData3D::ObjectData3D(ObjectData3D&&) = default; diff --git a/src/Trade/ObjectData3D.h b/src/Trade/ObjectData3D.h index 0f296fc14..fbe5c47cd 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Trade/ObjectData3D.h @@ -57,9 +57,9 @@ class MAGNUM_EXPORT ObjectData3D { * @param children Child objects * @param transformation Transformation (relative to parent) * @param instanceType Instance type - * @param instanceId Instance ID + * @param instance Instance ID */ - explicit ObjectData3D(std::vector children, const Matrix4& transformation, InstanceType instanceType, UnsignedInt instanceId); + explicit ObjectData3D(std::vector children, const Matrix4& transformation, InstanceType instanceType, UnsignedInt instance); /** * @brief Constructor for empty instance @@ -103,13 +103,13 @@ class MAGNUM_EXPORT ObjectData3D { * @return ID of given camera / light / mesh etc., specified by * instanceType() */ - Int instanceId() const { return _instanceId; } + Int instance() const { return _instance; } private: std::vector _children; Matrix4 _transformation; InstanceType _instanceType; - Int _instanceId; + Int _instance; }; /** @debugoperator{Magnum::Trade::ObjectData3D} */ From 261e7cbdc5188534d35ab94531bafc6e3f9f6398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 01:15:42 +0200 Subject: [PATCH 66/90] Trade: improved documentation, removed redundancy. --- src/Trade/ObjectData2D.h | 19 +++++++++++-------- src/Trade/ObjectData3D.h | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Trade/ObjectData2D.h b/src/Trade/ObjectData2D.h index e80f2a01a..65a61a7f1 100644 --- a/src/Trade/ObjectData2D.h +++ b/src/Trade/ObjectData2D.h @@ -38,16 +38,21 @@ namespace Magnum { namespace Trade { /** @brief Two-dimensional object data -Provides access to object transformation and hierarchy. See also -MeshObjectData2D, which is specialized for objects with mesh instance type. -@see ObjectData3D +Provides access to object transformation and hierarchy. +@see MeshObjectData2D, ObjectData3D */ class MAGNUM_EXPORT ObjectData2D { public: - /** @brief Instance type */ + /** @brief Type of instance held by this object */ enum class InstanceType: UnsignedByte { Camera, /**< Camera instance (see CameraData) */ - Mesh, /**< Three-dimensional mesh instance (see MeshData2D) */ + + /** + * Three-dimensional mesh instance. The data can be cast to + * MeshObjectData2D to provide more information. + */ + Mesh, + Empty /**< Empty */ }; @@ -90,10 +95,8 @@ class MAGNUM_EXPORT ObjectData2D { /** * @brief Instance type - * @return Type of instance held by this object * - * If the instance is of type InstanceType::Mesh, the instance can be - * casted to MeshObjectData2D and provide more information. + * @see instance() */ InstanceType instanceType() const { return _instanceType; } diff --git a/src/Trade/ObjectData3D.h b/src/Trade/ObjectData3D.h index fbe5c47cd..884cafb94 100644 --- a/src/Trade/ObjectData3D.h +++ b/src/Trade/ObjectData3D.h @@ -38,17 +38,22 @@ namespace Magnum { namespace Trade { /** @brief Three-dimensional object data -Provides access to object transformation and hierarchy. See also -MeshObjectData3D, which is specialized for objects with mesh instance type. -@see ObjectData2D +Provides access to object transformation and hierarchy. +@see MeshObjectData3D, ObjectData2D */ class MAGNUM_EXPORT ObjectData3D { public: - /** @brief Instance type */ + /** @brief Type of instance held by this object */ enum class InstanceType: UnsignedByte { Camera, /**< Camera instance (see CameraData) */ Light, /**< Light instance (see LightData) */ - Mesh, /**< Three-dimensional mesh instance (see MeshData3D) */ + + /** + * Three-dimensional mesh instance. The data can be cast to + * MeshObjectData3D to provide more information. + */ + Mesh, + Empty /**< Empty */ }; @@ -91,10 +96,8 @@ class MAGNUM_EXPORT ObjectData3D { /** * @brief Instance type - * @return Type of instance held by this object * - * If the instance is of type InstanceType::Mesh, the instance can be - * casted to MeshObjectData3D and provide more information. + * @see instance() */ InstanceType instanceType() const { return _instanceType; } From de96fad678f5893ea2544467495b8976f8d3884b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 02:25:28 +0200 Subject: [PATCH 67/90] Constexpr Array from one value constructor, improved test. Merged constexpr test cases into other ones to remove duplicate code. Copied the constructors from Math::Vector as I don't feel reinventing all that again. --- src/Array.h | 33 ++++++++++++++---------- src/Test/ArrayTest.cpp | 58 +++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/src/Array.h b/src/Array.h index b2099a88a..74f61801b 100644 --- a/src/Array.h +++ b/src/Array.h @@ -29,8 +29,8 @@ */ #include -#include +#include "Math/BoolVector.h" /* for Math::Implementation::Sequence */ #include "Magnum.h" namespace Magnum { @@ -62,23 +62,24 @@ template class Array { * @param first First value * @param next Next values */ - #ifndef DOXYGEN_GENERATING_OUTPUT - template constexpr /*implicit*/ Array(T first, T second, U... next): _data{first, second, next...} { - static_assert(sizeof...(next)+2 == dimensions, "Improper number of arguments passed to Array constructor"); - } - template constexpr /*implicit*/ Array(typename std::enable_if::value && dimensions == 1, U>::type first): _data{first} {} - #else + #ifdef DOXYGEN_GENERATING_OUTPUT template constexpr /*implicit*/ Array(T first, U... next); + #else + template::type> constexpr /*implicit*/ Array(T first, U... next): _data{first, next...} {} #endif - /** - * @brief Constructor - * @param value Value for all fields - */ - template::value && dimensions != 1, U>::type> /*implicit*/ Array(U value) { - for(UnsignedInt i = 0; i != dimensions; ++i) - _data[i] = value; + /** @brief Construct array with one value for all fields */ + #ifdef DOXYGEN_GENERATING_OUTPUT + constexpr /*implicit*/ Array(T value); + #else + #ifndef CORRADE_GCC46_COMPATIBILITY + template::value && dimensions != 1, T>::type> constexpr /*implicit*/ Array(U value): Array(typename Math::Implementation::GenerateSequence::Type(), value) {} + #else + template::value && dimensions != 1, T>::type> /*implicit*/ Array(U value) { + *this = Array(typename Math::Implementation::GenerateSequence::Type(), value); } + #endif + #endif /** @brief Equality */ bool operator==(const Array& other) const { @@ -104,6 +105,10 @@ template class Array { constexpr const T* data() const { return _data; } /**< @overload */ private: + + /* Implementation for Array::Array(U) */ + template constexpr explicit Array(Math::Implementation::Sequence, T value): _data{Math::Implementation::repeat(value, sequence)...} {} + T _data[dimensions]; }; diff --git a/src/Test/ArrayTest.cpp b/src/Test/ArrayTest.cpp index cff946fbf..cfed7c111 100644 --- a/src/Test/ArrayTest.cpp +++ b/src/Test/ArrayTest.cpp @@ -33,7 +33,6 @@ class ArrayTest: public TestSuite::Tester { ArrayTest(); void construct(); - void constexprConstruct(); void equality(); void access(); }; @@ -44,37 +43,31 @@ typedef Magnum::Array3D Array3D; ArrayTest::ArrayTest() { addTests({&ArrayTest::construct, - &ArrayTest::constexprConstruct, &ArrayTest::equality, &ArrayTest::access}); } void ArrayTest::construct() { - CORRADE_COMPARE(Array1D(5), (Array<1, int>(5))); - CORRADE_COMPARE(Array2D(5, 3), (Array<2, int>(5, 3))); - CORRADE_COMPARE(Array3D(5, 3, -2), (Array<3, int>(5, 3, -2))); - - /* Verify proper expansion */ - CORRADE_COMPARE((Array<3, int>(5)), (Array<3, int>(5, 5, 5))); - CORRADE_COMPARE(Array2D(5), (Array<2, int>(5, 5))); - CORRADE_COMPARE(Array3D(5), (Array<3, int>(5, 5, 5))); -} + constexpr Array<3, Int> a = {5, 6, 7}; + CORRADE_COMPARE(a, (Array<3, Int>(5, 6, 7))); + + constexpr Array<3, Int> a2 = 5; + CORRADE_COMPARE(a2, (Array<3, Int>(5, 5, 5))); + + constexpr Array1D b = 5; + CORRADE_COMPARE(b, (Array<1, Int>(5))); + + constexpr Array2D c = {5, 3}; + CORRADE_COMPARE(c, (Array<2, Int>(5, 3))); + + constexpr Array2D c2 = 5; + CORRADE_COMPARE(c2, (Array<2, Int>(5, 5))); + + constexpr Array3D d = {5, 3, -2}; + CORRADE_COMPARE(d, (Array<3, Int>(5, 3, -2))); -void ArrayTest::constexprConstruct() { - /* Verify that all full constructors can be called as constexpr */ - constexpr Array1D a(5); - constexpr Array2D b(5, 3); - constexpr Array2D b2(5); - constexpr Array3D c(5, 6, 7); - constexpr Array3D c2(5); - constexpr Array<3, int> d(5, 6, 7); - - CORRADE_COMPARE(a, Array1D(5)); - CORRADE_COMPARE(b, Array2D(5, 3)); - CORRADE_COMPARE(b2, Array2D(5)); - CORRADE_COMPARE(c, Array3D(5, 6, 7)); - CORRADE_COMPARE(c2, Array3D(5)); - CORRADE_COMPARE(d, (Array<3, int>(5, 6, 7))); + constexpr Array3D d2 = 5; + CORRADE_COMPARE(d2, (Array<3, Int>(5, 5, 5))); } void ArrayTest::equality() { @@ -84,11 +77,18 @@ void ArrayTest::equality() { void ArrayTest::access() { Array1D a(50); - const Array1D ac(50); + constexpr Array1D ac(50); Array2D b(5, 3); - const Array2D bc(5, 3); + constexpr Array2D bc(5, 3); Array3D c(-5, 6, 7); - const Array3D cc(-5, 6, 7); + constexpr Array3D cc(-5, 6, 7); + + CORRADE_COMPARE(a[0], 50); + CORRADE_COMPARE(ac[0], 50); + CORRADE_COMPARE(b[1], 3); + CORRADE_COMPARE(bc[1], 3); + CORRADE_COMPARE(c[2], 7); + CORRADE_COMPARE(cc[2], 7); CORRADE_COMPARE(a.x(), 50); CORRADE_COMPARE(ac.x(), 50); From 62bc46ea780d10370d7d9a1fbd03a3ddb009c265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 02:27:32 +0200 Subject: [PATCH 68/90] Various Array-related cleanup. --- src/Array.h | 4 ++-- src/Test/ArrayTest.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Array.h b/src/Array.h index 74f61801b..703c63df3 100644 --- a/src/Array.h +++ b/src/Array.h @@ -48,12 +48,12 @@ Math::Vector this class has non-explicit constructor from one value. template class Array { public: typedef T Type; /**< @brief Data type */ - const static UnsignedInt Dimensions = dimensions; /**< @brief Dimension count */ + const static UnsignedInt Dimensions = dimensions; /**< @brief Dimension count */ /** * @brief Default constructor * - * Sets all components to their default-constructed values + * Sets all components to their default-constructed values. */ constexpr /*implicit*/ Array(): _data() {} diff --git a/src/Test/ArrayTest.cpp b/src/Test/ArrayTest.cpp index cfed7c111..62b4cb7bc 100644 --- a/src/Test/ArrayTest.cpp +++ b/src/Test/ArrayTest.cpp @@ -37,9 +37,9 @@ class ArrayTest: public TestSuite::Tester { void access(); }; -typedef Magnum::Array1D Array1D; -typedef Magnum::Array2D Array2D; -typedef Magnum::Array3D Array3D; +typedef Magnum::Array1D Array1D; +typedef Magnum::Array2D Array2D; +typedef Magnum::Array3D Array3D; ArrayTest::ArrayTest() { addTests({&ArrayTest::construct, @@ -71,8 +71,8 @@ void ArrayTest::construct() { } void ArrayTest::equality() { - CORRADE_VERIFY((Array<3, int>(5, 6, 7) == Array<3, int>(5, 6, 7))); - CORRADE_VERIFY((Array<3, int>(5, 6, 7) != Array<3, int>(5, 6, 8))); + CORRADE_VERIFY((Array<3, Int>(5, 6, 7) == Array<3, Int>(5, 6, 7))); + CORRADE_VERIFY((Array<3, Int>(5, 6, 7) != Array<3, Int>(5, 6, 8))); } void ArrayTest::access() { From 8afb661f6dda17c2ebe4d306306697c5f9a4c49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 02:27:51 +0200 Subject: [PATCH 69/90] Ability to retrieve first two components from Array3D. --- src/Array.h | 7 +++++++ src/Test/ArrayTest.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/Array.h b/src/Array.h index 703c63df3..622c48709 100644 --- a/src/Array.h +++ b/src/Array.h @@ -191,6 +191,13 @@ template class Array3D: public Array<3, T> { constexpr T y() const { return (*this)[1]; } /**< @overload */ T& z() { return (*this)[2]; } /**< @brief Z component */ constexpr T z() const { return (*this)[2]; } /**< @overload */ + + /** + * @brief XY part of the array + * @return First two components of the array + */ + Array2D& xy() { return reinterpret_cast&>(*this); } + constexpr Array2D xy() const { return {(*this)[0], (*this)[1]}; } /**< @overload */ }; /** @debugoperator{Magnum::Array} */ diff --git a/src/Test/ArrayTest.cpp b/src/Test/ArrayTest.cpp index 62b4cb7bc..69ade4dfe 100644 --- a/src/Test/ArrayTest.cpp +++ b/src/Test/ArrayTest.cpp @@ -104,6 +104,9 @@ void ArrayTest::access() { CORRADE_COMPARE(cc.x(), -5); CORRADE_COMPARE(cc.y(), 6); CORRADE_COMPARE(cc.z(), 7); + + CORRADE_COMPARE(c.xy(), Array2D(-5, 6)); + CORRADE_COMPARE(cc.xy(), Array2D(-5, 6)); } }} From a65cef08cd94172559e53d6021dda5fa8704e5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 02:28:12 +0200 Subject: [PATCH 70/90] MeshTools: added TODO. --- src/MeshTools/Tipsify.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MeshTools/Tipsify.h b/src/MeshTools/Tipsify.h index e167cfd4c..f50ed2a78 100644 --- a/src/MeshTools/Tipsify.h +++ b/src/MeshTools/Tipsify.h @@ -70,6 +70,7 @@ array for beter usage of post-transform vertex cache. Algorithm used: *Pedro V. Sander, Diego Nehab, and Joshua Barczak - Fast Triangle Reordering for Vertex Locality and Reduced Overdraw, SIGGRAPH 2007, http://gfx.cs.princeton.edu/pubs/Sander_2007_%3ETR/index.php*. +@todo Ability to compute vertex count automatically */ inline void tipsify(std::vector& indices, UnsignedInt vertexCount, std::size_t cacheSize) { Implementation::Tipsify(indices, vertexCount)(cacheSize); From f3b6abc99791d9a4d7f5d9bee2da3b607902e0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 16:02:13 +0200 Subject: [PATCH 71/90] Minor documentation fix. --- src/Texture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Texture.h b/src/Texture.h index 90c5a8e9d..70a0115a4 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -50,7 +50,7 @@ Image2D image({4096, 4096}, ImageFormat::RGBA, ImageType::UnsignedByte, data); Texture2D texture; texture.setMagnificationFilter(Sampler::Filter::Linear) - ->setMinificationFilter(Sampler::Filter::Linear, Texture2D::Mipmap::Linear) + ->setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) ->setWrapping(Sampler::Wrapping::ClampToEdge) ->setMaxAnisotropy(Sampler::maxSupportedAnisotropy()) ->setStorage(Math::log2(4096)+1, TextureFormat::RGBA8, {4096, 4096}) From 546ce9d6132c8c8c8c788d0513a942dffe926cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 16:02:25 +0200 Subject: [PATCH 72/90] Minor cleanup. --- src/AbstractResourceLoader.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index 6270e062d..3c7e4e697 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -201,9 +201,9 @@ template class AbstractResourceLoader { private: Implementation::ResourceManagerData* manager; - std::size_t _requestedCount; - std::size_t _loadedCount; - std::size_t _notFoundCount; + std::size_t _requestedCount, + _loadedCount, + _notFoundCount; }; template AbstractResourceLoader::~AbstractResourceLoader() { From 7b497160cb012c623e2152fe3ace2f8767652c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 16:48:59 +0200 Subject: [PATCH 73/90] Added TODO. --- src/ResourceManager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 2c28df4a1..0752ecb4b 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -91,6 +91,8 @@ template class AbstractResourceLoader; namespace Implementation { +/** @todo Print either resource key or name string based on loader capabilities */ + template class ResourceManagerData { template friend class Magnum::Resource; friend class AbstractResourceLoader; From 41f7784dc53d26953037f95f813cb8ef5de02085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 17:02:46 +0200 Subject: [PATCH 74/90] Shaders: ambient, diffuse and specular texture support in Phong. --- src/Shaders/Phong.cpp | 26 ++++++--- src/Shaders/Phong.frag | 71 +++++++++++++++++++++---- src/Shaders/Phong.h | 116 +++++++++++++++++++++++++++++++++++------ src/Shaders/Phong.vert | 14 +++++ 4 files changed, 195 insertions(+), 32 deletions(-) diff --git a/src/Shaders/Phong.cpp b/src/Shaders/Phong.cpp index c96fc0e01..e4a93f068 100644 --- a/src/Shaders/Phong.cpp +++ b/src/Shaders/Phong.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace Shaders { -Phong::Phong(): transformationMatrixUniform(0), projectionMatrixUniform(1), normalMatrixUniform(2), lightUniform(3), diffuseColorUniform(4), ambientColorUniform(5), specularColorUniform(6), lightColorUniform(7), shininessUniform(8) { +Phong::Phong(const Flags flags): transformationMatrixUniform(0), projectionMatrixUniform(1), normalMatrixUniform(2), lightUniform(3), diffuseColorUniform(4), ambientColorUniform(5), specularColorUniform(6), lightColorUniform(7), shininessUniform(8), _flags(flags) { Utility::Resource rs("MagnumShaders"); #ifndef MAGNUM_TARGET_GLES @@ -41,13 +41,17 @@ Phong::Phong(): transformationMatrixUniform(0), projectionMatrixUniform(1), norm #endif Shader vert(v, Shader::Type::Vertex); - vert.addSource(rs.get("compatibility.glsl")) + vert.addSource(flags ? "#define TEXTURED\n" : "") + .addSource(rs.get("compatibility.glsl")) .addSource(rs.get("Phong.vert")); CORRADE_INTERNAL_ASSERT_OUTPUT(vert.compile()); attachShader(vert); Shader frag(v, Shader::Type::Fragment); - frag.addSource(rs.get("compatibility.glsl")) + frag.addSource(flags & Flag::AmbientTexture ? "#define AMBIENT_TEXTURE\n" : "") + .addSource(flags & Flag::DiffuseTexture ? "#define DIFFUSE_TEXTURE\n" : "") + .addSource(flags & Flag::SpecularTexture ? "#define SPECULAR_TEXTURE\n" : "") + .addSource(rs.get("compatibility.glsl")) .addSource(rs.get("Phong.frag")); CORRADE_INTERNAL_ASSERT_OUTPUT(frag.compile()); attachShader(frag); @@ -61,6 +65,7 @@ Phong::Phong(): transformationMatrixUniform(0), projectionMatrixUniform(1), norm { bindAttributeLocation(Position::Location, "position"); bindAttributeLocation(Normal::Location, "normal"); + if(flags) bindAttributeLocation(TextureCoordinates::Location, "textureCoordinates"); } CORRADE_INTERNAL_ASSERT_OUTPUT(link()); @@ -73,13 +78,22 @@ Phong::Phong(): transformationMatrixUniform(0), projectionMatrixUniform(1), norm projectionMatrixUniform = uniformLocation("projectionMatrix"); normalMatrixUniform = uniformLocation("normalMatrix"); lightUniform = uniformLocation("light"); - diffuseColorUniform = uniformLocation("diffuseColor"); - ambientColorUniform = uniformLocation("ambientColor"); - specularColorUniform = uniformLocation("specularColor"); + if(!(flags & Flag::AmbientTexture)) ambientColorUniform = uniformLocation("ambientColor"); + if(!(flags & Flag::DiffuseTexture)) diffuseColorUniform = uniformLocation("diffuseColor"); + if(!(flags & Flag::SpecularTexture)) specularColorUniform = uniformLocation("specularColor"); lightColorUniform = uniformLocation("lightColor"); shininessUniform = uniformLocation("shininess"); } + #ifndef MAGNUM_TARGET_GLES + if(flags && !Context::current()->isExtensionSupported()) + #endif + { + if(flags & Flag::AmbientTexture) setUniform(uniformLocation("ambientTexture"), AmbientTextureLayer); + if(flags & Flag::DiffuseTexture) setUniform(uniformLocation("diffuseTexture"), DiffuseTextureLayer); + if(flags & Flag::SpecularTexture) setUniform(uniformLocation("specularTexture"), SpecularTextureLayer); + } + /* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */ #ifdef MAGNUM_TARGET_GLES setAmbientColor({}); diff --git a/src/Shaders/Phong.frag b/src/Shaders/Phong.frag index c3411f0ea..3d98851f6 100644 --- a/src/Shaders/Phong.frag +++ b/src/Shaders/Phong.frag @@ -29,35 +29,88 @@ #ifndef GL_ES #ifdef EXPLICIT_UNIFORM_LOCATION -layout(location = 4) uniform vec3 diffuseColor; -layout(location = 5) uniform vec3 ambientColor = vec3(0.0, 0.0, 0.0); -layout(location = 6) uniform vec3 specularColor = vec3(1.0, 1.0, 1.0); layout(location = 7) uniform vec3 lightColor = vec3(1.0, 1.0, 1.0); layout(location = 8) uniform float shininess = 80.0; #else -uniform vec3 diffuseColor; -uniform vec3 ambientColor = vec3(0.0, 0.0, 0.0); -uniform vec3 specularColor = vec3(1.0, 1.0, 1.0); uniform vec3 lightColor = vec3(1.0, 1.0, 1.0); uniform float shininess = 80.0; #endif #else -uniform lowp vec3 diffuseColor; -uniform lowp vec3 ambientColor; -uniform lowp vec3 specularColor; uniform lowp vec3 lightColor; uniform mediump float shininess; #endif +#ifdef AMBIENT_TEXTURE +#ifdef EXPLICIT_TEXTURE_LAYER +layout(binding = 0) uniform sampler2D ambientTexture; +#else +uniform sampler2D ambientTexture; +#endif +#else +#ifndef GL_ES +#ifdef EXPLICIT_UNIFORM_LOCATION +layout(location = 5) uniform vec3 ambientColor = vec3(0.0, 0.0, 0.0); +#else +uniform vec3 ambientColor = vec3(0.0, 0.0, 0.0); +#endif +#else +uniform lowp vec3 ambientColor; +#endif +#endif + +#ifdef DIFFUSE_TEXTURE +#ifdef EXPLICIT_TEXTURE_LAYER +layout(binding = 1) uniform sampler2D diffuseTexture; +#else +uniform sampler2D diffuseTexture; +#endif +#else +#ifdef EXPLICIT_UNIFORM_LOCATION +layout(location = 4) uniform vec3 diffuseColor; +#else +uniform lowp vec3 diffuseColor; +#endif +#endif + +#ifdef SPECULAR_TEXTURE +#ifdef EXPLICIT_TEXTURE_LAYER +layout(binding = 2) uniform sampler2D specularTexture; +#else +uniform sampler2D specularTexture; +#endif +#else +#ifndef GL_ES +#ifdef EXPLICIT_UNIFORM_LOCATION +layout(location = 6) uniform vec3 specularColor = vec3(1.0, 1.0, 1.0); +#else +uniform vec3 specularColor = vec3(1.0, 1.0, 1.0); +#endif +#else +uniform lowp vec3 specularColor; +#endif +#endif + in mediump vec3 transformedNormal; in highp vec3 lightDirection; in highp vec3 cameraDirection; +#if defined(AMBIENT_TEXTURE) || defined(DIFFUSE_TEXTURE) || defined(SPECULAR_TEXTURE) +in mediump vec2 interpolatedTextureCoords; +#endif + #ifdef NEW_GLSL out lowp vec4 color; #endif void main() { + #ifdef AMBIENT_TEXTURE + const vec3 ambientColor = texture(ambientTexture, interpolatedTextureCoords).xyz; + #elif defined(DIFFUSE_TEXTURE) + const vec3 diffuseColor = texture(diffuseTexture, interpolatedTextureCoords).xyz; + #elif defined(SPECULAR_TEXTURE) + const vec3 specularColor = texture(specularTexture, interpolatedTextureCoords).xyz; + #endif + /* Ambient color */ color.rgb = ambientColor; diff --git a/src/Shaders/Phong.h b/src/Shaders/Phong.h index 417611152..f5d91e8b8 100644 --- a/src/Shaders/Phong.h +++ b/src/Shaders/Phong.h @@ -39,46 +39,109 @@ namespace Magnum { namespace Shaders { /** @brief Phong shader -If supported, uses GLSL 3.20 and @extension{ARB,explicit_attrib_location}, -otherwise falls back to GLSL 1.20. +Uses ambient, diffuse and specular color or texture. You need to provide +@ref Position and @ref Normal attributes in your triangle mesh and call at +least @ref setTransformationMatrix(), @ref setNormalMatrix(), +@ref setProjectionMatrix(), @ref setDiffuseColor() and @ref setLightPosition(). + +If you want to use texture instead of color, you need to provide also +@ref TextureCoordinates attribute. Pass appropriate flags to constructor and +then at render time bind the texture to its respective layer instead of setting +the color. Example: +@code +Shaders::Phong shader(Shaders::Phong::Flag::DiffuseTexture); + +// ... + +myDiffuseTexture.bind(Shaders::Phong::DiffuseTextureLayer); +@endcode */ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { public: typedef Attribute<0, Vector3> Position; /**< @brief Vertex position */ typedef Attribute<1, Vector3> Normal; /**< @brief Normal direction */ - explicit Phong(); + /** + * @brief Texture coordinates + * + * Used only if one of @ref Flag "Flag::AmbientTexture", + * @ref Flag "Flag::DiffuseTexture" or @ref Flag "Flag::SpecularTexture" + * is set. + */ + typedef Attribute<2, Vector2> TextureCoordinates; + + enum: Int { + /** + * Layer for ambient texture. Used only if @ref Flag "Flag::AmbientTexture" + * is set. + */ + AmbientTextureLayer = 0, + + /** + * Layer for diffuse texture. Used only if @ref Flag "Flag::DiffuseTexture" + * is set. + */ + DiffuseTextureLayer = 1, + + /** + * Layer for specular texture. Used only if @ref Flag "Flag::SpecularTexture" + * is set. + */ + SpecularTextureLayer = 2 + }; + + /** + * @brief Shader flag + * + * @see @ref Flags, @ref flags() + */ + enum class Flag: UnsignedByte { + AmbientTexture = 1 << 0, /**< The shader uses ambient texture instead of color */ + DiffuseTexture = 1 << 1, /**< The shader uses diffuse texture instead of color */ + SpecularTexture = 1 << 2 /**< The shader uses specular texture instead of color */ + }; + + /** + * @brief Shader flags + * + * @see @ref flags() + */ + typedef Containers::EnumSet Flags; + + /** + * @brief Constructor + * @param flags Shader flags + */ + explicit Phong(Flags flags = Flags()); + + /** @brief Shader flags */ + Flags flags() const { return _flags; } /** * @brief Set ambient color * @return Pointer to self (for method chaining) * - * If not set, default value is `(0.0f, 0.0f, 0.0f)`. + * If not set, default value is `(0.0f, 0.0f, 0.0f)`. Has no effect if + * @ref Flag "Flag::AmbientTexture" is set. */ - Phong* setAmbientColor(const Color3& color) { - setUniform(ambientColorUniform, color); - return this; - } + Phong* setAmbientColor(const Color3& color); /** * @brief Set diffuse color * @return Pointer to self (for method chaining) + * + * Has no effect if @ref Flag "Flag::AmbientTexture" is used. */ - Phong* setDiffuseColor(const Color3& color) { - setUniform(diffuseColorUniform, color); - return this; - } + Phong* setDiffuseColor(const Color3& color); /** * @brief Set specular color * @return Pointer to self (for method chaining) * - * If not set, default value is `(1.0f, 1.0f, 1.0f)`. + * If not set, default value is `(1.0f, 1.0f, 1.0f)`. Has no effect if + * @ref Flag "Flag::SpecularTexture" is set. */ - Phong* setSpecularColor(const Color3& color) { - setUniform(specularColorUniform, color); - return this; - } + Phong* setSpecularColor(const Color3& color); /** * @brief Set shininess @@ -149,8 +212,27 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { specularColorUniform, lightColorUniform, shininessUniform; + + Flags _flags; }; +CORRADE_ENUMSET_OPERATORS(Phong::Flags) + +inline Phong* Phong::setAmbientColor(const Color3& color) { + if(!(_flags & Flag::AmbientTexture)) setUniform(ambientColorUniform, color); + return this; +} + +inline Phong* Phong::setDiffuseColor(const Color3& color) { + if(!(_flags & Flag::DiffuseTexture)) setUniform(diffuseColorUniform, color); + return this; +} + +inline Phong* Phong::setSpecularColor(const Color3& color) { + if(!(_flags & Flag::SpecularTexture)) setUniform(specularColorUniform, color); + return this; +} + }} #endif diff --git a/src/Shaders/Phong.vert b/src/Shaders/Phong.vert index c52eb30f9..cdd51147d 100644 --- a/src/Shaders/Phong.vert +++ b/src/Shaders/Phong.vert @@ -47,6 +47,15 @@ in highp vec4 position; in mediump vec3 normal; #endif +#ifdef TEXTURED +#ifdef EXPLICIT_ATTRIB_LOCATION +layout(location = 2) in mediump vec2 textureCoords; +#else +in mediump vec2 textureCoords; +#endif +out mediump vec2 interpolatedTextureCoords; +#endif + out mediump vec3 transformedNormal; out highp vec3 lightDirection; out highp vec3 cameraDirection; @@ -67,4 +76,9 @@ void main() { /* Transform the position */ gl_Position = projectionMatrix*transformedPosition4; + + #ifdef TEXTURED + /* Texture coordinates, if needed */ + interpolatedTextureCoords = textureCoords; + #endif } From c3a5c77f1c6108f5e9a2761087f3a16bafeafde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 18:34:24 +0200 Subject: [PATCH 75/90] Documentation clarification and fixes. --- doc/method-chaining.dox | 17 +++++++++-------- src/CubeMapTextureArray.h | 4 ++-- src/Mesh.h | 10 +++++----- src/Texture.h | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/method-chaining.dox b/doc/method-chaining.dox index 3c8f99407..19cc2d7e1 100644 --- a/doc/method-chaining.dox +++ b/doc/method-chaining.dox @@ -32,14 +32,15 @@ feature which allows you to chain method calls one after another without repeatedly specifying variable the method is called on. Its primary goal is to reduce unnecessary repeated names, improving code readability. -%Magnum uses this feature for configuring OpenGL objects (such as various mesh -and framebuffer options, shader uniforms etc.). Because OpenGL was designed with -"bind-to-modify" approach, most configuration calls need to bind the object -first and only after that change the parameters (unless @extension{EXT,direct_state_access} -extension is available to avoid this). To reduce unneeded bind calls, %Magnum -binds the object only if it is not already bound somewhere. Method chaining -encourages you to configure whole object in one run, effectively reducing the -number of needed bindings. Consider the following example: +%Magnum uses this feature mainly for configuring OpenGL objects (such as +various mesh and framebuffer options, shader uniforms etc.). Because OpenGL was +designed with "bind-to-modify" approach, most configuration calls internally +need to bind the object first and only after that change the parameters (unless +@extension{EXT,direct_state_access} extension is available to avoid this). To +reduce unneeded bind calls, %Magnum binds the object only if it is not already +bound somewhere. Method chaining encourages you to configure whole object in +one run, effectively reducing the number of needed bindings. Consider the +following example: @code Texture2D *carDiffuseTexture, *carSpecularTexture, *carBumpTexture; diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index 617e3066d..1529d295a 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -59,8 +59,8 @@ for(std::size_t i = 0; i != 16; ++i) { void* dataPositiveX = ...; Image2D imagePositiveX({64, 64}, ImageFormat::RGBA, ImageType::UnsignedByte, imagePositiveX); // ... - texture->setSubImage(i, CubeMapTextureArray::Coordinate::PositiveX, 0, {}, imagePositiveX); - texture->setSubImage(i, CubeMapTextureArray::Coordinate::NegativeX, 0, {}, imageNegativeX); + texture.setSubImage(i, CubeMapTextureArray::Coordinate::PositiveX, 0, {}, imagePositiveX); + texture.setSubImage(i, CubeMapTextureArray::Coordinate::NegativeX, 0, {}, imageNegativeX); // ... } diff --git a/src/Mesh.h b/src/Mesh.h index a68d8bbe7..00f744af0 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -96,13 +96,13 @@ mesh->setPrimitive(Mesh::Primitive::Triangles) @code // Non-indexed primitive with positions and normals -Primitives::Plane plane; +Trade::MeshData3D plane = Primitives::Plane::solid(); Mesh* mesh; Buffer* vertexBuffer; // Fill vertex buffer with interleaved position and normal data MeshTools::interleave(mesh, buffer, Buffer::Usage::StaticDraw, - *plane.positions(0), *plane.normals(0)); + plane.positions(0), plane.normals(0)); // Set primitive and specify layout of interleaved vertex buffer, vertex count // has been already set by MeshTools::interleave() @@ -146,17 +146,17 @@ mesh->setPrimitive(Mesh::Primitive::Triangles) @code // Indexed primitive -Primitives::Cube cube; +Trade::MeshData3D cube = Primitives::Cube::solid(); Buffer *vertexBuffer, *indexBuffer; Mesh* mesh; // Fill vertex buffer with interleaved position and normal data MeshTools::interleave(mesh, vertexBuffer, Buffer::Usage::StaticDraw, - *cube.positions(0), *cube.normals(0)); + cube.positions(0), cube.normals(0)); // Fill index buffer with compressed index data MeshTools::compressIndices(mesh, indexBuffer, Buffer::Usage::StaticDraw, - *cube.indices()); + cube.indices()); // Set primitive and specify layout of interleaved vertex buffer. Index count // and index buffer has been already specified by MeshTools::compressIndices(). diff --git a/src/Texture.h b/src/Texture.h index 70a0115a4..fee04c0e3 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -89,7 +89,7 @@ texture.setMagnificationFilter(Sampler::Filter::Linear) for(std::size_t i = 0; i != 16; ++i) { void* data = ...; Image2D image({64, 64}, ImageFormat::RGBA, ImageType::UnsignedByte, image); - texture->setSubImage(0, Vector3i::zAxis(i), image); + texture.setSubImage(0, Vector3i::zAxis(i), image); } // ... From d04b308aa3710c784813e968a8a3154cb6362d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 19:26:54 +0200 Subject: [PATCH 76/90] Reducing pointer chasings, part 1: method chaining via references. Makes some cases less consistent (and some convenience shortcuts impossible), but goes well with the attitude "don't use pointer when it can't be null". --- doc/debug-tools.dox | 2 +- doc/method-chaining.dox | 45 +++---- doc/scenegraph.dox | 4 +- src/AbstractFramebuffer.cpp | 4 +- src/AbstractFramebuffer.h | 4 +- src/AbstractShaderProgram.h | 18 +-- src/AbstractTexture.cpp | 12 +- src/AbstractTexture.h | 26 ++-- src/Buffer.h | 67 +++++----- src/CubeMapTexture.h | 54 ++++----- src/CubeMapTextureArray.h | 50 ++++---- src/DebugTools/ForceRenderer.cpp | 12 +- src/DebugTools/ForceRenderer.h | 18 +-- .../Implementation/AbstractShapeRenderer.cpp | 8 +- .../Implementation/AxisAlignedBoxRenderer.cpp | 4 +- src/DebugTools/Implementation/BoxRenderer.cpp | 4 +- .../Implementation/LineSegmentRenderer.cpp | 4 +- .../Implementation/PointRenderer.cpp | 4 +- .../Implementation/SphereRenderer.cpp | 4 +- src/DebugTools/ObjectRenderer.cpp | 8 +- src/DebugTools/ObjectRenderer.h | 9 +- src/DebugTools/ShapeRenderer.h | 22 ++-- src/DefaultFramebuffer.cpp | 4 +- src/DefaultFramebuffer.h | 20 +-- src/Framebuffer.cpp | 8 +- src/Framebuffer.h | 48 ++++---- src/Mesh.cpp | 4 +- src/Mesh.h | 114 +++++++++--------- src/MeshTools/CompressIndices.cpp | 2 +- src/Platform/AbstractXApplication.h | 4 +- src/ResourceManager.h | 46 +++---- src/SceneGraph/AbstractCamera.h | 4 +- src/SceneGraph/AbstractCamera.hpp | 4 +- src/SceneGraph/AbstractTransformation.h | 6 +- .../AbstractTranslationRotation2D.h | 16 +-- .../AbstractTranslationRotation3D.h | 34 +++--- .../AbstractTranslationRotationScaling2D.h | 18 +-- .../AbstractTranslationRotationScaling3D.h | 30 ++--- src/SceneGraph/Animable.h | 22 ++-- src/SceneGraph/Animable.hpp | 8 +- src/SceneGraph/Camera2D.h | 14 +-- src/SceneGraph/Camera2D.hpp | 4 +- src/SceneGraph/Camera3D.h | 22 ++-- src/SceneGraph/Camera3D.hpp | 12 +- src/SceneGraph/Drawable.h | 12 +- src/SceneGraph/DualComplexTransformation.h | 42 +++---- src/SceneGraph/DualQuaternionTransformation.h | 42 +++---- src/SceneGraph/FeatureGroup.h | 18 +-- src/SceneGraph/MatrixTransformation2D.h | 40 +++--- src/SceneGraph/MatrixTransformation3D.h | 52 ++++---- src/SceneGraph/Object.h | 8 +- src/SceneGraph/Object.hpp | 14 +-- src/SceneGraph/RigidMatrixTransformation2D.h | 48 ++++---- src/SceneGraph/RigidMatrixTransformation3D.h | 60 ++++----- src/SceneGraph/Test/AnimableTest.cpp | 7 +- .../Test/DualQuaternionTransformationTest.cpp | 12 +- .../Test/MatrixTransformation3DTest.cpp | 12 +- .../Test/RigidMatrixTransformation3DTest.cpp | 12 +- src/Shaders/DistanceFieldVector.h | 33 ++--- src/Shaders/Flat.h | 12 +- src/Shaders/MeshVisualizer.h | 38 +++--- src/Shaders/Phong.h | 60 ++++----- src/Shaders/Vector.h | 12 +- src/Shaders/VertexColor.h | 6 +- src/Shapes/Shape.h | 8 +- src/Text/DistanceFieldGlyphCache.cpp | 6 +- src/Text/GlyphCache.cpp | 6 +- src/Text/TextRenderer.cpp | 6 +- src/Text/TextRenderer.h | 22 ++-- src/Texture.h | 66 +++++----- src/TextureTools/DistanceField.cpp | 18 +-- src/Timeline.h | 8 +- 72 files changed, 754 insertions(+), 753 deletions(-) diff --git a/doc/debug-tools.dox b/doc/debug-tools.dox index afbed3e3e..517fee209 100644 --- a/doc/debug-tools.dox +++ b/doc/debug-tools.dox @@ -63,7 +63,7 @@ SceneGraph::DrawableGroup3D debugDrawables; // Create renderer options which will be referenced later by "my" resource key DebugTools::ResourceManager::instance()->set("my", - (new DebugTools::ObjectRendererOptions)->setSize(0.3f)); + DebugTools::ObjectRendererOptions().setSize(0.3f)); // Create debug renderer for given object, use "my" options for it. The // renderer is automatically added to the object features and also to diff --git a/doc/method-chaining.dox b/doc/method-chaining.dox index 19cc2d7e1..2eb2b8cd2 100644 --- a/doc/method-chaining.dox +++ b/doc/method-chaining.dox @@ -42,17 +42,17 @@ bound somewhere. Method chaining encourages you to configure whole object in one run, effectively reducing the number of needed bindings. Consider the following example: @code -Texture2D *carDiffuseTexture, *carSpecularTexture, *carBumpTexture; +Texture2D carDiffuseTexture, carSpecularTexture, carBumpTexture; -carDiffuseTexture->setStorage(5, TextureFormat::SRGB8); -carSpecularTexture->setStorage(3, TextureFormat::R8); -carBumpTexture->setStorage(5, TextureFormat::RGB8); -carDiffuseTexture->setSubImage(0, {}, diffuse); -carSpecularTexture->setSubImage(0, {}, specular; -carBumpTexture->setSubImage(0, {}, bump); -carDiffuseTexture->generateMipmap(); -carSpecularTexture->generateMipmap(); -carBumpTexture->generateMipmap(); +carDiffuseTexture.setStorage(5, TextureFormat::SRGB8); +carSpecularTexture.setStorage(3, TextureFormat::R8); +carBumpTexture.setStorage(5, TextureFormat::RGB8); +carDiffuseTexture.setSubImage(0, {}, diffuse); +carSpecularTexture.setSubImage(0, {}, specular; +carBumpTexture.setSubImage(0, {}, bump); +carDiffuseTexture.generateMipmap(); +carSpecularTexture.generateMipmap(); +carBumpTexture.generateMipmap(); @endcode This code is written that similar configuration steps are grouped together, @@ -62,15 +62,15 @@ names and after each configuration step the texture must be rebound to another. With method chaining used the code looks much lighter and each object is configured in one run, reducing count of bind calls from 9 to 3. @code -carDiffuseTexture->setStorage(5, TextureFormat::SRGB8) - ->setSubImage(0, {}, diffuse) - ->generateMipmap(); -carSpecularTexture->setStorage(3, TextureFormat::R8) - ->setSubImage(0, {}, diffuse) - ->generateMipmap(); -carBumpTexture->setStorage(5, TextureFormat::RGB8) - ->setSubImage(0, {}, bump) - ->generateMipmap(); +carDiffuseTexture.setStorage(5, TextureFormat::SRGB8) + .setSubImage(0, {}, diffuse) + .generateMipmap(); +carSpecularTexture.setStorage(3, TextureFormat::R8) + .setSubImage(0, {}, diffuse) + .generateMipmap(); +carBumpTexture.setStorage(5, TextureFormat::RGB8) + .setSubImage(0, {}, bump) + .generateMipmap(); @endcode Method chaining is not used on non-configuring functions, such as Framebuffer::clear() @@ -85,12 +85,7 @@ Scene3D scene; (new MyObject(&scene)) ->rotateX(90.0_degf) - ->translate({-1.5f, 0.5f, 7.0f}); + .translate({-1.5f, 0.5f, 7.0f}); @endcode - -In most cases method chaining methods return pointer to the object, because -most of the objects are commonly created on the heap. The only exception are -Shader methods, which return reference, because the class is commonly created -as local variable in shader constructors. */ } diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index e72d7cf42..9cd506d36 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -109,8 +109,8 @@ transformation. For convenience you can use method chaining: @code Object3D* next = new Object3D; next->setParent(another) - ->translate(Vector3::yAxis(3.0f)) - ->rotateY(35.0_degf); + .translate(Vector3::yAxis(3.0f)) + .rotateY(35.0_degf); @endcode @section scenegraph-features Object features diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index 3a4ba0bb2..4feffb268 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/AbstractFramebuffer.cpp @@ -108,14 +108,14 @@ void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& #endif } -AbstractFramebuffer* AbstractFramebuffer::setViewport(const Rectanglei& rectangle) { +AbstractFramebuffer& AbstractFramebuffer::setViewport(const Rectanglei& rectangle) { _viewport = rectangle; /* Update the viewport if the framebuffer is currently bound */ if(Context::current()->state()->framebuffer->drawBinding == _id) setViewportInternal(); - return this; + return *this; } void AbstractFramebuffer::setViewportInternal() { diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index 25f4efa09..8e8df7f9f 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -207,14 +207,14 @@ class MAGNUM_EXPORT AbstractFramebuffer { /** * @brief Set viewport - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Saves the viewport to be used at later time in bind(). If the * framebuffer is currently bound, updates the viewport to given * rectangle. * @see @fn_gl{Viewport} */ - AbstractFramebuffer* setViewport(const Rectanglei& rectangle); + AbstractFramebuffer& setViewport(const Rectanglei& rectangle); /** * @brief Clear specified buffers in framebuffer diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index bf0608108..8f3b0262d 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -101,13 +101,13 @@ MyShader() { protected setUniform() functions. For usability purposes you can implement also method chaining. Example: @code -MyShader* setTransformation(const Matrix4& matrix) { +MyShader& setTransformation(const Matrix4& matrix) { setUniform(TransformationUniform, matrix); - return this; + return *this; } -MyShader* setProjection(const Matrix4& matrix) { +MyShader& setProjection(const Matrix4& matrix) { setUniform(ProjectionUniform, matrix); - return this; + return *this; } @endcode @@ -219,12 +219,12 @@ specific framebuffer (if needed) and bind required textures to their respective layers using AbstractTexture::bind(Int). Then call Mesh::draw(). Example: @code -shader->setTransformation(transformation) - ->setProjection(projection) - ->use(); +shader.setTransformation(transformation) + .setProjection(projection) + .use(); -diffuseTexture->bind(MyShader::DiffuseTextureLayer); -specularTexture->bind(MyShader::SpecularTextureLayer); +diffuseTexture.bind(MyShader::DiffuseTextureLayer); +specularTexture.bind(MyShader::SpecularTextureLayer); mesh.draw(); @endcode diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 3bffa9ed5..6eaf638ac 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -145,23 +145,23 @@ void AbstractTexture::bindImplementationDSA(GLint layer) { } #endif -AbstractTexture* AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) { +AbstractTexture& AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) { #ifndef MAGNUM_TARGET_GLES - CORRADE_ASSERT(_target != GL_TEXTURE_RECTANGLE || mipmap == Sampler::Mipmap::Base, "AbstractTexture: rectangle textures cannot have mipmaps", this); + CORRADE_ASSERT(_target != GL_TEXTURE_RECTANGLE || mipmap == Sampler::Mipmap::Base, "AbstractTexture: rectangle textures cannot have mipmaps", *this); #endif (this->*parameteriImplementation)(GL_TEXTURE_MIN_FILTER, static_cast(filter)|static_cast(mipmap)); - return this; + return *this; } -AbstractTexture* AbstractTexture::generateMipmap() { +AbstractTexture& AbstractTexture::generateMipmap() { #ifndef MAGNUM_TARGET_GLES - CORRADE_ASSERT(_target != GL_TEXTURE_RECTANGLE, "AbstractTexture: rectangle textures cannot have mipmaps", this); + CORRADE_ASSERT(_target != GL_TEXTURE_RECTANGLE, "AbstractTexture: rectangle textures cannot have mipmaps", *this); #endif (this->*mipmapImplementation)(); - return this; + return *this; } void AbstractTexture::mipmapImplementationDefault() { diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 422086634..9f34b50f5 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -141,7 +141,7 @@ class MAGNUM_EXPORT AbstractTexture { * @param mipmap Mipmap filtering. If set to anything else than * BaseMipLevel, make sure textures for all mip levels are set or * call generateMipmap(). - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets filter used when the object pixel size is smaller than the * texture size. If @extension{EXT,direct_state_access} is not @@ -155,12 +155,12 @@ class MAGNUM_EXPORT AbstractTexture { * or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * with @def_gl{TEXTURE_MIN_FILTER} */ - AbstractTexture* setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base); + AbstractTexture& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base); /** * @brief Set magnification filter * @param filter Filter - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets filter used when the object pixel size is larger than largest * texture size. If @extension{EXT,direct_state_access} is not @@ -170,15 +170,15 @@ class MAGNUM_EXPORT AbstractTexture { * or @fn_gl_extension{TextureParameter,EXT,direct_state_access} * with @def_gl{TEXTURE_MAG_FILTER} */ - AbstractTexture* setMagnificationFilter(Sampler::Filter filter) { + AbstractTexture& setMagnificationFilter(Sampler::Filter filter) { (this->*parameteriImplementation)(GL_TEXTURE_MAG_FILTER, static_cast(filter)); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES3 /** * @brief Set border color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Border color when wrapping is set to @ref Sampler::Wrapping "Sampler::Wrapping::ClampToBorder". * If @extension{EXT,direct_state_access} is not available, the texture @@ -189,18 +189,18 @@ class MAGNUM_EXPORT AbstractTexture { * with @def_gl{TEXTURE_BORDER_COLOR} * @requires_es_extension %Extension @es_extension{NV,texture_border_clamp} */ - AbstractTexture* setBorderColor(const Color4& color) { + AbstractTexture& setBorderColor(const Color4& color) { #ifndef MAGNUM_TARGET_GLES (this->*parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); #else (this->*parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR_NV, color.data()); #endif - return this; + return *this; } /** * @brief Set max anisotropy - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default value is `1.0f`, which means no anisotropy. Set to value * greater than `1.0f` for anisotropic filtering. If @@ -213,9 +213,9 @@ class MAGNUM_EXPORT AbstractTexture { * @requires_extension %Extension @extension{EXT,texture_filter_anisotropic} * @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic} */ - AbstractTexture* setMaxAnisotropy(Float anisotropy) { + AbstractTexture& setMaxAnisotropy(Float anisotropy) { (this->*parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); - return this; + return *this; } #endif @@ -234,7 +234,7 @@ class MAGNUM_EXPORT AbstractTexture { /** * @brief Generate mipmap - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Can not be used for rectangle textures. If * @extension{EXT,direct_state_access} is not available, the texture @@ -244,7 +244,7 @@ class MAGNUM_EXPORT AbstractTexture { * @fn_gl_extension{GenerateTextureMipmap,EXT,direct_state_access} * @requires_gl30 %Extension @extension{ARB,framebuffer_object} */ - AbstractTexture* generateMipmap(); + AbstractTexture& generateMipmap(); protected: /** diff --git a/src/Buffer.h b/src/Buffer.h index c16ac8c87..4076fa8ea 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -490,7 +490,7 @@ class MAGNUM_EXPORT Buffer { /** * @brief Set target hint - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available, the buffer * must be internally bound to some target before any operation. You @@ -503,9 +503,9 @@ class MAGNUM_EXPORT Buffer { * http://www.opengl.org/wiki/Vertex_Specification#Index_buffers * ... damned GL state */ - Buffer* setTargetHint(Target hint) { + Buffer& setTargetHint(Target hint) { _targetHint = hint; - return this; + return *this; } /** @@ -569,7 +569,7 @@ class MAGNUM_EXPORT Buffer { * @param size Data size * @param data Pointer to data * @param usage %Buffer usage - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * buffer is not already bound somewhere, it is bound to hinted target @@ -577,25 +577,25 @@ class MAGNUM_EXPORT Buffer { * @see setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{BufferData} or * @fn_gl_extension{NamedBufferData,EXT,direct_state_access} */ - Buffer* setData(GLsizeiptr size, const GLvoid* data, Usage usage) { + Buffer& setData(GLsizeiptr size, const GLvoid* data, Usage usage) { (this->*dataImplementation)(size, data, usage); - return this; + return *this; } /** * @brief Set buffer data * @param data Fixed-size array with data * @param usage %Buffer usage - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setData(GLsizeiptr, const GLvoid*, Usage). */ #ifdef CORRADE_GCC46_COMPATIBILITY #define size size_ /* With GCC 4.6 it conflicts with size(). WTF. */ #endif - template Buffer* setData(const T(&data)[size], Usage usage) { + template Buffer& setData(const T(&data)[size], Usage usage) { setData(size*sizeof(T), data, usage); - return this; + return *this; } #ifdef CORRADE_GCC46_COMPATIBILITY #undef size @@ -605,18 +605,19 @@ class MAGNUM_EXPORT Buffer { * @brief Set buffer data * @param data Vector with data * @param usage %Buffer usage - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setData(GLsizeiptr, const GLvoid*, Usage) */ - template Buffer* setData(const std::vector& data, Usage usage) { + template Buffer& setData(const std::vector& data, Usage usage) { setData(data.size()*sizeof(T), data.data(), usage); - return this; + return *this; } /** @overload */ - template void setData(const std::array& data, Usage usage) { + template Buffer& setData(const std::array& data, Usage usage) { setData(data.size()*sizeof(T), data.data(), usage); + return *this; } /** @@ -624,7 +625,7 @@ class MAGNUM_EXPORT Buffer { * @param offset Offset in the buffer * @param size Data size * @param data Pointer to data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * buffer is not already bound somewhere, it is bound to hinted target @@ -632,25 +633,25 @@ class MAGNUM_EXPORT Buffer { * @see setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{BufferSubData} * or @fn_gl_extension{NamedBufferSubData,EXT,direct_state_access} */ - Buffer* setSubData(GLintptr offset, GLsizeiptr size, const GLvoid* data) { + Buffer& setSubData(GLintptr offset, GLsizeiptr size, const GLvoid* data) { (this->*subDataImplementation)(offset, size, data); - return this; + return *this; } /** * @brief Set buffer subdata * @param offset Offset in the buffer * @param data Fixed-size array with data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setSubData(GLintptr, GLsizeiptr, const GLvoid*) */ #ifdef CORRADE_GCC46_COMPATIBILITY #define size size_ /* With GCC 4.6 it conflicts with size(). WTF. */ #endif - template Buffer* setSubData(GLintptr offset, const T(&data)[size]) { + template Buffer& setSubData(GLintptr offset, const T(&data)[size]) { setSubData(offset, size*sizeof(T), data); - return this; + return *this; } #ifdef CORRADE_GCC46_COMPATIBILITY #undef size @@ -660,48 +661,48 @@ class MAGNUM_EXPORT Buffer { * @brief Set buffer subdata * @param offset Offset in the buffer * @param data Vector with data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setSubData(GLintptr, GLsizeiptr, const GLvoid*) */ - template Buffer* setSubData(GLintptr offset, const std::vector& data) { + template Buffer& setSubData(GLintptr offset, const std::vector& data) { setSubData(offset, data.size()*sizeof(T), data.data()); - return this; + return *this; } /** @overload */ - template Buffer* setSubData(GLintptr offset, const std::array& data) { + template Buffer& setSubData(GLintptr offset, const std::array& data) { setSubData(offset, data.size()*sizeof(T), data.data()); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES /** * @brief Invalidate buffer data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} * is not available, this function does nothing. * @see @ref MapFlag "MapFlag::InvalidateBuffer", @fn_gl{InvalidateBufferData} */ - Buffer* invalidateData() { + Buffer& invalidateData() { (this->*invalidateImplementation)(); - return this; + return *this; } /** * @brief Invalidate buffer subdata * @param offset Offset into the buffer * @param length Length of the invalidated range - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If running on OpenGL ES or extension @extension{ARB,invalidate_subdata} * is not available, this function does nothing. * @see @ref MapFlag "MapFlag::InvalidateRange", @fn_gl{InvalidateBufferData} */ - Buffer* invalidateSubData(GLintptr offset, GLsizeiptr length) { + Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length) { (this->*invalidateSubImplementation)(offset, length); - return this; + return *this; } #endif @@ -772,7 +773,7 @@ class MAGNUM_EXPORT Buffer { * @brief Flush mapped range * @param offset Offset relative to start of mapped range * @param length Length of the flushed memory - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Flushes specified subsection of mapped range. Use only if you called * map() with @ref MapFlag "MapFlag::FlushExplicit" flag. See @@ -786,9 +787,9 @@ class MAGNUM_EXPORT Buffer { * @requires_gl30 %Extension @extension{ARB,map_buffer_range} * @requires_gles30 %Extension @es_extension{EXT,map_buffer_range} */ - Buffer* flushMappedRange(GLintptr offset, GLsizeiptr length) { + Buffer& flushMappedRange(GLintptr offset, GLsizeiptr length) { (this->*flushMappedRangeImplementation)(offset, length); - return this; + return *this; } /** diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 7d93fbb4a..352223448 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -60,9 +60,9 @@ Image2D positiveX({256, 256}, ImageFormat::RGBA, ImageType::UnsignedByte, dataPo CubeMapTexture texture; texture.setMagnificationFilter(Sampler::Filter::Linear) // ... - ->setStorage(Math::log2(256)+1, TextureFormat::RGBA8, {256, 256}) - ->setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, &positiveX) - ->setSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, &negativeX) + .setStorage(Math::log2(256)+1, TextureFormat::RGBA8, {256, 256}) + .setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, &positiveX) + .setSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, &negativeX) // ... @endcode @@ -101,9 +101,9 @@ class CubeMapTexture: public AbstractTexture { * * See Texture::setWrapping() for more information. */ - CubeMapTexture* setWrapping(const Array3D& wrapping) { + CubeMapTexture& setWrapping(const Array3D& wrapping) { DataHelper<3>::setWrapping(this, wrapping); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES @@ -125,9 +125,9 @@ class CubeMapTexture: public AbstractTexture { * * See Texture::setStorage() for more information. */ - CubeMapTexture* setStorage(Int levels, TextureFormat internalFormat, const Vector2i& size) { + CubeMapTexture& setStorage(Int levels, TextureFormat internalFormat, const Vector2i& size) { DataHelper<2>::setStorage(this, _target, levels, internalFormat, size); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES @@ -166,20 +166,20 @@ class CubeMapTexture: public AbstractTexture { * @param level Mip level * @param internalFormat Internal format * @param image %Image - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * See Texture::setImage() for more information. */ - CubeMapTexture* setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, const ImageReference2D& image) { + CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, const ImageReference2D& image) { DataHelper<2>::setImage(this, static_cast(coordinate), level, internalFormat, image); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - CubeMapTexture* setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) { + CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) { DataHelper<2>::setImage(this, static_cast(coordinate), level, internalFormat, image); - return this; + return *this; } #endif @@ -189,20 +189,20 @@ class CubeMapTexture: public AbstractTexture { * @param level Mip level * @param offset Offset where to put data in the texture * @param image %Image - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * See Texture::setSubImage() for more information. */ - CubeMapTexture* setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const ImageReference2D& image) { + CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const ImageReference2D& image) { DataHelper<2>::setSubImage(this, static_cast(coordinate), level, offset, image); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - CubeMapTexture* setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image) { + CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image) { DataHelper<2>::setSubImage(this, static_cast(coordinate), level, offset, image); - return this; + return *this; } #endif @@ -224,27 +224,27 @@ class CubeMapTexture: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - CubeMapTexture* setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { + CubeMapTexture& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); - return this; + return *this; } - CubeMapTexture* setMagnificationFilter(Sampler::Filter filter) { + CubeMapTexture& setMagnificationFilter(Sampler::Filter filter) { AbstractTexture::setMagnificationFilter(filter); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES3 - CubeMapTexture* setBorderColor(const Color4& color) { + CubeMapTexture& setBorderColor(const Color4& color) { AbstractTexture::setBorderColor(color); - return this; + return *this; } - CubeMapTexture* setMaxAnisotropy(Float anisotropy) { + CubeMapTexture& setMaxAnisotropy(Float anisotropy) { AbstractTexture::setMaxAnisotropy(anisotropy); - return this; + return *this; } #endif - CubeMapTexture* generateMipmap() { + CubeMapTexture& generateMipmap() { AbstractTexture::generateMipmap(); - return this; + return *this; } #endif }; diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index 1529d295a..921a10ad5 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -53,7 +53,7 @@ Image3D dummy({64, 64, 16*6}, ImageFormat::RGBA, ImageType::UnsignedByte, nullpt CubeMapTextureArray texture; texture.setMagnificationFilter(Sampler::Filter::Linear) // ... - ->setStorage(Math::log2(64)+1, TextureFormat::RGBA8, {64, 64, 16}); + .setStorage(Math::log2(64)+1, TextureFormat::RGBA8, {64, 64, 16}); for(std::size_t i = 0; i != 16; ++i) { void* dataPositiveX = ...; @@ -105,9 +105,9 @@ class CubeMapTextureArray: public AbstractTexture { * * See Texture::setWrapping() for more information. */ - CubeMapTextureArray* setWrapping(const Array3D& wrapping) { + CubeMapTextureArray& setWrapping(const Array3D& wrapping) { DataHelper<3>::setWrapping(this, wrapping); - return this; + return *this; } /** @@ -126,9 +126,9 @@ class CubeMapTextureArray: public AbstractTexture { * * See Texture::setStorage() for more information. */ - CubeMapTextureArray* setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) { + CubeMapTextureArray& setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) { DataHelper<3>::setStorage(this, _target, levels, internalFormat, size); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES @@ -167,7 +167,7 @@ class CubeMapTextureArray: public AbstractTexture { * @param internalFormat Internal format * @param image Image, ImageReference, BufferImage or * Trade::ImageData of the same dimension count - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets texture image data from three-dimensional image for all cube * faces for all layers. Each group of 6 2D images is one cube map @@ -175,15 +175,15 @@ class CubeMapTextureArray: public AbstractTexture { * * See Texture::setImage() for more information. */ - CubeMapTextureArray* setImage(Int level, TextureFormat internalFormat, const ImageReference3D& image) { + CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, const ImageReference3D& image) { DataHelper<3>::setImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); - return this; + return *this; } /** @overload */ - CubeMapTextureArray* setImage(Int level, TextureFormat internalFormat, BufferImage3D& image) { + CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, BufferImage3D& image) { DataHelper<3>::setImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); - return this; + return *this; } /** @@ -192,7 +192,7 @@ class CubeMapTextureArray: public AbstractTexture { * @param offset Offset where to put data in the texture * @param image Image3D, ImageReference3D, BufferImage3D or * Trade::ImageData3D - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets texture image subdata for more than one level/face at once. * @@ -205,15 +205,15 @@ class CubeMapTextureArray: public AbstractTexture { * * @see setSubImage(Int, Coordinate, Int, const Math::Vector<2, Int>&, const Image*) */ - CubeMapTextureArray* setSubImage(Int level, const Vector3i& offset, const ImageReference3D& image) { + CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, const ImageReference3D& image) { DataHelper<3>::setSubImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); - return this; + return *this; } /** @overload */ - CubeMapTextureArray* setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) { + CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) { DataHelper<3>::setSubImage(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image); - return this; + return *this; } /** @@ -234,27 +234,27 @@ class CubeMapTextureArray: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - CubeMapTextureArray* setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { + CubeMapTextureArray& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); - return this; + return *this; } - CubeMapTextureArray* setMagnificationFilter(Sampler::Filter filter) { + CubeMapTextureArray& setMagnificationFilter(Sampler::Filter filter) { AbstractTexture::setMagnificationFilter(filter); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES3 - CubeMapTextureArray* setBorderColor(const Color4& color) { + CubeMapTextureArray& setBorderColor(const Color4& color) { AbstractTexture::setBorderColor(color); - return this; + return *this; } - CubeMapTextureArray* setMaxAnisotropy(Float anisotropy) { + CubeMapTextureArray& setMaxAnisotropy(Float anisotropy) { AbstractTexture::setMaxAnisotropy(anisotropy); - return this; + return *this; } #endif - CubeMapTextureArray* generateMipmap() { + CubeMapTextureArray& generateMipmap() { AbstractTexture::generateMipmap(); - return this; + return *this; } #endif }; diff --git a/src/DebugTools/ForceRenderer.cpp b/src/DebugTools/ForceRenderer.cpp index c5357f9dd..ac0cf7427 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/DebugTools/ForceRenderer.cpp @@ -87,17 +87,17 @@ template ForceRenderer::ForceRenderer(SceneG Mesh* mesh = new Mesh; mesh->setPrimitive(Mesh::Primitive::Lines) - ->setIndexCount(indices.size()) - ->addVertexBuffer(vertexBuffer, 0, + .setIndexCount(indices.size()) + .addVertexBuffer(vertexBuffer, 0, typename Shaders::Flat::Position(Shaders::Flat::Position::Components::Two)) - ->setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, positions.size()); - ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); + .setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, positions.size()); + ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { shader->setTransformationProjectionMatrix(camera->projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), *force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); mesh->draw(); } diff --git a/src/DebugTools/ForceRenderer.h b/src/DebugTools/ForceRenderer.h index 9dacd0986..df5babf4e 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/DebugTools/ForceRenderer.h @@ -51,13 +51,13 @@ class ForceRendererOptions { /** * @brief Set color of rendered arrow - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is 100% opaque white. */ - ForceRendererOptions* setColor(const Color4& color) { + ForceRendererOptions& setColor(const Color4& color) { _color = color; - return this; + return *this; } /** @brief Scale of rendered arrow */ @@ -65,13 +65,13 @@ class ForceRendererOptions { /** * @brief Set scale of rendered arrow - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is `1.0f`. */ - ForceRendererOptions* setSize(Float size) { + ForceRendererOptions& setSize(Float size) { _size = size; - return this; + return *this; } private: @@ -89,9 +89,9 @@ See @ref debug-tools-renderers for more information. Example code: @code -// Create some options -DebugTools::ResourceManager::instance()->set("my", (new DebugTools::ForceRendererOptions) - ->setScale(5.0f)->setColor(Color3::fromHSV(120.0_degf, 1.0f, 0.7f))); +DebugTools::ResourceManager::instance()->set("my", DebugTools::ForceRendererOptions() + .setScale(5.0f) + .setColor(Color3::fromHSV(120.0_degf, 1.0f, 0.7f)); // Create debug renderer for given object, use "my" options for it Object3D* object; diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp index 6ee4d5f4c..40ceea33f 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp +++ b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp @@ -52,8 +52,8 @@ template<> void create<2>(Trade::MeshData2D& data, Resource& meshResource, /* Mesh configuration */ Mesh* mesh = new Mesh; mesh->setPrimitive(data.primitive()) - ->setVertexCount(data.positions(0).size()) - ->addVertexBuffer(buffer, 0, Shaders::Flat2D::Position()); + .setVertexCount(data.positions(0).size()) + .addVertexBuffer(buffer, 0, Shaders::Flat2D::Position()); ResourceManager::instance()->set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); /* Index buffer, if needed, if not, resource key doesn't have to be set */ @@ -74,8 +74,8 @@ template<> void create<3>(Trade::MeshData3D& data, Resource& meshResource, /* Mesh configuration */ Mesh* mesh = new Mesh; mesh->setPrimitive(data.primitive()) - ->setVertexCount(data.positions(0).size()) - ->addVertexBuffer(vertexBuffer, 0, Shaders::Flat3D::Position()); + .setVertexCount(data.positions(0).size()) + .addVertexBuffer(vertexBuffer, 0, Shaders::Flat3D::Position()); ResourceManager::instance()->set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); /* Index buffer, if needed, if not, resource key doesn't have to be set */ diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index 60bd5a346..80e90c22d 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -37,8 +37,8 @@ template void AxisAlignedBoxRenderer::draw(R this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* DimensionTraits::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); this->wireframeMesh->draw(); } diff --git a/src/DebugTools/Implementation/BoxRenderer.cpp b/src/DebugTools/Implementation/BoxRenderer.cpp index c1e443315..245e112a9 100644 --- a/src/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/DebugTools/Implementation/BoxRenderer.cpp @@ -35,8 +35,8 @@ template BoxRenderer::BoxRenderer(const Shap template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); this->wireframeMesh->draw(); } diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/DebugTools/Implementation/LineSegmentRenderer.cpp index b5527d016..8b6cd5020 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -57,8 +57,8 @@ template LineSegmentRenderer::LineSegmentRen template void LineSegmentRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* Implementation::lineSegmentRendererTransformation(line.a(), line.b())) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); this->wireframeMesh->draw(); } diff --git a/src/DebugTools/Implementation/PointRenderer.cpp b/src/DebugTools/Implementation/PointRenderer.cpp index 6e7ab84e7..43459800c 100644 --- a/src/DebugTools/Implementation/PointRenderer.cpp +++ b/src/DebugTools/Implementation/PointRenderer.cpp @@ -57,8 +57,8 @@ template void PointRenderer::draw(ResourcewireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation(point.position())* DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->pointSize()/2))) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); this->wireframeMesh->draw(); } diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/DebugTools/Implementation/SphereRenderer.cpp index 43faf06a1..0a5a25bbb 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/DebugTools/Implementation/SphereRenderer.cpp @@ -49,8 +49,8 @@ template void SphereRenderer::draw(Resource< this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation(sphere.position())* DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(sphere.radius()))) - ->setColor(options->color()) - ->use(); + .setColor(options->color()) + .use(); this->wireframeMesh->draw(); } diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/DebugTools/ObjectRenderer.cpp index 834ce60db..143fcf8b3 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/DebugTools/ObjectRenderer.cpp @@ -165,17 +165,17 @@ template ObjectRenderer::ObjectRenderer(Scen ResourceManager::instance()->set(this->indexBuffer.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); mesh->setPrimitive(Mesh::Primitive::Lines) - ->setIndexCount(Renderer::indices.size()) - ->addInterleavedVertexBuffer(vertexBuffer, 0, + .setIndexCount(Renderer::indices.size()) + .addInterleavedVertexBuffer(vertexBuffer, 0, typename Shaders::VertexColor::Position(), typename Shaders::VertexColor::Color()) - ->setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, Renderer::positions.size()); + .setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, Renderer::positions.size()); ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { shader->setTransformationProjectionMatrix(camera->projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) - ->use(); + .use(); mesh->draw(); } diff --git a/src/DebugTools/ObjectRenderer.h b/src/DebugTools/ObjectRenderer.h index cfc48c73e..df99e2b34 100644 --- a/src/DebugTools/ObjectRenderer.h +++ b/src/DebugTools/ObjectRenderer.h @@ -50,13 +50,13 @@ class ObjectRendererOptions { /** * @brief Set size of the rendered axes - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is `1.0f`. */ - ObjectRendererOptions* setSize(Float size) { + ObjectRendererOptions& setSize(Float size) { _size = size; - return this; + return *this; } private: @@ -74,8 +74,7 @@ Visualizes object position, rotation and scale using colored axes. See Example code: @code // Create some options -DebugTools::ResourceManager::instance()->set("my", (new DebugTools::ObjectRendererOptions) - ->setSize(0.3f)); +DebugTools::ResourceManager::instance()->set("my", DebugTools::ObjectRendererOptions().setSize(0.3f)); // Create debug renderer for given object, use "my" options for it Object3D* object; diff --git a/src/DebugTools/ShapeRenderer.h b/src/DebugTools/ShapeRenderer.h index d3af6f438..0da35cf1c 100644 --- a/src/DebugTools/ShapeRenderer.h +++ b/src/DebugTools/ShapeRenderer.h @@ -73,13 +73,13 @@ class ShapeRendererOptions { /** * @brief Set shape rendering mode - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is @ref RenderMode "RenderMode::Wireframe". */ - ShapeRendererOptions* setRenderMode(RenderMode mode) { + ShapeRendererOptions& setRenderMode(RenderMode mode) { _renderMode = mode; - return this; + return *this; } /** @brief Color of rendered shape */ @@ -87,13 +87,13 @@ class ShapeRendererOptions { /** * @brief Set color of rendered shape - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is 100% opaque white. */ - ShapeRendererOptions* setColor(const Color4& color) { + ShapeRendererOptions& setColor(const Color4& color) { _color = color; - return this; + return *this; } /** @brief Point size */ @@ -101,14 +101,14 @@ class ShapeRendererOptions { /** * @brief Set point size - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Size of rendered crosshairs, representing Shapes::Point shapes. * Default is `0.25f`. */ - ShapeRendererOptions* setPointSize(Float size) { + ShapeRendererOptions& setPointSize(Float size) { _pointSize = size; - return this; + return *this; } private: @@ -128,8 +128,8 @@ Visualizes collision shapes using wireframe primitives. See Example code: @code // Create some options -DebugTools::ResourceManager::instance()->set("red", (new DebugTools::ShapeRendererOptions) - ->setColor({1.0f, 0.0f, 0.0f})); +DebugTools::ResourceManager::instance()->set("red", + DebugTools::ShapeRendererOptions().setColor({1.0f, 0.0f, 0.0f})); // Create debug renderer for given shape, use "red" options for it Shapes::AbstractShape2D* shape; diff --git a/src/DefaultFramebuffer.cpp b/src/DefaultFramebuffer.cpp index 60a628f30..cc6e7789e 100644 --- a/src/DefaultFramebuffer.cpp +++ b/src/DefaultFramebuffer.cpp @@ -37,7 +37,7 @@ DefaultFramebuffer defaultFramebuffer; DefaultFramebuffer::DefaultFramebuffer() { _id = 0; } #ifndef MAGNUM_TARGET_GLES2 -DefaultFramebuffer* DefaultFramebuffer::mapForDraw(std::initializer_list> attachments) { +DefaultFramebuffer& DefaultFramebuffer::mapForDraw(std::initializer_list> attachments) { /* Max attachment location */ std::size_t max = 0; for(const auto& attachment: attachments) @@ -52,7 +52,7 @@ DefaultFramebuffer* DefaultFramebuffer::mapForDraw(std::initializer_list*drawBuffersImplementation)(max+1, _attachments); delete[] _attachments; - return this; + return *this; } #endif diff --git a/src/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index a7e4bb7c0..c860e5d3e 100644 --- a/src/DefaultFramebuffer.h +++ b/src/DefaultFramebuffer.h @@ -309,7 +309,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { #ifndef MAGNUM_TARGET_GLES2 /** * @brief Map shader outputs to buffer attachment - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @p attachments is list of shader outputs mapped to buffer * attachments. %Shader outputs which are not listed are not used, you @@ -328,12 +328,12 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * @requires_gles30 Draw attachments for default framebuffer are * available only in OpenGL ES 3.0. */ - DefaultFramebuffer* mapForDraw(std::initializer_list> attachments); + DefaultFramebuffer& mapForDraw(std::initializer_list> attachments); /** * @brief Map shader output to buffer attachment * @param attachment %Buffer attachment - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Similar to above function, can be used in cases when shader has * only one (unnamed) output. @@ -347,16 +347,16 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * @requires_gles30 Draw attachments for default framebuffer are * available only in OpenGL ES 3.0. */ - DefaultFramebuffer* mapForDraw(DrawAttachment attachment) { + DefaultFramebuffer& mapForDraw(DrawAttachment attachment) { (this->*drawBufferImplementation)(static_cast(attachment)); - return this; + return *this; } #endif /** * @brief Map given attachment for reading * @param attachment %Buffer attachment - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebuffer is not currently bound, it is bound before the @@ -365,9 +365,9 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { * @fn_gl_extension{FramebufferReadBuffer,EXT,direct_state_access} * @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer} */ - DefaultFramebuffer* mapForRead(ReadAttachment attachment) { + DefaultFramebuffer& mapForRead(ReadAttachment attachment) { (this->*readBufferImplementation)(static_cast(attachment)); - return this; + return *this; } /** @@ -403,9 +403,9 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - DefaultFramebuffer* setViewport(const Rectanglei& rectangle) { + DefaultFramebuffer& setViewport(const Rectanglei& rectangle) { AbstractFramebuffer::setViewport(rectangle); - return this; + return *this; } #endif diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index 001f8d71a..fcadfd546 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -67,7 +67,7 @@ Framebuffer::~Framebuffer() { glDeleteFramebuffers(1, &_id); } -Framebuffer* Framebuffer::mapForDraw(std::initializer_list> attachments) { +Framebuffer& Framebuffer::mapForDraw(std::initializer_list> attachments) { /* Max attachment location */ std::size_t max = 0; for(const auto& attachment: attachments) @@ -82,7 +82,7 @@ Framebuffer* Framebuffer::mapForDraw(std::initializer_list*drawBuffersImplementation)(max+1, _attachments); delete[] _attachments; - return this; + return *this; } void Framebuffer::invalidate(std::initializer_list attachments) { @@ -107,10 +107,10 @@ void Framebuffer::invalidate(std::initializer_list attac delete[] _attachments; } -Framebuffer* Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int mipLevel) { +Framebuffer& Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int mipLevel) { /** @todo Check for texture target compatibility */ (this->*texture2DImplementation)(attachment, GLenum(texture->target()), texture->id(), mipLevel); - return this; + return *this; } void Framebuffer::initializeContextBasedFunctionality(Context* context) { diff --git a/src/Framebuffer.h b/src/Framebuffer.h index d7b66ca3e..8e1c84768 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -304,7 +304,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { /** * @brief Map shader output to attachments - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @p attachments is list of shader outputs mapped to framebuffer * color attachment IDs. %Shader outputs which are not listed are not @@ -322,12 +322,12 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access} * @requires_gles30 %Extension @es_extension2{NV,draw_buffers,GL_NV_draw_buffers} */ - Framebuffer* mapForDraw(std::initializer_list> attachments); + Framebuffer& mapForDraw(std::initializer_list> attachments); /** * @brief Map shader output to attachment * @param attachment Draw attachment - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Similar to above function, can be used in cases when shader has * only one (unnamed) output. @@ -340,9 +340,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl{DrawBuffers} in OpenGL ES 3.0 * @requires_gles30 %Extension @es_extension2{NV,draw_buffers,GL_NV_draw_buffers} */ - Framebuffer* mapForDraw(DrawAttachment attachment) { + Framebuffer& mapForDraw(DrawAttachment attachment) { (this->*drawBufferImplementation)(GLenum(attachment)); - return this; + return *this; } /** @@ -379,7 +379,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { /** * @brief Map given color attachment for reading * @param attachment Color attachment - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -388,16 +388,16 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{FramebufferReadBuffer,EXT,direct_state_access} * @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer} */ - Framebuffer* mapForRead(ColorAttachment attachment) { + Framebuffer& mapForRead(ColorAttachment attachment) { (this->*readBufferImplementation)(GLenum(attachment)); - return this; + return *this; } /** * @brief Attach renderbuffer to given buffer * @param attachment %Buffer attachment * @param renderbuffer %Renderbuffer - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -405,9 +405,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see @fn_gl{BindFramebuffer}, @fn_gl{FramebufferRenderbuffer} or * @fn_gl_extension{NamedFramebufferRenderbuffer,EXT,direct_state_access} */ - Framebuffer* attachRenderbuffer(BufferAttachment attachment, Renderbuffer* renderbuffer) { + Framebuffer& attachRenderbuffer(BufferAttachment attachment, Renderbuffer* renderbuffer) { (this->*renderbufferImplementation)(attachment, renderbuffer); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES @@ -416,7 +416,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @param attachment %Buffer attachment * @param texture 1D texture * @param level Mip level - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -425,9 +425,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} * @requires_gl Only 2D and 3D textures are available in OpenGL ES. */ - Framebuffer* attachTexture1D(BufferAttachment attachment, Texture1D* texture, Int level) { + Framebuffer& attachTexture1D(BufferAttachment attachment, Texture1D* texture, Int level) { (this->*texture1DImplementation)(attachment, texture, level); - return this; + return *this; } #endif @@ -436,7 +436,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @param attachment %Buffer attachment * @param texture 2D texture * @param level Mip level - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -444,7 +444,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see attachCubeMapTexture(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ - Framebuffer* attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int level); + Framebuffer& attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int level); /** * @brief Attach cube map texture to given buffer @@ -452,7 +452,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @param texture Cube map texture * @param coordinate Cube map coordinate * @param level Mip level - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -460,9 +460,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see attachTexture2D(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ - Framebuffer* attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, Int level) { + Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, Int level) { (this->*texture2DImplementation)(attachment, GLenum(coordinate), texture->id(), level); - return this; + return *this; } /** @@ -471,7 +471,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @param texture 3D texture * @param level Mip level * @param layer Layer of 2D image within a 3D texture - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available and the * framebufferbuffer is not currently bound, it is bound before the @@ -480,17 +480,17 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} * @requires_es_extension %Extension @es_extension{OES,texture_3D} */ - Framebuffer* attachTexture3D(BufferAttachment attachment, Texture3D* texture, Int level, Int layer) { + Framebuffer& attachTexture3D(BufferAttachment attachment, Texture3D* texture, Int level, Int layer) { /** @todo Check for texture target compatibility */ (this->*texture3DImplementation)(attachment, texture, level, layer); - return this; + return *this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - Framebuffer* setViewport(const Rectanglei& rectangle) { + Framebuffer& setViewport(const Rectanglei& rectangle) { AbstractFramebuffer::setViewport(rectangle); - return this; + return *this; } #endif diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 368ec21a3..d8d519a57 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -117,7 +117,7 @@ Mesh& Mesh::operator=(Mesh&& other) { return *this; } -Mesh* Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { +Mesh& Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { #ifdef CORRADE_TARGET_NACL CORRADE_ASSERT(buffer->targetHint() == Buffer::Target::ElementArray, "Mesh::setIndexBuffer(): the buffer has unexpected target hint, expected" << Buffer::Target::ElementArray << "but got" << buffer->targetHint(), this); @@ -133,7 +133,7 @@ Mesh* Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, Unsi static_cast(end); #endif (this->*bindIndexBufferImplementation)(buffer); - return this; + return *this; } void Mesh::draw() { diff --git a/src/Mesh.h b/src/Mesh.h index 00f744af0..bc37733f1 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -77,19 +77,19 @@ class MyShader: public AbstractShaderProgram { // ... }; -Mesh* mesh; -Buffer* vertexBuffer; +Mesh mesh; +Buffer vertexBuffer; // Fill vertex buffer with position data static constexpr Vector3 positions[30] = { // ... }; -vertexBuffer->setData(positions, Buffer::Usage::StaticDraw); +vertexBuffer.setData(positions, Buffer::Usage::StaticDraw); // Set primitive and vertex count, add the buffer and specify its layout -mesh->setPrimitive(Mesh::Primitive::Triangles) - ->setVertexCount(30) - ->addVertexBuffer(vertexBuffer, 0, MyShader::Position()); +mesh.setPrimitive(Mesh::Primitive::Triangles) + .setVertexCount(30) + .addVertexBuffer(vertexBuffer, 0, MyShader::Position()); @endcode @subsubsection Mesh-configuration-examples-nonindexed-phong Interleaved vertex data @@ -97,8 +97,8 @@ mesh->setPrimitive(Mesh::Primitive::Triangles) @code // Non-indexed primitive with positions and normals Trade::MeshData3D plane = Primitives::Plane::solid(); -Mesh* mesh; -Buffer* vertexBuffer; +Mesh mesh; +Buffer vertexBuffer; // Fill vertex buffer with interleaved position and normal data MeshTools::interleave(mesh, buffer, Buffer::Usage::StaticDraw, @@ -106,8 +106,8 @@ MeshTools::interleave(mesh, buffer, Buffer::Usage::StaticDraw, // Set primitive and specify layout of interleaved vertex buffer, vertex count // has been already set by MeshTools::interleave() -mesh->setPrimitive(plane.primitive()) - ->addInterleavedVertexBuffer(buffer, 0, +mesh.setPrimitive(plane.primitive()) + .addInterleavedVertexBuffer(buffer, 0, Shaders::PhongShader::Position(), Shaders::PhongShader::Normal()); @endcode @@ -122,33 +122,33 @@ class MyShader: public AbstractShaderProgram { // ... }; -Buffer *vertexBuffer, *indexBuffer; -Mesh* mesh; +Buffer vertexBuffer, indexBuffer; +Mesh mesh; // Fill vertex buffer with position data static constexpr Vector3 positions[300] = { // ... }; -vertexBuffer->setData(positions, Buffer::Usage::StaticDraw); +vertexBuffer.setData(positions, Buffer::Usage::StaticDraw); // Fill index buffer with index data static constexpr GLubyte indices[75] = { // ... }; -indexBuffer->setData(indices, Buffer::Usage::StaticDraw); +indexBuffer.setData(indices, Buffer::Usage::StaticDraw); // Set primitive, index count, specify the buffers -mesh->setPrimitive(Mesh::Primitive::Triangles) - ->setIndexCount(75) - ->addVertexBuffer(vertexBuffer, 0, MyShader::Position()) - ->setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 176, 229); +mesh.setPrimitive(Mesh::Primitive::Triangles) + .setIndexCount(75) + .addVertexBuffer(vertexBuffer, 0, MyShader::Position()) + .setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 176, 229); @endcode @code // Indexed primitive Trade::MeshData3D cube = Primitives::Cube::solid(); -Buffer *vertexBuffer, *indexBuffer; -Mesh* mesh; +Buffer vertexBuffer, indexBuffer; +Mesh mesh; // Fill vertex buffer with interleaved position and normal data MeshTools::interleave(mesh, vertexBuffer, Buffer::Usage::StaticDraw, @@ -160,8 +160,8 @@ MeshTools::compressIndices(mesh, indexBuffer, Buffer::Usage::StaticDraw, // Set primitive and specify layout of interleaved vertex buffer. Index count // and index buffer has been already specified by MeshTools::compressIndices(). -mesh->setPrimitive(plane.primitive()) - ->addInterleavedVertexBuffer(vertexBuffer, 0, +mesh.setPrimitive(plane.primitive()) + .addInterleavedVertexBuffer(vertexBuffer, 0, Shaders::PhongShader::Position(), Shaders::PhongShader::Normal()); @endcode @@ -366,15 +366,15 @@ class MAGNUM_EXPORT Mesh { /** * @brief Set primitive type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is @ref Primitive "Primitive::Triangles". * @see setVertexCount(), addVertexBuffer(), * addInterleavedVertexBuffer(), addVertexBufferStride() */ - Mesh* setPrimitive(Primitive primitive) { + Mesh& setPrimitive(Primitive primitive) { _primitive = primitive; - return this; + return *this; } /** @brief Vertex count */ @@ -382,15 +382,15 @@ class MAGNUM_EXPORT Mesh { /** * @brief Set vertex count - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is zero. * @see setPrimitive(), addVertexBuffer(), addInterleavedVertexBuffer(), * addVertexBufferStride(), MeshTools::interleave() */ - Mesh* setVertexCount(Int vertexCount) { + Mesh& setVertexCount(Int vertexCount) { _vertexCount = vertexCount; - return this; + return *this; } /** @brief Index count */ @@ -398,19 +398,19 @@ class MAGNUM_EXPORT Mesh { /** * @brief Set index count - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is zero. * @see setIndexBuffer(), MeshTools::compressIndices() */ - Mesh* setIndexCount(Int count) { + Mesh& setIndexCount(Int count) { _indexCount = count; - return this; + return *this; } /** * @brief Add buffer with non-interleaved vertex attributes for use with given shader - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Attribute list is combination of * @ref AbstractShaderProgram::Attribute "attribute definitions" @@ -425,20 +425,20 @@ class MAGNUM_EXPORT Mesh { * but it accepts only position and normal, so you have to skip the * texture coordinate array: * @code - * Mesh* mesh; - * Buffer* buffer; - * mesh->addVertexBuffer(buffer, + * Mesh mesh; + * Buffer buffer; + * mesh.addVertexBuffer(buffer, * 35, // offset of the data * Shaders::PhongShader::Position(), // position array - * sizeof(Vector2)*mesh->vertexCount(), // skip texture coordinate array + * sizeof(Vector2)*mesh.vertexCount(), // skip texture coordinate array * Shaders::PhongShader::Normal()); // normal array * @endcode * * Vou can also achieve the same effect by calling this function more * times with absolute offsets: * @code - * mesh->addVertexBuffer(buffer, 35, Shaders::PhongShader::Position()); - * ->addVertexBuffer(buffer, 35 + (sizeof(Shaders::PhongShader::Position::Type) + sizeof(Vector2))* + * mesh.addVertexBuffer(buffer, 35, Shaders::PhongShader::Position()); + * .addVertexBuffer(buffer, 35 + (sizeof(Shaders::PhongShader::Position::Type) + sizeof(Vector2))* * mesh->vertexCount(), Shaders::PhongShader::Normal()); * @endcode * @@ -457,11 +457,11 @@ class MAGNUM_EXPORT Mesh { * @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} * if @extension{APPLE,vertex_array_object} is available */ - template Mesh* addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes); + template Mesh& addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes); /** * @brief Add buffer with interleaved vertex attributes for use with given shader - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Parameter @p offset is offset of the interleaved array from the * beginning, attribute list is combination of @@ -478,9 +478,9 @@ class MAGNUM_EXPORT Mesh { * position and normal, so you have to skip weight and texture * coordinate in each vertex: * @code - * Mesh* mesh; - * Buffer* buffer; - * mesh->addInterleavedVertexBuffer(buffer, + * Mesh mesh; + * Buffer buffer; + * mesh.addInterleavedVertexBuffer(buffer, * 35, // skip other data * sizeof(Float), // skip vertex weight * Shaders::PhongShader::Position(), // vertex position @@ -498,9 +498,9 @@ class MAGNUM_EXPORT Mesh { * sizeof(Vector2) + * sizeof(Shaders::PhongShader::Normal::Type); * - * mesh->addVertexBufferStride(buffer, 35 + sizeof(Float), + * mesh.addVertexBufferStride(buffer, 35 + sizeof(Float), * stride, Shaders::PhongShader::Position()); - * ->addVertexBufferStride(buffer, 35 + sizeof(Float) + + * .addVertexBufferStride(buffer, 35 + sizeof(Float) + * sizeof(Shaders::PhongShader::Position::Type) + sizeof(Vector2), * stride, Shaders::PhongShader::Normal()); * @endcode @@ -517,20 +517,20 @@ class MAGNUM_EXPORT Mesh { * @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} * if @extension{APPLE,vertex_array_object} is available */ - template inline Mesh* addInterleavedVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { + template inline Mesh& addInterleavedVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { addInterleavedVertexBufferInternal(buffer, offset, strideOfInterleaved(attributes...), attributes...); - return this; + return *this; } /** * @brief Add buffer with interleaved vertex attributes for use with given shader - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * See addInterleavedVertexBuffer() for more information. */ - template inline Mesh* addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute) { + template inline Mesh& addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute) { addInterleavedVertexBufferInternal(buffer, offset, stride, attribute); - return this; + return *this; } /** @@ -540,7 +540,7 @@ class MAGNUM_EXPORT Mesh { * @param type Index data type * @param start Minimum array index contained in the buffer * @param end Maximum array index contained in the buffer - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * The smaller range is specified with @p start and @p end the less * memory operations are needed (and possibly some optimizations), @@ -553,14 +553,14 @@ class MAGNUM_EXPORT Mesh { * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @extension{APPLE,vertex_array_object} is available) */ - Mesh* setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end); + Mesh& setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end); /** * @brief Set index buffer * @param buffer Index buffer * @param offset Offset into the buffer * @param type Index data type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Prefer to use setIndexBuffer(Buffer*, GLintptr, IndexType, UnsignedInt, UnsignedInt) * for better performance. @@ -568,7 +568,7 @@ class MAGNUM_EXPORT Mesh { * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @extension{APPLE,vertex_array_object} is available) */ - Mesh* setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type) { + Mesh& setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type) { return setIndexBuffer(buffer, offset, type, 0, 0); } @@ -783,12 +783,12 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, Mesh::Primitive value); /** @debugoperator{Magnum::Mesh} */ Debug MAGNUM_EXPORT operator<<(Debug debug, Mesh::IndexType value); -template inline Mesh* Mesh::addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { +template inline Mesh& Mesh::addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { CORRADE_ASSERT(sizeof...(attributes) == 1 || _vertexCount != 0, - "Mesh::addVertexBuffer(): vertex count must be set before binding attributes", this); + "Mesh::addVertexBuffer(): vertex count must be set before binding attributes", *this); addVertexBufferInternal(buffer, offset, attributes...); - return this; + return *this; } diff --git a/src/MeshTools/CompressIndices.cpp b/src/MeshTools/CompressIndices.cpp index 2d765bafc..df2e871ed 100644 --- a/src/MeshTools/CompressIndices.cpp +++ b/src/MeshTools/CompressIndices.cpp @@ -80,7 +80,7 @@ void compressIndices(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const std: std::tie(indexCount, indexType, data) = compressIndicesInternal(indices, *minmax.second); mesh->setIndexCount(indices.size()) - ->setIndexBuffer(buffer, 0, indexType, *minmax.first, *minmax.second); + .setIndexBuffer(buffer, 0, indexType, *minmax.first, *minmax.second); buffer->setData(indexCount*Mesh::indexSize(indexType), data, usage); delete[] data; diff --git a/src/Platform/AbstractXApplication.h b/src/Platform/AbstractXApplication.h index ae6d1b01a..0921d2d6c 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Platform/AbstractXApplication.h @@ -204,7 +204,7 @@ class AbstractXApplication::Configuration { /** * @brief Set window title - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is `"Magnum X Application"`. */ @@ -218,7 +218,7 @@ class AbstractXApplication::Configuration { /** * @brief Set window size - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is `{800, 600}`. */ diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 0752ecb4b..7bb276b23 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -287,7 +287,7 @@ template class ResourceManager: private Implementation::Resource /** * @brief Set resource data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @p policy is set to `ResourcePolicy::ReferenceCounted`, there * must be already at least one reference to given resource, otherwise @@ -304,19 +304,19 @@ template class ResourceManager: private Implementation::Resource * subsequent updates are not possible. * @see referenceCount(), state() */ - template ResourceManager* set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy) { + template ResourceManager& set(ResourceKey key, T* data, ResourceDataState state, ResourcePolicy policy) { this->Implementation::ResourceManagerData::set(key, data, state, policy); - return this; + return *this; } /** * @brief Set resource data - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as above function with state set to @ref ResourceDataState "ResourceDataState::Final" * and policy to @ref ResourcePolicy "ResourcePolicy::Resident". */ - template ResourceManager* set(ResourceKey key, T* data) { + template ResourceManager& set(ResourceKey key, T* data) { return set(key, data, ResourceDataState::Final, ResourcePolicy::Resident); } @@ -332,51 +332,51 @@ template class ResourceManager: private Implementation::Resource /** * @brief Set fallback for not found resources - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - template ResourceManager* setFallback(T* data) { + template ResourceManager& setFallback(T* data) { this->Implementation::ResourceManagerData::setFallback(data); - return this; + return *this; } /** * @brief Free all resources of given type which are not referenced - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - template ResourceManager* free() { + template ResourceManager& free() { this->Implementation::ResourceManagerData::free(); - return this; + return *this; } /** * @brief Free all resources which are not referenced - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - ResourceManager* free() { + ResourceManager& free() { freeInternal(); - return this; + return *this; } /** * @brief Clear all resources of given type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Unlike free() this function assumes that no resource is referenced. */ - template ResourceManager* clear() { + template ResourceManager& clear() { this->Implementation::ResourceManagerData::clear(); - return this; + return *this; } /** * @brief Clear all resources - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Unlike free() this function assumes that no resource is referenced. */ - ResourceManager* clear() { + ResourceManager& clear() { clearInternal(); - return this; + return *this; } /** @brief Loader for given type of resources */ @@ -391,15 +391,15 @@ template class ResourceManager: private Implementation::Resource /** * @brief Set loader for given type of resources - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * See AbstractResourceLoader documentation for more information. * @attention The loader is deleted on destruction before unloading * all resources. */ - template ResourceManager* setLoader(AbstractResourceLoader* loader) { + template ResourceManager& setLoader(AbstractResourceLoader* loader) { this->Implementation::ResourceManagerData::setLoader(loader); - return this; + return *this; } private: diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index b66ec8aad..1d5d80bd0 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -81,9 +81,9 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /** * @brief Set aspect ratio policy - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - AbstractCamera* setAspectRatioPolicy(AspectRatioPolicy policy); + AbstractCamera& setAspectRatioPolicy(AspectRatioPolicy policy); /** * @brief Camera matrix diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 891108d4a..ba4c48a15 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -74,10 +74,10 @@ template AbstractCamera::Abstrac template AbstractCamera::~AbstractCamera() = default; -template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { +template AbstractCamera& AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { _aspectRatioPolicy = policy; fixAspectRatio(); - return this; + return *this; } template void AbstractCamera::setViewport(const Vector2i& size) { diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index ee96fc440..baacea042 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -136,11 +136,11 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /** * @brief Reset object transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - AbstractTransformation* resetTransformation() { + AbstractTransformation& resetTransformation() { doResetTransformation(); - return this; + return *this; } protected: diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/SceneGraph/AbstractTranslationRotation2D.h index 2fd787365..de8ca8911 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/SceneGraph/AbstractTranslationRotation2D.h @@ -46,31 +46,31 @@ template class AbstractBasicTranslationRotation2D: public AbstractTrans * @brief Translate object * @param vector Translation vector * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see Vector2::xAxis(), Vector2::yAxis() */ - AbstractBasicTranslationRotation2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D& translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { doTranslate(vector, type); - return this; + return *this; } /** * @brief Rotate object * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - AbstractBasicTranslationRotation2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation2D& rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotate(angle, type); - return this; + return *this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractBasicTranslationRotation2D* resetTransformation() { + AbstractBasicTranslationRotation2D& resetTransformation() { AbstractTransformation<2, T>::resetTransformation(); - return this; + return *this; } #endif diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/SceneGraph/AbstractTranslationRotation3D.h index 0e36b0c9b..ffc739852 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/SceneGraph/AbstractTranslationRotation3D.h @@ -47,13 +47,13 @@ template class AbstractBasicTranslationRotation3D: public AbstractTrans * @brief Translate object * @param vector Translation vector * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis() */ - AbstractBasicTranslationRotation3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D& translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { doTranslate(vector, type); - return this; + return *this; } /** @@ -61,63 +61,63 @@ template class AbstractBasicTranslationRotation3D: public AbstractTrans * @param angle Angle (counterclockwise) * @param normalizedAxis Normalized rotation axis * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see rotateX(), rotateY(), rotateZ(), Vector3::xAxis(), * Vector3::yAxis(), Vector3::zAxis() */ - AbstractBasicTranslationRotation3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D& rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { doRotate(angle, normalizedAxis, type); - return this; + return *this; } /** * @brief Rotate object around X axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * In some implementations faster than calling * `rotate(angle, Vector3::xAxis())`. */ - AbstractBasicTranslationRotation3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D& rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateX(angle, type); - return this; + return *this; } /** * @brief Rotate object around Y axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * In some implementations faster than calling * `rotate(angle, Vector3::yAxis())`. */ - AbstractBasicTranslationRotation3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D& rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateX(angle, type); - return this; + return *this; } /** * @brief Rotate object around Z axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * In some implementations faster than calling * `rotate(angle, Vector3::zAxis())`. */ - AbstractBasicTranslationRotation3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotation3D& rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { doRotateZ(angle, type); - return this; + return *this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractBasicTranslationRotation3D* resetTransformation() { + AbstractBasicTranslationRotation3D& resetTransformation() { AbstractTransformation<3, T>::resetTransformation(); - return this; + return *this; } #endif diff --git a/src/SceneGraph/AbstractTranslationRotationScaling2D.h b/src/SceneGraph/AbstractTranslationRotationScaling2D.h index 407ffc365..fa75778cb 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling2D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling2D.h @@ -45,28 +45,28 @@ template class AbstractBasicTranslationRotationScaling2D: public Abstra * @brief Scale object * @param vector Scaling vector * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see Vector2::xScale(), Vector2::yScale() */ - AbstractBasicTranslationRotationScaling2D* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling2D& scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { doScale(vector, type); - return this; + return *this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractBasicTranslationRotationScaling2D* resetTransformation() { + AbstractBasicTranslationRotationScaling2D& resetTransformation() { AbstractBasicTranslationRotation2D::resetTransformation(); - return this; + return *this; } - AbstractBasicTranslationRotationScaling2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling2D& translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation2D::translate(vector, type); - return this; + return *this; } - AbstractBasicTranslationRotationScaling2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling2D& rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation2D::rotate(angle, type); - return this; + return *this; } #endif diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/SceneGraph/AbstractTranslationRotationScaling3D.h index 11a37b7b4..2074e0a44 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -45,40 +45,40 @@ template class AbstractBasicTranslationRotationScaling3D: public Abstra * @brief Scale object * @param vector Scaling vector * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see Vector3::xScale(), Vector3::yScale(), Vector3::zScale() */ - AbstractBasicTranslationRotationScaling3D* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { doScale(vector, type); - return this; + return *this; } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - AbstractBasicTranslationRotationScaling3D* resetTransformation() { + AbstractBasicTranslationRotationScaling3D& resetTransformation() { AbstractBasicTranslationRotation3D::resetTransformation(); - return this; + return *this; } - AbstractBasicTranslationRotationScaling3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation3D::translate(vector, type); - return this; + return *this; } - AbstractBasicTranslationRotationScaling3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation3D::rotate(angle, normalizedAxis, type); - return this; + return *this; } - AbstractBasicTranslationRotationScaling3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation3D::rotateX(angle, type); - return this; + return *this; } - AbstractBasicTranslationRotationScaling3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation3D::rotateY(angle, type); - return this; + return *this; } - AbstractBasicTranslationRotationScaling3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + AbstractBasicTranslationRotationScaling3D& rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { AbstractBasicTranslationRotation3D::rotateZ(angle, type); - return this; + return *this; } #endif diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 3f7ca174b..3221d64de 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -165,7 +165,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl /** * @brief Set animation state - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Note that changing state from @ref AnimationState "AnimationState::Stopped" * to @ref AnimationState "AnimationState::Paused" is ignored and @@ -174,7 +174,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl * @see animationStarted(), animationPaused(), animationResumed(), * animationStopped() */ - Animable* setState(AnimationState state); + Animable& setState(AnimationState state); /** * @brief Whether the animation is repeated @@ -185,14 +185,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl /** * @brief Enable/disable repeated animation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is `false`. * @see setRepeatCount() */ - Animable* setRepeated(bool repeated) { + Animable& setRepeated(bool repeated) { _repeated = repeated; - return this; + return *this; } /** @@ -204,15 +204,15 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl /** * @brief Set repeat count - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Has effect only if repeated animation is enabled. `0` means * infinitely repeated animation. Default is `0`. * @see setRepeated() */ - Animable* setRepeatCount(UnsignedShort count) { + Animable& setRepeatCount(UnsignedShort count) { _repeatCount = count; - return this; + return *this; } /** @@ -226,15 +226,15 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl protected: /** * @brief Set animation duration - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets duration of the animation cycle in seconds. Set to `0.0f` for * infinite non-repeating animation. Default is `0.0f`. */ /* Protected so only animation implementer can change it */ - Animable* setDuration(Float duration) { + Animable& setDuration(Float duration) { _duration = duration; - return this; + return *this; } /** diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 598959bac..9847e2ad8 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -39,17 +39,17 @@ template Animable::Animable(Abst template Animable::~Animable() {} -template Animable* Animable::setState(AnimationState state) { - if(currentState == state) return this; +template Animable& Animable::setState(AnimationState state) { + if(currentState == state) return *this; /* Not allowed (for sanity) */ if(previousState == AnimationState::Stopped && state == AnimationState::Paused) - return this; + return *this; /* Wake up the group in case no animations are running */ group()->wakeUp = true; currentState = state; - return this; + return *this; } template AnimableGroup* Animable::group() { diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 991a6b8e5..3016a405e 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -39,9 +39,9 @@ See Drawable documentation for introduction. The camera by default displays OpenGL unit cube `[(-1, -1, -1); (1, 1, 1)]` and doesn't do any aspect ratio correction. Common setup example: @code -SceneGraph::Camera2D* camera = new SceneGraph::Camera2D(&cameraObject); -camera->setProjection({4.0f/3.0f, 1.0f}) - ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); +SceneGraph::Camera2D camera(&cameraObject); +camera.setProjection({4.0f/3.0f, 1.0f}) + .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode @section Camera2D-explicit-specializations Explicit template specializations @@ -70,17 +70,17 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractC /** * @brief Set projection * @param size Size of the view - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see Matrix3::projection() */ - BasicCamera2D* setProjection(const Math::Vector2& size); + BasicCamera2D& setProjection(const Math::Vector2& size); /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - BasicCamera2D* setAspectRatioPolicy(AspectRatioPolicy policy) { + BasicCamera2D& setAspectRatioPolicy(AspectRatioPolicy policy) { AbstractCamera<2, T>::setAspectRatioPolicy(policy); - return this; + return *this; } #endif }; diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 745e2d2f8..447c0aee1 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -37,11 +37,11 @@ namespace Magnum { namespace SceneGraph { template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} -template BasicCamera2D* BasicCamera2D::setProjection(const Math::Vector2& size) { +template BasicCamera2D& BasicCamera2D::setProjection(const Math::Vector2& size) { AbstractCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); AbstractCamera<2, T>::fixAspectRatio(); - return this; + return *this; } }} diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 0a8cb2b0d..234a2ad15 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -44,9 +44,9 @@ See Drawable documentation for introduction. The camera by default displays OpenGL unit cube `[(-1, -1, -1); (1, 1, 1)]` with orthographic projection and doesn't do any aspect ratio correction. Common setup example: @code -SceneGraph::Camera3D* camera = new SceneGraph::Camera3D(&cameraObject); -camera->setPerspective({}, 0.001f, 100.0f) - ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); +SceneGraph::Camera3D camera(&cameraObject); +camera.setPerspective({}, 0.001f, 100.0f) + .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode @section Camera3D-explicit-specializations Explicit template specializations @@ -74,22 +74,22 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractC * @param size Size of the view * @param near Near clipping plane * @param far Far clipping plane - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setPerspective(), Matrix4::orthographicProjection() */ - BasicCamera3D* setOrthographic(const Math::Vector2& size, T near, T far); + BasicCamera3D& setOrthographic(const Math::Vector2& size, T near, T far); /** * @brief Set perspective projection * @param size Size of near clipping plane * @param near Near clipping plane * @param far Far clipping plane - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setOrthographic(), Matrix4::perspectiveProjection() */ - BasicCamera3D* setPerspective(const Math::Vector2& size, T near, T far); + BasicCamera3D& setPerspective(const Math::Vector2& size, T near, T far); /** * @brief Set perspective projection @@ -97,11 +97,11 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractC * @param aspectRatio Aspect ratio * @param near Near clipping plane * @param far Far clipping plane - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setOrthographic(), Matrix4::perspectiveProjection() */ - BasicCamera3D* setPerspective(Math::Rad fov, T aspectRatio, T near, T far); + BasicCamera3D& setPerspective(Math::Rad fov, T aspectRatio, T near, T far); /** @brief Near clipping plane */ T near() const { return _near; } @@ -111,9 +111,9 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractC /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - BasicCamera3D* setAspectRatioPolicy(AspectRatioPolicy policy) { + BasicCamera3D& setAspectRatioPolicy(AspectRatioPolicy policy) { AbstractCamera<3, T>::setAspectRatioPolicy(policy); - return this; + return *this; } #endif diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index 73fd88b53..c1e5bda74 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -37,34 +37,34 @@ namespace Magnum { namespace SceneGraph { template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(T(0)), _far(T(0)) {} -template BasicCamera3D* BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { +template BasicCamera3D& BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far; AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::orthographicProjection(size, near, far); AbstractCamera<3, T>::fixAspectRatio(); - return this; + return *this; } -template BasicCamera3D* BasicCamera3D::setPerspective(const Math::Vector2& size, T near, T far) { +template BasicCamera3D& BasicCamera3D::setPerspective(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far; AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(size, near, far); AbstractCamera<3, T>::fixAspectRatio(); - return this; + return *this; } -template BasicCamera3D* BasicCamera3D::setPerspective(Math::Rad fov, T aspectRatio, T near, T far) { +template BasicCamera3D& BasicCamera3D::setPerspective(Math::Rad fov, T aspectRatio, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; _far = far; AbstractCamera<3, T>::rawProjectionMatrix = Math::Matrix4::perspectiveProjection(fov, aspectRatio, near, far); AbstractCamera<3, T>::fixAspectRatio(); - return this; + return *this; } }} diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index 1678d1ff4..a224f4296 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -68,7 +68,7 @@ SceneGraph::DrawableGroup3D drawables; (new DrawableObject(&scene, &drawables)) ->translate(Vector3::yAxis(-0.3f)) - ->rotateX(30.0_degf); + .rotateX(30.0_degf); (new AnotherDrawableObject(&scene, &drawables)) ->translate(Vector3::zAxis(0.5f)); // ... @@ -96,14 +96,14 @@ setup etc into one group, then put all transparent into another and set common parameters once for whole group instead of setting them again in each draw() implementation. Example: @code -Shaders::PhongShader* shader; +Shaders::PhongShader shader; SceneGraph::DrawableGroup3D phongObjects, transparentObjects; void MyApplication::drawEvent() { - shader->setProjectionMatrix(camera->projectionMatrix()) - ->setLightPosition(lightPosition) - ->setLightColor(lightColor) - ->setAmbientColor(ambientColor); + shader.setProjectionMatrix(camera->projectionMatrix()) + .setLightPosition(lightPosition) + .setLightColor(lightColor) + .setAmbientColor(ambientColor); camera.draw(phongObjects); Renderer::setFeature(Renderer::Feature::Blending, true); diff --git a/src/SceneGraph/DualComplexTransformation.h b/src/SceneGraph/DualComplexTransformation.h index 67cc7e07c..55f149922 100644 --- a/src/SceneGraph/DualComplexTransformation.h +++ b/src/SceneGraph/DualComplexTransformation.h @@ -70,87 +70,87 @@ template class BasicDualComplexTransformation: public AbstractBasicTran /** * @brief Normalize rotation part - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Normalizes the rotation part to prevent rounding errors when rotating * the object subsequently. * @see DualComplex::normalized() */ - Object>* normalizeRotation() { + Object>& normalizeRotation() { setTransformationInternal(_transformation.normalized()); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the dual complex number is normalized. * @see DualComplex::isNormalized() */ - Object>* setTransformation(const Math::DualComplex& transformation) { + Object>& setTransformation(const Math::DualComplex& transformation) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized", - static_cast>*>(this)); + static_cast>&>(*this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformationInternal({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Transform object * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the dual complex number is normalized. * @see DualComplex::isNormalized() */ - Object>* transform(const Math::DualComplex& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::DualComplex& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualComplexTransformation::transform(): the dual complex number is not normalized", - static_cast>*>(this)); + static_cast>&>(*this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with DualComplex::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::DualComplex::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with DualComplex::rotation(). * @see normalizeRotation() */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::DualComplex::rotation(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Move object in stacking order * @param under Sibling object under which to move or `nullptr`, * if you want to move it above all. - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* move(Object>* under) { + Object>& move(Object>* under) { static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + return static_cast>&>(*this); } protected: diff --git a/src/SceneGraph/DualQuaternionTransformation.h b/src/SceneGraph/DualQuaternionTransformation.h index 0fe666b5d..8394e5bd2 100644 --- a/src/SceneGraph/DualQuaternionTransformation.h +++ b/src/SceneGraph/DualQuaternionTransformation.h @@ -72,62 +72,62 @@ template class BasicDualQuaternionTransformation: public AbstractBasicT /** * @brief Normalize rotation part - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Normalizes the rotation part to prevent rounding errors when rotating * the object subsequently. * @see DualQuaternion::normalized() */ - Object>* normalizeRotation() { + Object>& normalizeRotation() { setTransformation(_transformation.normalized()); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the dual quaternion is normalized. * @see DualQuaternion::isNormalized() */ - Object>* setTransformation(const Math::DualQuaternion& transformation) { + Object>& setTransformation(const Math::DualQuaternion& transformation) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized", - static_cast>*>(this)); + static_cast>&>(*this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Multiply transformation * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the dual quaternion is normalized. * @see DualQuaternion::isNormalized() */ - Object>* transform(const Math::DualQuaternion& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::DualQuaternion& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isNormalized(), "SceneGraph::DualQuaternionTransformation::transform(): the dual quaternion is not normalized", - static_cast>*>(this)); + static_cast>&>(*this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with DualQuaternion::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::DualQuaternion::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -135,26 +135,26 @@ template class BasicDualQuaternionTransformation: public AbstractBasicT * @param angle Angle (counterclockwise) * @param normalizedAxis Normalized rotation axis * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with DualQuaternion::rotation(). * @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis(), * normalizeRotation() */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transformInternal(Math::DualQuaternion::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::xAxis(), type); } - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::yAxis(), type); } - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { return rotate(angle, Math::Vector3::zAxis(), type); } #endif diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index 19cf67412..ae5142437 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -91,21 +91,21 @@ template class FeatureGroup: pub /** * @brief Add feature to the group - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If the features is part of another group, it is removed from it. * @see remove(), AbstractGroupedFeature::AbstractGroupedFeature() */ - FeatureGroup* add(Feature* feature); + FeatureGroup& add(Feature* feature); /** * @brief Remove feature from the group - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * The feature must be part of the group. * @see add() */ - FeatureGroup* remove(Feature* feature); + FeatureGroup& remove(Feature* feature); }; #ifndef CORRADE_GCC46_COMPATIBILITY @@ -158,7 +158,7 @@ template FeatureGroupfeatures) static_cast(i)->_group = nullptr; } -template FeatureGroup* FeatureGroup::add(Feature* feature) { +template FeatureGroup& FeatureGroup::add(Feature* feature) { /* Remove from previous group */ if(feature->_group) feature->_group->remove(feature); @@ -166,16 +166,16 @@ template FeatureGroup::add(feature); feature->_group = this; - return this; + return *this; } -template FeatureGroup* FeatureGroup::remove(Feature* feature) { +template FeatureGroup& FeatureGroup::remove(Feature* feature) { CORRADE_ASSERT(feature->_group == this, - "SceneGraph::AbstractFeatureGroup::remove(): feature is not part of this group", this); + "SceneGraph::AbstractFeatureGroup::remove(): feature is not part of this group", *this); AbstractFeatureGroup::remove(feature); feature->_group = nullptr; - return this; + return *this; } }} diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index d1f4a144e..a58232845 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -69,9 +69,9 @@ template class BasicMatrixTransformation2D: public AbstractBasicTransla /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* setTransformation(const Math::Matrix3& transformation) { + Object>& setTransformation(const Math::Matrix3& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ @@ -80,52 +80,52 @@ template class BasicMatrixTransformation2D: public AbstractBasicTransla static_cast>*>(this)->setDirty(); } - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Transform object * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { setTransformation(type == TransformationType::Global ? transformation*_transformation : _transformation*transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with Matrix3::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling2D::rotate() * Same as calling transform() with Matrix3::rotation(). */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::rotation(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling2D::scale() * Same as calling transform() with Matrix3::scaling(). */ - Object>* scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>& scale(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::scaling(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -133,24 +133,24 @@ template class BasicMatrixTransformation2D: public AbstractBasicTransla * @param normal Normal of the line through which to reflect * (normalized) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix3::reflection(). */ - Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + Object>& reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::reflection(normal), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Move object in stacking order * @param under Sibling object under which to move or `nullptr`, * if you want to move it above all. - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* move(Object>* under) { + Object>& move(Object>* under) { static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + return static_cast>&>(*this); } protected: diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index 88ea61e47..a9e4e577b 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -69,9 +69,9 @@ template class BasicMatrixTransformation3D: public AbstractBasicTransla /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* setTransformation(const Math::Matrix4& transformation) { + Object>& setTransformation(const Math::Matrix4& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ @@ -80,91 +80,91 @@ template class BasicMatrixTransformation3D: public AbstractBasicTransla static_cast>*>(this)->setDirty(); } - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Multiply transformation * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { setTransformation(type == TransformationType::Global ? transformation*_transformation : _transformation*transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with Matrix4::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling3D::rotate() * Same as calling transform() with Matrix4::rotation(). */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around X axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationX(). */ - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationX(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around Y axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationY(). */ - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationY(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around Z axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationZ(). */ - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::rotationZ(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling3D::scale() * Same as calling transform() with Matrix4::scaling(). */ - Object>* scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>& scale(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::scaling(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -172,13 +172,13 @@ template class BasicMatrixTransformation3D: public AbstractBasicTransla * @param normal Normal of the plane through which to reflect * (normalized) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::reflection(). */ - Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { + Object>& reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::reflection(normal), type); - return static_cast>*>(this); + return static_cast>&>(*this); } protected: diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 2698c5653..d48fab792 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -190,20 +190,20 @@ template class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs /** * @brief Set parent object - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setParentKeepTransformation() */ - Object* setParent(Object* parent); + Object& setParent(Object* parent); /** * @brief Set parent object and keep absolute transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * While setParent() preserves only relative transformation of the * object, this funcition preserves absolute transformation. */ - Object* setParentKeepTransformation(Object* parent); + Object& setParentKeepTransformation(Object* parent); /*@}*/ diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index ba60a6341..e938c1e19 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -65,16 +65,16 @@ template const Object* Object Object* Object::setParent(Object* parent) { +template Object& Object::setParent(Object* parent) { /* Skip if parent is already parent or this is scene (which cannot have parent) */ /** @todo Assert for setting parent to scene */ - if(this->parent() == parent || isScene()) return this; + if(this->parent() == parent || isScene()) return *this; /* Object cannot be parented to its child */ Object* p = parent; while(p) { /** @todo Assert for this */ - if(p == this) return this; + if(p == this) return *this; p = p->parent(); } @@ -85,18 +85,18 @@ template Object* Object::s if(parent) parent->Containers::LinkedList>::insert(this); setDirty(); - return this; + return *this; } -template Object* Object::setParentKeepTransformation(Object* parent) { - CORRADE_ASSERT(scene() == parent->scene(), "SceneGraph::Object::setParentKeepTransformation(): both parents must be in the same scene", this); +template Object& Object::setParentKeepTransformation(Object* parent) { + CORRADE_ASSERT(scene() == parent->scene(), "SceneGraph::Object::setParentKeepTransformation(): both parents must be in the same scene", *this); const auto transformation = Transformation::compose( Transformation::inverted(parent->absoluteTransformation()), absoluteTransformation()); setParent(parent); this->setTransformation(transformation); - return this; + return *this; } template typename Transformation::DataType Object::absoluteTransformation() const { diff --git a/src/SceneGraph/RigidMatrixTransformation2D.h b/src/SceneGraph/RigidMatrixTransformation2D.h index 0a5e70101..8db697eab 100644 --- a/src/SceneGraph/RigidMatrixTransformation2D.h +++ b/src/SceneGraph/RigidMatrixTransformation2D.h @@ -75,77 +75,77 @@ template class BasicRigidMatrixTransformation2D: public AbstractBasicTr /** * @brief Normalize rotation part - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - Object>* normalizeRotation() { + Object>& normalizeRotation() { setTransformationInternal(Math::Matrix3::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the matrix represents rigid transformation. * @see Matrix3::isRigidTransformation() */ - Object>* setTransformation(const Math::Matrix3& transformation) { + Object>& setTransformation(const Math::Matrix3& transformation) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>&>(*this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling2D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformationInternal({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Transform object * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the matrix represents rigid transformation. * @see Matrix3::isRigidTransformation() */ - Object>* transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::Matrix3& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation2D::transform(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>&>(*this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling2D::translate() * Same as calling transform() with Matrix3::translation(). */ - Object>* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix3::rotation(). * @see normalizeRotation() */ - Object>* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::rotation(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -153,24 +153,24 @@ template class BasicRigidMatrixTransformation2D: public AbstractBasicTr * @param normal Normal of the line through which to reflect * (normalized) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix3::reflection(). */ - Object>* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + Object>& reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix3::reflection(normal), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Move object in stacking order * @param under Sibling object under which to move or `nullptr`, * if you want to move it above all. - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Object>* move(Object>* under) { + Object>& move(Object>* under) { static_cast*>(this)->Containers::template LinkedList>>::move(this, under); - return static_cast>*>(this); + return static_cast>&>(*this); } protected: diff --git a/src/SceneGraph/RigidMatrixTransformation3D.h b/src/SceneGraph/RigidMatrixTransformation3D.h index abccc8cbf..becd46ce2 100644 --- a/src/SceneGraph/RigidMatrixTransformation3D.h +++ b/src/SceneGraph/RigidMatrixTransformation3D.h @@ -75,63 +75,63 @@ template class BasicRigidMatrixTransformation3D: public AbstractBasicTr /** * @brief Normalize rotation part - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - Object>* normalizeRotation() { + Object>& normalizeRotation() { setTransformation(Math::Matrix4::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Set transformation - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the matrix represents rigid transformation. * @see Matrix4::isRigidTransformation() */ - Object>* setTransformation(const Math::Matrix4& transformation) { + Object>& setTransformation(const Math::Matrix4& transformation) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>&>(*this)); setTransformationInternal(transformation); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ - Object>* resetTransformation() { + Object>& resetTransformation() { setTransformation({}); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Multiply transformation * @param transformation Transformation * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Expects that the matrix represents rigid transformation. * @see Matrix4::isRigidTransformation() */ - Object>* transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { + Object>& transform(const Math::Matrix4& transformation, TransformationType type = TransformationType::Global) { CORRADE_ASSERT(transformation.isRigidTransformation(), "SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation", - static_cast>*>(this)); + static_cast>&>(*this)); transformInternal(transformation, type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @copydoc AbstractTranslationRotationScaling3D::translate() * Same as calling transform() with Matrix4::translation(). */ - Object>* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { + Object>& translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::translation(vector), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -139,57 +139,57 @@ template class BasicRigidMatrixTransformation3D: public AbstractBasicTr * @param angle Angle (counterclockwise) * @param normalizedAxis Normalized rotation axis * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotation(). * @see rotateX(), rotateY(), rotateZ(), Vector3::xAxis(), * Vector3::yAxis(), Vector3::zAxis(), normalizeRotation() */ - Object>* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { + Object>& rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotation(angle, normalizedAxis), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around X axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationX(). * @see normalizeRotation() */ - Object>* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationX(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around Y axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationY(). * @see normalizeRotation() */ - Object>* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationY(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** * @brief Rotate object around Z axis * @param angle Angle (counterclockwise) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::rotationZ(). * @see normalizeRotation() */ - Object>* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { + Object>& rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::rotationZ(angle), type); - return static_cast>*>(this); + return static_cast>&>(*this); } /** @@ -197,13 +197,13 @@ template class BasicRigidMatrixTransformation3D: public AbstractBasicTr * @param normal Normal of the plane through which to reflect * (normalized) * @param type Transformation type - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Same as calling transform() with Matrix4::reflection(). */ - Object>* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { + Object>& reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { transformInternal(Math::Matrix4::reflection(normal), type); - return static_cast>*>(this); + return static_cast>&>(*this); } protected: diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/SceneGraph/Test/AnimableTest.cpp index ed3726ec3..3eba97476 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/SceneGraph/Test/AnimableTest.cpp @@ -143,8 +143,11 @@ void AnimableTest::state() { CORRADE_COMPARE(group.runningCount(), 0); /* Verify running count can go past 0/1 */ - group.add((new StateTrackingAnimable(&object, &group))->setState(AnimationState::Running)); - group.add((new StateTrackingAnimable(&object, &group))->setState(AnimationState::Running)); + auto a = new StateTrackingAnimable(&object, &group); + auto b = new StateTrackingAnimable(&object, &group); + a->setState(AnimationState::Running); + b->setState(AnimationState::Running); + group.add(a).add(b); group.step(1.0f, 1.0f); CORRADE_COMPARE(group.runningCount(), 2); } diff --git a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp b/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp index 8433eebbb..fd48a3ac7 100644 --- a/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp +++ b/src/SceneGraph/Test/DualQuaternionTransformationTest.cpp @@ -160,9 +160,9 @@ void DualQuaternionTransformationTest::rotate() { Object3D o; o.transform(DualQuaternion::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f)) - ->rotateY(Deg(25.0f)) - ->rotateZ(Deg(-23.0f)) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); + .rotateY(Deg(25.0f)) + .rotateZ(Deg(-23.0f)) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::rotation(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()))* Matrix4::rotationZ(Deg(-23.0f))* @@ -173,9 +173,9 @@ void DualQuaternionTransformationTest::rotate() { Object3D o; o.transform(DualQuaternion::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f), TransformationType::Local) - ->rotateY(Deg(25.0f), TransformationType::Local) - ->rotateZ(Deg(-23.0f), TransformationType::Local) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); + .rotateY(Deg(25.0f), TransformationType::Local) + .rotateZ(Deg(-23.0f), TransformationType::Local) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::translation({1.0f, -0.3f, 2.3f})* Matrix4::rotationX(Deg(17.0f))* diff --git a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp b/src/SceneGraph/Test/MatrixTransformation3DTest.cpp index 32a09dbfc..ab9f3f97d 100644 --- a/src/SceneGraph/Test/MatrixTransformation3DTest.cpp +++ b/src/SceneGraph/Test/MatrixTransformation3DTest.cpp @@ -145,9 +145,9 @@ void MatrixTransformation3DTest::rotate() { Object3D o; o.setTransformation(Matrix4::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f)) - ->rotateY(Deg(25.0f)) - ->rotateZ(Deg(-23.0f)) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); + .rotateY(Deg(25.0f)) + .rotateZ(Deg(-23.0f)) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::rotation(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()))* Matrix4::rotationZ(Deg(-23.0f))* @@ -158,9 +158,9 @@ void MatrixTransformation3DTest::rotate() { Object3D o; o.setTransformation(Matrix4::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f), TransformationType::Local) - ->rotateY(Deg(25.0f), TransformationType::Local) - ->rotateZ(Deg(-23.0f), TransformationType::Local) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); + .rotateY(Deg(25.0f), TransformationType::Local) + .rotateZ(Deg(-23.0f), TransformationType::Local) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::translation({1.0f, -0.3f, 2.3f})* Matrix4::rotationX(Deg(17.0f))* diff --git a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp index ef56d9d69..fd1a464b0 100644 --- a/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp +++ b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp @@ -165,9 +165,9 @@ void RigidMatrixTransformation3DTest::rotate() { Object3D o; o.setTransformation(Matrix4::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f)) - ->rotateY(Deg(25.0f)) - ->rotateZ(Deg(-23.0f)) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); + .rotateY(Deg(25.0f)) + .rotateZ(Deg(-23.0f)) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3())); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::rotation(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()))* Matrix4::rotationZ(Deg(-23.0f))* @@ -178,9 +178,9 @@ void RigidMatrixTransformation3DTest::rotate() { Object3D o; o.setTransformation(Matrix4::translation({1.0f, -0.3f, 2.3f})); o.rotateX(Deg(17.0f), TransformationType::Local) - ->rotateY(Deg(25.0f), TransformationType::Local) - ->rotateZ(Deg(-23.0f), TransformationType::Local) - ->rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); + .rotateY(Deg(25.0f), TransformationType::Local) + .rotateZ(Deg(-23.0f), TransformationType::Local) + .rotate(Deg(96.0f), Vector3(1.0f/Constants::sqrt3()), TransformationType::Local); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::translation({1.0f, -0.3f, 2.3f})* Matrix4::rotationX(Deg(17.0f))* diff --git a/src/Shaders/DistanceFieldVector.h b/src/Shaders/DistanceFieldVector.h index 8d5319deb..be068f2fc 100644 --- a/src/Shaders/DistanceFieldVector.h +++ b/src/Shaders/DistanceFieldVector.h @@ -51,37 +51,40 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector public: DistanceFieldVector(); - /** @brief Set transformation and projection matrix */ - DistanceFieldVector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + /** + * @brief Set transformation and projection matrix + * @return Reference to self (for method chaining) + */ + DistanceFieldVector& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set fill color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setOutlineColor() */ - DistanceFieldVector* setColor(const Color4& color) { + DistanceFieldVector& setColor(const Color4& color) { AbstractShaderProgram::setUniform(colorUniform, color); - return this; + return *this; } /** * @brief Set outline color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * @see setOutlineRange(), setColor() */ - DistanceFieldVector* setOutlineColor(const Color4& color) { + DistanceFieldVector& setOutlineColor(const Color4& color) { AbstractShaderProgram::setUniform(outlineColorUniform, color); - return this; + return *this; } /** * @brief Set outline range - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Parameter @p start describes where fill ends and possible outline * starts. Initial value is `0.5f`, larger values will make the vector @@ -93,22 +96,22 @@ template class MAGNUM_SHADERS_EXPORT DistanceFieldVector * * @see setOutlineColor() */ - DistanceFieldVector* setOutlineRange(Float start, Float end) { + DistanceFieldVector& setOutlineRange(Float start, Float end) { AbstractShaderProgram::setUniform(outlineRangeUniform, Vector2(start, end)); - return this; + return *this; } /** * @brief Set smoothness radius - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Larger values will make edges look less aliased (but blurry), smaller * values will make them look more crisp (but possibly aliased). Initial * value is `0.04f`. */ - DistanceFieldVector* setSmoothness(Float value) { + DistanceFieldVector& setSmoothness(Float value) { AbstractShaderProgram::setUniform(smoothnessUniform, value); - return this; + return *this; } private: diff --git a/src/Shaders/Flat.h b/src/Shaders/Flat.h index 582378a76..d8efe6abe 100644 --- a/src/Shaders/Flat.h +++ b/src/Shaders/Flat.h @@ -53,20 +53,20 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra /** * @brief Set transformation and projection matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Flat* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Flat& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Flat* setColor(const Color4& color) { + Flat& setColor(const Color4& color) { setUniform(colorUniform, color); - return this; + return *this; } private: diff --git a/src/Shaders/MeshVisualizer.h b/src/Shaders/MeshVisualizer.h index e48aaefbd..b30e3c32b 100644 --- a/src/Shaders/MeshVisualizer.h +++ b/src/Shaders/MeshVisualizer.h @@ -114,67 +114,67 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram { /** * @brief Set transformation and projection matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - MeshVisualizer* setTransformationProjectionMatrix(const Matrix4& matrix) { + MeshVisualizer& setTransformationProjectionMatrix(const Matrix4& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set viewport size - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Has effect only if @ref Flag "Flag::Wireframe" is enabled. */ - MeshVisualizer* setViewportSize(const Vector2& size) { + MeshVisualizer& setViewportSize(const Vector2& size) { setUniform(viewportSizeUniform, size); - return this; + return *this; } /** * @brief Set base object color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Initial value is fully opaque white. */ - MeshVisualizer* setColor(const Color4& color) { + MeshVisualizer& setColor(const Color4& color) { setUniform(colorUniform, color); - return this; + return *this; } /** * @brief Set wireframe color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Initial value is fully opaque black. Has effect only if * @ref Flag "Flag::Wireframe" is enabled. */ - MeshVisualizer* setWireframeColor(const Color4& color) { + MeshVisualizer& setWireframeColor(const Color4& color) { if(flags & Flag::Wireframe) setUniform(wireframeColorUniform, color); - return this; + return *this; } /** * @brief Set wireframe width - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Initial value is `1.0f`. Has effect only if * @ref Flag "Flag::Wireframe" is enabled. */ - MeshVisualizer* setWireframeWidth(Float width) { + MeshVisualizer& setWireframeWidth(Float width) { if(flags & Flag::Wireframe) setUniform(wireframeWidthUniform, width); - return this; + return *this; } /** * @brief Set line smoothness - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Initial value is `2.0f`. Has effect only if * @ref Flag "Flag::Wireframe" is enabled. */ - MeshVisualizer* setSmoothness(Float smoothness); + MeshVisualizer& setSmoothness(Float smoothness); private: Flags flags; @@ -188,10 +188,10 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public AbstractShaderProgram { CORRADE_ENUMSET_OPERATORS(MeshVisualizer::Flags) -inline MeshVisualizer* MeshVisualizer::setSmoothness(Float smoothness) { +inline MeshVisualizer& MeshVisualizer::setSmoothness(Float smoothness) { if(flags & Flag::Wireframe) setUniform(smoothnessUniform, smoothness); - return this; + return *this; } }} diff --git a/src/Shaders/Phong.h b/src/Shaders/Phong.h index f5d91e8b8..7a39ffd81 100644 --- a/src/Shaders/Phong.h +++ b/src/Shaders/Phong.h @@ -119,87 +119,87 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { /** * @brief Set ambient color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If not set, default value is `(0.0f, 0.0f, 0.0f)`. Has no effect if * @ref Flag "Flag::AmbientTexture" is set. */ - Phong* setAmbientColor(const Color3& color); + Phong& setAmbientColor(const Color3& color); /** * @brief Set diffuse color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Has no effect if @ref Flag "Flag::AmbientTexture" is used. */ - Phong* setDiffuseColor(const Color3& color); + Phong& setDiffuseColor(const Color3& color); /** * @brief Set specular color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If not set, default value is `(1.0f, 1.0f, 1.0f)`. Has no effect if * @ref Flag "Flag::SpecularTexture" is set. */ - Phong* setSpecularColor(const Color3& color); + Phong& setSpecularColor(const Color3& color); /** * @brief Set shininess - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * The larger value, the harder surface (smaller specular highlight). * If not set, default value is `80.0f`. */ - Phong* setShininess(Float shininess) { + Phong& setShininess(Float shininess) { setUniform(shininessUniform, shininess); - return this; + return *this; } /** * @brief Set transformation matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Phong* setTransformationMatrix(const Matrix4& matrix) { + Phong& setTransformationMatrix(const Matrix4& matrix) { setUniform(transformationMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set normal matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Phong* setNormalMatrix(const Math::Matrix<3, Float>& matrix) { + Phong& setNormalMatrix(const Math::Matrix<3, Float>& matrix) { setUniform(normalMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set projection matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Phong* setProjectionMatrix(const Matrix4& matrix) { + Phong& setProjectionMatrix(const Matrix4& matrix) { setUniform(projectionMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set light position - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Phong* setLightPosition(const Vector3& light) { + Phong& setLightPosition(const Vector3& light) { setUniform(lightUniform, light); - return this; + return *this; } /** * @brief Set light color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If not set, default value is `(1.0f, 1.0f, 1.0f)`. */ - Phong* setLightColor(const Color3& color) { + Phong& setLightColor(const Color3& color) { setUniform(lightColorUniform, color); - return this; + return *this; } private: @@ -218,19 +218,19 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram { CORRADE_ENUMSET_OPERATORS(Phong::Flags) -inline Phong* Phong::setAmbientColor(const Color3& color) { +inline Phong& Phong::setAmbientColor(const Color3& color) { if(!(_flags & Flag::AmbientTexture)) setUniform(ambientColorUniform, color); - return this; + return *this; } -inline Phong* Phong::setDiffuseColor(const Color3& color) { +inline Phong& Phong::setDiffuseColor(const Color3& color) { if(!(_flags & Flag::DiffuseTexture)) setUniform(diffuseColorUniform, color); - return this; + return *this; } -inline Phong* Phong::setSpecularColor(const Color3& color) { +inline Phong& Phong::setSpecularColor(const Color3& color) { if(!(_flags & Flag::SpecularTexture)) setUniform(specularColorUniform, color); - return this; + return *this; } }} diff --git a/src/Shaders/Vector.h b/src/Shaders/Vector.h index f33bf468c..92e3b3860 100644 --- a/src/Shaders/Vector.h +++ b/src/Shaders/Vector.h @@ -49,20 +49,20 @@ template class MAGNUM_SHADERS_EXPORT Vector: public Abst /** * @brief Set transformation and projection matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Vector* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + Vector& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix); - return this; + return *this; } /** * @brief Set fill color - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) */ - Vector* setColor(const Color4& color) { + Vector& setColor(const Color4& color) { AbstractShaderProgram::setUniform(colorUniform, color); - return this; + return *this; } private: diff --git a/src/Shaders/VertexColor.h b/src/Shaders/VertexColor.h index d19cc87c9..5c32f4b86 100644 --- a/src/Shaders/VertexColor.h +++ b/src/Shaders/VertexColor.h @@ -56,13 +56,13 @@ template class MAGNUM_SHADERS_EXPORT VertexColor: public /** * @brief Set transformation and projection matrix - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default is identity matrix. */ - VertexColor* setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { + VertexColor& setTransformationProjectionMatrix(const typename DimensionTraits::MatrixType& matrix) { setUniform(transformationProjectionMatrixUniform, matrix); - return this; + return *this; } private: diff --git a/src/Shapes/Shape.h b/src/Shapes/Shape.h index 6dbf612f2..71854bd5c 100644 --- a/src/Shapes/Shape.h +++ b/src/Shapes/Shape.h @@ -92,11 +92,11 @@ template class Shape: public AbstractShape { /** * @brief Set shape - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Marks the feature as dirty. */ - Shape* setShape(const T& shape); + Shape& setShape(const T& shape); /** * @brief Transformed shape @@ -117,10 +117,10 @@ template class Shape: public AbstractShape { Implementation::Shape _shape, _transformedShape; }; -template inline Shape* Shape::setShape(const T& shape) { +template inline Shape& Shape::setShape(const T& shape) { Implementation::ShapeHelper::set(*this, shape); this->object()->setDirty(); - return this; + return *this; } template inline const T& Shape::transformedShape() { diff --git a/src/Text/DistanceFieldGlyphCache.cpp b/src/Text/DistanceFieldGlyphCache.cpp index 8de12233e..18dd71ff1 100644 --- a/src/Text/DistanceFieldGlyphCache.cpp +++ b/src/Text/DistanceFieldGlyphCache.cpp @@ -75,9 +75,9 @@ void DistanceFieldGlyphCache::setImage(const Vector2i& offset, const ImageRefere Texture2D input; input.setWrapping(Sampler::Wrapping::ClampToEdge) - ->setMinificationFilter(Sampler::Filter::Linear) - ->setMagnificationFilter(Sampler::Filter::Linear) - ->setImage(0, internalFormat, image); + .setMinificationFilter(Sampler::Filter::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setImage(0, internalFormat, image); /* Create distance field from input texture */ TextureTools::distanceField(&input, texture(), Rectanglei::fromSize(offset*scale, image.size()*scale), radius, image.size()); diff --git a/src/Text/GlyphCache.cpp b/src/Text/GlyphCache.cpp index 78355ad7f..2202c5930 100644 --- a/src/Text/GlyphCache.cpp +++ b/src/Text/GlyphCache.cpp @@ -70,9 +70,9 @@ void GlyphCache::initialize(const Vector2i& size) { void GlyphCache::initialize(const TextureFormat internalFormat, const Vector2i& size) { /* Initialize texture */ _texture.setWrapping(Sampler::Wrapping::ClampToEdge) - ->setMinificationFilter(Sampler::Filter::Linear) - ->setMagnificationFilter(Sampler::Filter::Linear) - ->setStorage(1, internalFormat, size); + .setMinificationFilter(Sampler::Filter::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setStorage(1, internalFormat, size); /* Default "Not Found" glyph */ glyphs.insert({0, {}}); diff --git a/src/Text/TextRenderer.cpp b/src/Text/TextRenderer.cpp index 137da6ba3..12d977741 100644 --- a/src/Text/TextRenderer.cpp +++ b/src/Text/TextRenderer.cpp @@ -187,8 +187,8 @@ std::tuple AbstractTextRenderer::render(AbstractFont* const fon in subclass) */ Mesh mesh; mesh.setPrimitive(Mesh::Primitive::Triangles) - ->setIndexCount(indexCount) - ->setIndexBuffer(indexBuffer, 0, indexType, 0, vertexCount); + .setIndexCount(indexCount) + .setIndexBuffer(indexBuffer, 0, indexType, 0, vertexCount); delete layouter; return std::make_tuple(std::move(mesh), rectangle); @@ -296,7 +296,7 @@ void AbstractTextRenderer::reserve(const uint32_t glyphCount, const Buffer::Usag } _indexBuffer.setData(indicesSize, nullptr, indexBufferUsage); _mesh.setIndexCount(0) - ->setIndexBuffer(&_indexBuffer, 0, indexType, 0, vertexCount); + .setIndexBuffer(&_indexBuffer, 0, indexType, 0, vertexCount); /* Map buffer for filling */ void* const indices = bufferMapImplementation(_indexBuffer, indicesSize); diff --git a/src/Text/TextRenderer.h b/src/Text/TextRenderer.h index 3c38429ad..7e03902ba 100644 --- a/src/Text/TextRenderer.h +++ b/src/Text/TextRenderer.h @@ -170,10 +170,10 @@ The text can be then drawn by configuring text shader, binding font texture and drawing the mesh: @code Text::AbstractFont* font; -Text::GlyphCache* cache; +Text::GlyphCache cache; -Shaders::VectorShader2D* shader; -Buffer *vertexBuffer, *indexBuffer; +Shaders::VectorShader2D shader; +Buffer vertexBuffer, indexBuffer; Mesh mesh; // Render the text @@ -182,9 +182,9 @@ std::tie(mesh, rectangle) = Text::TextRenderer2D::render(font, cache, 0.15f, "Hello World!", vertexBuffer, indexBuffer, Buffer::Usage::StaticDraw); // Draw white text centered on the screen -shader->setTransformationProjectionMatrix(projection*Matrix3::translation(-rectangle.width()/2.0f)) - ->setColor(Color3(1.0f)); - ->use(); +shader.setTransformationProjectionMatrix(projection*Matrix3::translation(-rectangle.width()/2.0f)) + .setColor(Color3(1.0f)); + .use(); glyphCache->texture()->bind(Shaders::VectorShader2D::FontTextureLayer); mesh.draw(); @endcode @@ -197,8 +197,8 @@ mutable texts (e.g. FPS counters, chat messages) there is another approach that doesn't recreate everything on each text change: @code Text::AbstractFont* font; -Text::GlyphCache* cache; -Shaders::VectorShader2D* shader; +Text::GlyphCache cache; +Shaders::VectorShader2D shader; // Initialize renderer and reserve memory for enough glyphs Text::TextRenderer2D renderer(font, cache, 0.15f); @@ -208,9 +208,9 @@ renderer.reserve(32, Buffer::Usage::DynamicDraw, Buffer::Usage::StaticDraw); renderer.render("Hello World Countdown: 10"); // Draw the text centered on the screen -shader->setTransformationProjectionMatrix(projection*Matrix3::translation(-renderer.rectangle().width()/2.0f)) - ->setColor(Color3(1.0f)); - ->use(); +shader.setTransformationProjectionMatrix(projection*Matrix3::translation(-renderer.rectangle().width()/2.0f)) + .setColor(Color3(1.0f)); + .use(); glyphCache->texture()->bind(Shaders::VectorShader2D::FontTextureLayer); renderer.mesh().draw(); @endcode diff --git a/src/Texture.h b/src/Texture.h index fee04c0e3..eeb87ed36 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -50,12 +50,12 @@ Image2D image({4096, 4096}, ImageFormat::RGBA, ImageType::UnsignedByte, data); Texture2D texture; texture.setMagnificationFilter(Sampler::Filter::Linear) - ->setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) - ->setWrapping(Sampler::Wrapping::ClampToEdge) - ->setMaxAnisotropy(Sampler::maxSupportedAnisotropy()) - ->setStorage(Math::log2(4096)+1, TextureFormat::RGBA8, {4096, 4096}) - ->setSubImage(0, {}, &image) - ->generateMipmap(); + .setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setWrapping(Sampler::Wrapping::ClampToEdge) + .setMaxAnisotropy(Sampler::maxSupportedAnisotropy()) + .setStorage(Math::log2(4096)+1, TextureFormat::RGBA8, {4096, 4096}) + .setSubImage(0, {}, &image) + .generateMipmap(); @endcode @attention Don't forget to fully configure the texture before use. Note that @@ -84,7 +84,7 @@ array with 16 layers of 64x64 images: Texture3D texture(Texture3D::Target::Texture2DArray); texture.setMagnificationFilter(Sampler::Filter::Linear) // ... - ->setStorage(levels, TextureFormat::RGBA8, {64, 64,16}); + .setStorage(levels, TextureFormat::RGBA8, {64, 64,16}); for(std::size_t i = 0; i != 16; ++i) { void* data = ...; @@ -249,7 +249,7 @@ template class Texture: public AbstractTexture { /** * @brief Set wrapping * @param wrapping Wrapping type for all texture dimensions - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Sets wrapping type for coordinates out of range (0, 1) for normal * textures and (0, textureSizeInGivenDirection-1) for rectangle @@ -264,9 +264,9 @@ template class Texture: public AbstractTexture { * with @def_gl{TEXTURE_WRAP_S}, @def_gl{TEXTURE_WRAP_T}, * @def_gl{TEXTURE_WRAP_R} */ - Texture* setWrapping(const Array& wrapping) { + Texture& setWrapping(const Array& wrapping) { DataHelper::setWrapping(this, wrapping); - return this; + return *this; } /** @@ -274,7 +274,7 @@ template class Texture: public AbstractTexture { * @param levels Mip level count * @param internalFormat Internal format * @param size Size of largest mip level - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Specifies entire structure of a texture at once, removing the need * for additional consistency checks and memory reallocations when @@ -296,9 +296,9 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureImage3D,EXT,direct_state_access}. */ - Texture* setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size) { + Texture& setStorage(Int levels, TextureFormat internalFormat, const typename DimensionTraits::VectorType& size) { DataHelper::setStorage(this, _target, levels, internalFormat, size); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES @@ -347,7 +347,7 @@ template class Texture: public AbstractTexture { * @param level Mip level * @param internalFormat Internal format * @param image %Image - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * For better performance when generating mipmaps using * generateMipmap() or calling setImage() more than once use @@ -361,16 +361,16 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureImage3D,EXT,direct_state_access} */ - Texture* setImage(Int level, TextureFormat internalFormat, const ImageReference& image) { + Texture& setImage(Int level, TextureFormat internalFormat, const ImageReference& image) { DataHelper::setImage(this, _target, level, internalFormat, image); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - Texture* setImage(Int level, TextureFormat internalFormat, BufferImage& image) { + Texture& setImage(Int level, TextureFormat internalFormat, BufferImage& image) { DataHelper::setImage(this, _target, level, internalFormat, image); - return this; + return *this; } #endif @@ -379,7 +379,7 @@ template class Texture: public AbstractTexture { * @param level Mip level * @param offset Offset where to put data in the texture * @param image %Image - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available, the * texture is bound to some layer before the operation. @@ -389,16 +389,16 @@ template class Texture: public AbstractTexture { * @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} */ - Texture* setSubImage(Int level, const typename DimensionTraits::VectorType& offset, const ImageReference& image) { + Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, const ImageReference& image) { DataHelper::setSubImage(this, _target, level, offset, image); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES2 /** @overload */ - Texture* setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage& image) { + Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage& image) { DataHelper::setSubImage(this, _target, level, offset, image); - return this; + return *this; } #endif @@ -418,27 +418,27 @@ template class Texture: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT - Texture* setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { + Texture& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); - return this; + return *this; } - Texture* setMagnificationFilter(Sampler::Filter filter) { + Texture& setMagnificationFilter(Sampler::Filter filter) { AbstractTexture::setMagnificationFilter(filter); - return this; + return *this; } #ifndef MAGNUM_TARGET_GLES3 - Texture* setBorderColor(const Color4& color) { + Texture& setBorderColor(const Color4& color) { AbstractTexture::setBorderColor(color); - return this; + return *this; } - Texture* setMaxAnisotropy(Float anisotropy) { + Texture& setMaxAnisotropy(Float anisotropy) { AbstractTexture::setMaxAnisotropy(anisotropy); - return this; + return *this; } #endif - Texture* generateMipmap() { + Texture& generateMipmap() { AbstractTexture::generateMipmap(); - return this; + return *this; } #endif }; diff --git a/src/TextureTools/DistanceField.cpp b/src/TextureTools/DistanceField.cpp index adb552cc9..5c3adbe90 100644 --- a/src/TextureTools/DistanceField.cpp +++ b/src/TextureTools/DistanceField.cpp @@ -47,19 +47,19 @@ class DistanceFieldShader: public AbstractShaderProgram { explicit DistanceFieldShader(); - DistanceFieldShader* setRadius(Int radius) { + DistanceFieldShader& setRadius(Int radius) { setUniform(radiusUniform, radius); - return this; + return *this; } - DistanceFieldShader* setScaling(const Vector2& scaling) { + DistanceFieldShader& setScaling(const Vector2& scaling) { setUniform(scalingUniform, scaling); - return this; + return *this; } - DistanceFieldShader* setImageSizeInverted(const Vector2& size) { + DistanceFieldShader& setImageSizeInverted(const Vector2& size) { setUniform(imageSizeInvertedUniform, size); - return this; + return *this; } private: @@ -158,8 +158,8 @@ void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectan DistanceFieldShader shader; shader.setRadius(radius) - ->setScaling(Vector2(imageSize)/rectangle.size()) - ->use(); + .setScaling(Vector2(imageSize)/rectangle.size()) + .use(); input->bind(DistanceFieldShader::TextureLayer); @@ -174,7 +174,7 @@ void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectan Mesh mesh; mesh.setPrimitive(Mesh::Primitive::Triangles) - ->setVertexCount(3); + .setVertexCount(3); /* Older GLSL doesn't have gl_VertexID, vertices must be supplied explicitly */ Buffer buffer; diff --git a/src/Timeline.h b/src/Timeline.h index ac67fb5f8..16ead00de 100644 --- a/src/Timeline.h +++ b/src/Timeline.h @@ -63,7 +63,7 @@ MyApplication::MyApplication(const Parameters& parameters): Platform::Applicatio // Initialization ... timeline.setMinimalFrameTime(1/120.0f) // 120 FPS at max - ->start(); + .start(); } void MyApplication::drawEvent() { @@ -96,14 +96,14 @@ class MAGNUM_EXPORT Timeline { /** * @brief Set minimal frame time - * @return Pointer to self (for method chaining) + * @return Reference to self (for method chaining) * * Default value is 0. * @see nextFrame() */ - Timeline* setMinimalFrameTime(Float seconds) { + Timeline& setMinimalFrameTime(Float seconds) { _minimalFrameTime = seconds; - return this; + return *this; } /** From 845b8982e548de77fd2311be569d9116ae328057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Jul 2013 19:53:37 +0200 Subject: [PATCH 77/90] Reducing pointer chasings, part 2: don't use `this->` so often. It clarifies some things (e.g. from what base given member is). Not changed where it would be too long to write. --- .../Implementation/AbstractBoxRenderer.cpp | 4 ++-- .../Implementation/AbstractShapeRenderer.cpp | 2 +- .../Implementation/AxisAlignedBoxRenderer.cpp | 4 ++-- src/DebugTools/Implementation/BoxRenderer.cpp | 4 ++-- .../Implementation/LineSegmentRenderer.cpp | 6 ++--- .../Implementation/PointRenderer.cpp | 6 ++--- .../Implementation/SphereRenderer.cpp | 4 ++-- src/Image.h | 2 +- src/Math/DualComplex.h | 22 +++++++++---------- src/Math/DualQuaternion.h | 12 +++++----- src/Math/Matrix.h | 4 ++-- src/SceneGraph/Animable.hpp | 4 ++-- src/SceneGraph/FeatureGroup.h | 14 +++++++----- src/SceneGraph/Object.hpp | 2 +- src/Shapes/AbstractShape.cpp | 2 +- src/Trade/ImageData.h | 2 +- 16 files changed, 49 insertions(+), 45 deletions(-) diff --git a/src/DebugTools/Implementation/AbstractBoxRenderer.cpp b/src/DebugTools/Implementation/AbstractBoxRenderer.cpp index 60fb738a8..5c7624d37 100644 --- a/src/DebugTools/Implementation/AbstractBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AbstractBoxRenderer.cpp @@ -32,11 +32,11 @@ namespace Magnum { namespace DebugTools { namespace Implementation { AbstractBoxRenderer<2>::AbstractBoxRenderer(): AbstractShapeRenderer<2>("box2d", "box2d-vertices", {}) { - if(!wireframeMesh) this->createResources(Primitives::Square::wireframe()); + if(!wireframeMesh) AbstractShapeRenderer<2>::createResources(Primitives::Square::wireframe()); } AbstractBoxRenderer<3>::AbstractBoxRenderer(): AbstractShapeRenderer<3>("box3d", "box3d-vertices", "box3d-indices") { - if(!wireframeMesh) this->createResources(Primitives::Cube::wireframe()); + if(!wireframeMesh) AbstractShapeRenderer<3>::createResources(Primitives::Cube::wireframe()); } template class AbstractBoxRenderer<2>; diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp index 40ceea33f..c8e7789d8 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp +++ b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp @@ -102,7 +102,7 @@ template AbstractShapeRenderer::AbstractShap template AbstractShapeRenderer::~AbstractShapeRenderer() {} template void AbstractShapeRenderer::createResources(typename MeshData::Type data) { - create(data, this->wireframeMesh, this->vertexBuffer, this->indexBuffer); + create(data, wireframeMesh, vertexBuffer, indexBuffer); } template class AbstractShapeRenderer<2>; diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index 80e90c22d..5a497c2da 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -34,12 +34,12 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template AxisAlignedBoxRenderer::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape* axisAlignedBox): axisAlignedBox(static_cast>*>(axisAlignedBox)->shape) {} template void AxisAlignedBoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { - this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* + AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation((axisAlignedBox.min()+axisAlignedBox.max())/2)* DimensionTraits::MatrixType::scaling(axisAlignedBox.max()-axisAlignedBox.min())) .setColor(options->color()) .use(); - this->wireframeMesh->draw(); + AbstractBoxRenderer::wireframeMesh->draw(); } template class AxisAlignedBoxRenderer<2>; diff --git a/src/DebugTools/Implementation/BoxRenderer.cpp b/src/DebugTools/Implementation/BoxRenderer.cpp index 245e112a9..dd5a45239 100644 --- a/src/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/DebugTools/Implementation/BoxRenderer.cpp @@ -34,10 +34,10 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template BoxRenderer::BoxRenderer(const Shapes::Implementation::AbstractShape* box): box(static_cast>*>(box)->shape) {} template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { - this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) + AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) .setColor(options->color()) .use(); - this->wireframeMesh->draw(); + AbstractBoxRenderer::wireframeMesh->draw(); } template class BoxRenderer<2>; diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/DebugTools/Implementation/LineSegmentRenderer.cpp index 8b6cd5020..9d0ee7524 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -51,15 +51,15 @@ namespace { } template LineSegmentRenderer::LineSegmentRenderer(const Shapes::Implementation::AbstractShape* line): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), line(static_cast>*>(line)->shape) { - if(!this->wireframeMesh) this->createResources(meshData()); + if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } template void LineSegmentRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { - this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* + AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* Implementation::lineSegmentRendererTransformation(line.a(), line.b())) .setColor(options->color()) .use(); - this->wireframeMesh->draw(); + AbstractShapeRenderer::wireframeMesh->draw(); } template class LineSegmentRenderer<2>; diff --git a/src/DebugTools/Implementation/PointRenderer.cpp b/src/DebugTools/Implementation/PointRenderer.cpp index 43459800c..458014adb 100644 --- a/src/DebugTools/Implementation/PointRenderer.cpp +++ b/src/DebugTools/Implementation/PointRenderer.cpp @@ -49,17 +49,17 @@ namespace { } template PointRenderer::PointRenderer(const Shapes::Implementation::AbstractShape* point): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), point(static_cast>*>(point)->shape) { - if(!this->wireframeMesh) this->createResources(meshData()); + if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } template void PointRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { /* Half scale, because the point is 2x2(x2) */ - this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* + AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation(point.position())* DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->pointSize()/2))) .setColor(options->color()) .use(); - this->wireframeMesh->draw(); + AbstractShapeRenderer::wireframeMesh->draw(); } template class PointRenderer<2>; diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/DebugTools/Implementation/SphereRenderer.cpp index 0a5a25bbb..8f13afac0 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/DebugTools/Implementation/SphereRenderer.cpp @@ -46,12 +46,12 @@ AbstractSphereRenderer<3>::AbstractSphereRenderer(): AbstractShapeRenderer<3>("s template SphereRenderer::SphereRenderer(const Shapes::Implementation::AbstractShape* sphere): sphere(static_cast>*>(sphere)->shape) {} template void SphereRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { - this->wireframeShader->setTransformationProjectionMatrix(projectionMatrix* + AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* DimensionTraits::MatrixType::translation(sphere.position())* DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(sphere.radius()))) .setColor(options->color()) .use(); - this->wireframeMesh->draw(); + AbstractShapeRenderer::wireframeMesh->draw(); } template class SphereRenderer<2>; diff --git a/src/Image.h b/src/Image.h index b2da03fb2..cbb420d4b 100644 --- a/src/Image.h +++ b/src/Image.h @@ -133,7 +133,7 @@ template inline Image& Image::op } template inline Image::operator ImageReference() const { - return ImageReference(this->format(), this->type(), _size, _data); + return ImageReference(AbstractImage::format(), AbstractImage::type(), _size, _data); } } diff --git a/src/Math/DualComplex.h b/src/Math/DualComplex.h index 95ed5e7fb..9ee19f2e9 100644 --- a/src/Math/DualComplex.h +++ b/src/Math/DualComplex.h @@ -145,7 +145,7 @@ template class DualComplex: public Dual> { * @see Complex::angle() */ constexpr Complex rotation() const { - return this->real(); + return Dual>::real(); } /** @@ -157,7 +157,7 @@ template class DualComplex: public Dual> { * @see translation(const Vector2&) */ Vector2 translation() const { - return Vector2(this->dual()); + return Vector2(Dual>::dual()); } /** @@ -166,7 +166,7 @@ template class DualComplex: public Dual> { * @see fromMatrix(), Complex::toMatrix() */ Matrix3 toMatrix() const { - return Matrix3::from(this->real().toMatrix(), translation()); + return Matrix3::from(Dual>::real().toMatrix(), translation()); } /** @@ -178,7 +178,7 @@ template class DualComplex: public Dual> { * @todo can this be done similarly to dual quaternions? */ DualComplex operator*(const DualComplex& other) const { - return {this->real()*other.real(), this->real()*other.dual() + this->dual()}; + return {Dual>::real()*other.real(), Dual>::real()*other.dual() + Dual>::dual()}; } /** @@ -190,7 +190,7 @@ template class DualComplex: public Dual> { * @see dualConjugated(), conjugated(), Complex::conjugated() */ DualComplex complexConjugated() const { - return {this->real().conjugated(), this->dual().conjugated()}; + return {Dual>::real().conjugated(), Dual>::dual().conjugated()}; } /** @@ -215,7 +215,7 @@ template class DualComplex: public Dual> { * Dual::conjugated() */ DualComplex conjugated() const { - return {this->real().conjugated(), {-this->dual().real(), this->dual().imaginary()}}; + return {Dual>::real().conjugated(), {-Dual>::dual().real(), Dual>::dual().imaginary()}}; } /** @@ -228,7 +228,7 @@ template class DualComplex: public Dual> { * @todo Can this be done similarly to dual quaternins? */ T lengthSquared() const { - return this->real().dot(); + return Dual>::real().dot(); } /** @@ -241,7 +241,7 @@ template class DualComplex: public Dual> { * @todo can this be done similarly to dual quaternions? */ T length() const { - return this->real().length(); + return Dual>::real().length(); } /** @@ -254,7 +254,7 @@ template class DualComplex: public Dual> { * @todo can this be done similarly to dual quaternions? */ DualComplex normalized() const { - return {this->real()/length(), this->dual()}; + return {Dual>::real()/length(), Dual>::dual()}; } /** @@ -267,7 +267,7 @@ template class DualComplex: public Dual> { * @todo can this be done similarly to dual quaternions? */ DualComplex inverted() const { - return DualComplex(this->real().inverted(), {{}, {}})*DualComplex({}, -this->dual()); + return DualComplex(Dual>::real().inverted(), {{}, {}})*DualComplex({}, -Dual>::dual()); } /** @@ -280,7 +280,7 @@ template class DualComplex: public Dual> { * @todo can this be done similarly to dual quaternions? */ DualComplex invertedNormalized() const { - return DualComplex(this->real().invertedNormalized(), {{}, {}})*DualComplex({}, -this->dual()); + return DualComplex(Dual>::real().invertedNormalized(), {{}, {}})*DualComplex({}, -Dual>::dual()); } /** diff --git a/src/Math/DualQuaternion.h b/src/Math/DualQuaternion.h index e3ef06f26..cead7637a 100644 --- a/src/Math/DualQuaternion.h +++ b/src/Math/DualQuaternion.h @@ -155,7 +155,7 @@ template class DualQuaternion: public Dual> { * @see Quaternion::angle(), Quaternion::axis() */ constexpr Quaternion rotation() const { - return this->real(); + return Dual>::real(); } /** @@ -167,7 +167,7 @@ template class DualQuaternion: public Dual> { * @see translation(const Vector3&) */ Vector3 translation() const { - return (this->dual()*this->real().conjugated()).vector()*T(2); + return (Dual>::dual()*Dual>::real().conjugated()).vector()*T(2); } /** @@ -176,7 +176,7 @@ template class DualQuaternion: public Dual> { * @see fromMatrix(), Quaternion::toMatrix() */ Matrix4 toMatrix() const { - return Matrix4::from(this->real().toMatrix(), translation()); + return Matrix4::from(Dual>::real().toMatrix(), translation()); } /** @@ -188,7 +188,7 @@ template class DualQuaternion: public Dual> { * @see dualConjugated(), conjugated(), Quaternion::conjugated() */ DualQuaternion quaternionConjugated() const { - return {this->real().conjugated(), this->dual().conjugated()}; + return {Dual>::real().conjugated(), Dual>::dual().conjugated()}; } /** @@ -213,7 +213,7 @@ template class DualQuaternion: public Dual> { * Dual::conjugated() */ DualQuaternion conjugated() const { - return {this->real().conjugated(), {this->dual().vector(), -this->dual().scalar()}}; + return {Dual>::real().conjugated(), {Dual>::dual().vector(), -Dual>::dual().scalar()}}; } /** @@ -225,7 +225,7 @@ template class DualQuaternion: public Dual> { * @f] */ Dual lengthSquared() const { - return {this->real().dot(), T(2)*Quaternion::dot(this->real(), this->dual())}; + return {Dual>::real().dot(), T(2)*Quaternion::dot(Dual>::real(), Dual>::dual())}; } /** diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index badd940a4..e50272c9f 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -121,7 +121,7 @@ template class Matrix: public RectangularMatrixdiagonal().sum(); } + T trace() const { return RectangularMatrix::diagonal().sum(); } /** @brief %Matrix without given column and row */ Matrix ij(std::size_t skipCol, std::size_t skipRow) const; @@ -162,7 +162,7 @@ template class Matrix: public RectangularMatrix invertedOrthogonal() const { CORRADE_ASSERT(isOrthogonal(), "Math::Matrix::invertedOrthogonal(): the matrix is not orthogonal", {}); - return this->transposed(); + return RectangularMatrix::transposed(); } #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 9847e2ad8..b9a35e596 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -64,7 +64,7 @@ template void AnimableGroup::ste if(!_runningCount && !wakeUp) return; wakeUp = false; - for(std::size_t i = 0; i != this->size(); ++i) { + for(std::size_t i = 0; i != AnimableGroup::size(); ++i) { Animable* animable = (*this)[i]; /* The animation was stopped recently, just decrease count of running @@ -132,7 +132,7 @@ template void AnimableGroup::ste animable->animationStep(time - animable->startTime, delta); } - CORRADE_INTERNAL_ASSERT(_runningCount <= this->size()); + CORRADE_INTERNAL_ASSERT(_runningCount <= AnimableGroup::size()); } }} diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index ae5142437..e632e8ec5 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -74,19 +74,23 @@ template class FeatureGroup: pub ~FeatureGroup(); /** @brief Whether the group is empty */ - bool isEmpty() const { return this->features.empty(); } + bool isEmpty() const { + return AbstractFeatureGroup::features.empty(); + } /** @brief Count of features in the group */ - std::size_t size() const { return this->features.size(); } + std::size_t size() const { + return AbstractFeatureGroup::features.size(); + } /** @brief Feature at given index */ Feature* operator[](std::size_t index) { - return static_cast(this->features[index]); + return static_cast(AbstractFeatureGroup::features[index]); } /** @overload */ const Feature* operator[](std::size_t index) const { - return static_cast(this->features[index]); + return static_cast(AbstractFeatureGroup::features[index]); } /** @@ -155,7 +159,7 @@ template using FeatureGroup3D = BasicFeatureGroup3D FeatureGroup::~FeatureGroup() { - for(auto i: this->features) static_cast(i)->_group = nullptr; + for(auto i: AbstractFeatureGroup::features) static_cast(i)->_group = nullptr; } template FeatureGroup& FeatureGroup::add(Feature* feature) { diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index e938c1e19..f2a2bf2d9 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -94,7 +94,7 @@ template Object& Object::s const auto transformation = Transformation::compose( Transformation::inverted(parent->absoluteTransformation()), absoluteTransformation()); setParent(parent); - this->setTransformation(transformation); + Transformation::setTransformation(transformation); return *this; } diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index d9d6ef0db..c552ab15d 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -32,7 +32,7 @@ namespace Magnum { namespace Shapes { template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature, Float>(object, group) { - this->setCachedTransformations(SceneGraph::CachedTransformation::Absolute); + SceneGraph::AbstractFeature::setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } template ShapeGroup* AbstractShape::group() { diff --git a/src/Trade/ImageData.h b/src/Trade/ImageData.h index 91c4e43c6..cdf9e1552 100644 --- a/src/Trade/ImageData.h +++ b/src/Trade/ImageData.h @@ -111,7 +111,7 @@ template inline ImageData& ImageData inline ImageData::operator ImageReference() const { - return ImageReference(this->format(), this->type(), _size, _data); + return ImageReference(AbstractImage::format(), AbstractImage::type(), _size, _data); } }} From e19154be5e38292387be28d5c470c2629201c8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:36:45 +0200 Subject: [PATCH 78/90] Reducing pointer chasings, part 3a: less pointer passing in root namespace. Passing pointer as function parameter will now mean that it is possible to pass `nullptr`. Some code examples now look like the parameter is copied instead of referenced, which is misleading. Updated the documentation to reflect that more clearly. --- src/AbstractFramebuffer.cpp | 18 ++++----- src/AbstractFramebuffer.h | 2 +- src/AbstractShaderProgram.cpp | 14 +++---- src/AbstractShaderProgram.h | 2 +- src/AbstractTexture.cpp | 42 +++++++++---------- src/AbstractTexture.h | 2 +- src/Buffer.cpp | 20 ++++----- src/Buffer.h | 10 ++--- src/BufferImage.h | 2 +- src/BufferTexture.cpp | 20 ++++----- src/BufferTexture.h | 25 ++++++------ src/Context.cpp | 22 +++++----- src/Context.h | 2 +- src/CubeMapTexture.h | 4 +- src/DebugMarker.cpp | 4 +- src/DebugMarker.h | 2 +- src/DefaultFramebuffer.cpp | 6 +-- src/DefaultFramebuffer.h | 4 +- src/Framebuffer.cpp | 34 ++++++++-------- src/Framebuffer.h | 46 ++++++++++----------- src/Mesh.cpp | 26 ++++++------ src/Mesh.h | 69 ++++++++++++++++---------------- src/Renderbuffer.cpp | 12 +++--- src/Renderbuffer.h | 2 +- src/Renderer.cpp | 10 ++--- src/Renderer.h | 2 +- src/Resource.h | 8 ++-- src/ResourceManager.h | 15 ++++--- src/Sampler.cpp | 2 +- src/Test/ResourceManagerTest.cpp | 2 +- 30 files changed, 218 insertions(+), 211 deletions(-) diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index 4feffb268..7edcd23d6 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/AbstractFramebuffer.cpp @@ -53,7 +53,7 @@ void AbstractFramebuffer::bind(FramebufferTarget target) { } void AbstractFramebuffer::bindInternal(FramebufferTarget target) { - Implementation::FramebufferState* state = Context::current()->state()->framebuffer; + Implementation::FramebufferState* state = Context::current()->state().framebuffer; /* If already bound, done, otherwise update tracked state */ if(target == FramebufferTarget::Read) { @@ -71,7 +71,7 @@ void AbstractFramebuffer::bindInternal(FramebufferTarget target) { } FramebufferTarget AbstractFramebuffer::bindInternal() { - Implementation::FramebufferState* state = Context::current()->state()->framebuffer; + Implementation::FramebufferState* state = Context::current()->state().framebuffer; /* Return target to which the framebuffer is already bound */ if(state->readBinding == _id && state->drawBinding == _id) @@ -112,14 +112,14 @@ AbstractFramebuffer& AbstractFramebuffer::setViewport(const Rectanglei& rectangl _viewport = rectangle; /* Update the viewport if the framebuffer is currently bound */ - if(Context::current()->state()->framebuffer->drawBinding == _id) + if(Context::current()->state().framebuffer->drawBinding == _id) setViewportInternal(); return *this; } void AbstractFramebuffer::setViewportInternal() { - Implementation::FramebufferState* state = Context::current()->state()->framebuffer; + Implementation::FramebufferState* state = Context::current()->state().framebuffer; CORRADE_INTERNAL_ASSERT(state->drawBinding == _id); @@ -165,7 +165,7 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Buf if(image.size() != size) image.setData(size, image.format(), image.type(), nullptr, usage); - image.buffer()->bind(Buffer::Target::PixelPack); + image.buffer().bind(Buffer::Target::PixelPack); /** @todo De-duplicate buffer size computation */ readImplementation(offset, size, image.format(), image.type(), image.pixelSize()*size.product(), nullptr); } @@ -194,9 +194,9 @@ void AbstractFramebuffer::invalidateImplementation(GLsizei count, GLenum* attach #endif } -void AbstractFramebuffer::initializeContextBasedFunctionality(Context* context) { +void AbstractFramebuffer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "AbstractFramebuffer: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; checkStatusImplementation = &AbstractFramebuffer::checkStatusImplementationDSA; @@ -234,9 +234,9 @@ void AbstractFramebuffer::initializeContextBasedFunctionality(Context* context) #ifndef MAGNUM_TARGET_GLES3 #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) #else - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) #endif { #ifndef MAGNUM_TARGET_GLES diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index 8e8df7f9f..2f7308dfc 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -297,7 +297,7 @@ class MAGNUM_EXPORT AbstractFramebuffer { Rectanglei _viewport; private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); GLenum MAGNUM_LOCAL checkStatusImplementationDefault(FramebufferTarget target); #ifndef MAGNUM_TARGET_GLES diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index 6e892d7e8..5e581074e 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -77,7 +77,7 @@ AbstractShaderProgram::UniformMatrix4x3dvImplementation AbstractShaderProgram::u #endif Int AbstractShaderProgram::maxSupportedVertexAttributeCount() { - GLint& value = Context::current()->state()->shaderProgram->maxSupportedVertexAttributeCount; + GLint& value = Context::current()->state().shaderProgram->maxSupportedVertexAttributeCount; /* Get the value, if not already cached */ if(value == 0) @@ -94,7 +94,7 @@ AbstractShaderProgram::AbstractShaderProgram(AbstractShaderProgram&& other) noex AbstractShaderProgram::~AbstractShaderProgram() { /* Remove current usage from the state */ - GLuint& current = Context::current()->state()->shaderProgram->current; + GLuint& current = Context::current()->state().shaderProgram->current; if(current == _id) current = 0; if(_id) glDeleteProgram(_id); @@ -125,7 +125,7 @@ std::pair AbstractShaderProgram::validate() { void AbstractShaderProgram::use() { /* Use only if the program isn't already in use */ - GLuint& current = Context::current()->state()->shaderProgram->current; + GLuint& current = Context::current()->state().shaderProgram->current; if(current != _id) glUseProgram(current = _id); } @@ -189,12 +189,12 @@ Int AbstractShaderProgram::uniformLocation(const std::string& name) { return location; } -void AbstractShaderProgram::initializeContextBasedFunctionality(Context* context) { +void AbstractShaderProgram::initializeContextBasedFunctionality(Context& context) { /** @todo OpenGL ES 2 has extension @es_extension{EXT,separate_shader_objects} for this */ #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported() || - context->isExtensionSupported()) { - Debug() << "AbstractShaderProgram: using" << (context->isExtensionSupported() ? + if(context.isExtensionSupported() || + context.isExtensionSupported()) { + Debug() << "AbstractShaderProgram: using" << (context.isExtensionSupported() ? Extensions::GL::ARB::separate_shader_objects::string() : Extensions::GL::EXT::direct_state_access::string()) << "features"; uniform1fvImplementation = &AbstractShaderProgram::uniformImplementationDSA; uniform2fvImplementation = &AbstractShaderProgram::uniformImplementationDSA; diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 8f3b0262d..a3b1e5cd2 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -774,7 +774,7 @@ class MAGNUM_EXPORT AbstractShaderProgram { #endif private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); typedef void(AbstractShaderProgram::*Uniform1fvImplementation)(GLint, GLsizei, const GLfloat*); typedef void(AbstractShaderProgram::*Uniform2fvImplementation)(GLint, GLsizei, const Math::Vector<2, GLfloat>*); diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 6eaf638ac..1f2f7b345 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -81,7 +81,7 @@ AbstractTexture::InvalidateImageImplementation AbstractTexture::invalidateImageI AbstractTexture::InvalidateSubImageImplementation AbstractTexture::invalidateSubImageImplementation = &AbstractTexture::invalidateSubImageImplementationNoOp; Int AbstractTexture::maxSupportedLayerCount() { - return Context::current()->state()->texture->maxSupportedLayerCount; + return Context::current()->state().texture->maxSupportedLayerCount; } void AbstractTexture::destroy() { @@ -89,7 +89,7 @@ void AbstractTexture::destroy() { if(!_id) return; /* Remove all bindings */ - for(GLuint& binding: Context::current()->state()->texture->bindings) + for(GLuint& binding: Context::current()->state().texture->bindings) if(binding == _id) binding = 0; glDeleteTextures(1, &_id); @@ -120,7 +120,7 @@ AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) { } void AbstractTexture::bind(Int layer) { - Implementation::TextureState* const textureState = Context::current()->state()->texture; + Implementation::TextureState* const textureState = Context::current()->state().texture; /* If already bound in given layer, nothing to do */ if(textureState->bindings[layer] == _id) return; @@ -129,7 +129,7 @@ void AbstractTexture::bind(Int layer) { } void AbstractTexture::bindImplementationDefault(GLint layer) { - Implementation::TextureState* const textureState = Context::current()->state()->texture; + Implementation::TextureState* const textureState = Context::current()->state().texture; /* Change to given layer, if not already there */ if(textureState->currentLayer != layer) @@ -141,7 +141,7 @@ void AbstractTexture::bindImplementationDefault(GLint layer) { #ifndef MAGNUM_TARGET_GLES void AbstractTexture::bindImplementationDSA(GLint layer) { - glBindMultiTextureEXT(GL_TEXTURE0 + layer, _target, (Context::current()->state()->texture->bindings[layer] = _id)); + glBindMultiTextureEXT(GL_TEXTURE0 + layer, _target, (Context::current()->state().texture->bindings[layer] = _id)); } #endif @@ -176,7 +176,7 @@ void AbstractTexture::mipmapImplementationDSA() { #endif void AbstractTexture::bindInternal() { - Implementation::TextureState* const textureState = Context::current()->state()->texture; + Implementation::TextureState* const textureState = Context::current()->state().texture; /* If the texture is already bound in current layer, nothing to do */ if(textureState->bindings[textureState->currentLayer] == _id) @@ -192,8 +192,8 @@ void AbstractTexture::bindInternal() { glBindTexture(_target, (textureState->bindings[internalLayer] = _id)); } -void AbstractTexture::initializeContextBasedFunctionality(Context* context) { - Implementation::TextureState* const textureState = context->state()->texture; +void AbstractTexture::initializeContextBasedFunctionality(Context& context) { + Implementation::TextureState* const textureState = context.state().texture; GLint& value = textureState->maxSupportedLayerCount; /* Get the value and resize bindings array */ @@ -201,7 +201,7 @@ void AbstractTexture::initializeContextBasedFunctionality(Context* context) { textureState->bindings.resize(value); #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "AbstractTexture: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; bindImplementation = &AbstractTexture::bindImplementationDSA; @@ -219,24 +219,24 @@ void AbstractTexture::initializeContextBasedFunctionality(Context* context) { subImage3DImplementation = &AbstractTexture::subImageImplementationDSA; } - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "AbstractTexture: using" << Extensions::GL::ARB::invalidate_subdata::string() << "features"; invalidateImageImplementation = &AbstractTexture::invalidateImageImplementationARB; invalidateSubImageImplementation = &AbstractTexture::invalidateSubImageImplementationARB; } - if(context->isExtensionSupported() && - !context->isExtensionSupported()) { + if(context.isExtensionSupported() && + !context.isExtensionSupported()) { Debug() << "AbstractTexture: using" << Extensions::GL::ARB::robustness::string() << "features"; getImageImplementation = &AbstractTexture::getImageImplementationRobustness; } - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "AbstractTexture: using" << Extensions::GL::ARB::texture_storage::string() << "features"; - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { storage1DImplementation = &AbstractTexture::storageImplementationDSA; storage2DImplementation = &AbstractTexture::storageImplementationDSA; storage3DImplementation = &AbstractTexture::storageImplementationDSA; @@ -981,7 +981,7 @@ template void AbstractTexture::image(GLenum target, GLin if(image.size() != size) image.setData(size, image.format(), image.type(), nullptr, usage); - image.buffer()->bind(Buffer::Target::PixelPack); + image.buffer().bind(Buffer::Target::PixelPack); (this->*getImageImplementation)(target, level, image.format(), image.type(), dataSize, nullptr); } @@ -1022,7 +1022,7 @@ void AbstractTexture::DataHelper<1>::setImage(AbstractTexture* const texture, co } void AbstractTexture::DataHelper<1>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage1D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*image1DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } @@ -1032,7 +1032,7 @@ void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture* const texture, } void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*subImage1DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif @@ -1046,7 +1046,7 @@ void AbstractTexture::DataHelper<2>::setImage(AbstractTexture* const texture, co #ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::DataHelper<2>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage2D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*image2DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } #endif @@ -1060,7 +1060,7 @@ void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture* const texture, #ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector2i& offset, BufferImage2D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*subImage2DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif @@ -1074,7 +1074,7 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture* const texture, co #ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::DataHelper<3>::setImage(AbstractTexture* const texture, const GLenum target, const GLint level, const TextureFormat internalFormat, BufferImage3D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*image3DImplementation)(target, level, internalFormat, image.size(), image.format(), image.type(), nullptr); } #endif @@ -1088,7 +1088,7 @@ void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture, #ifndef MAGNUM_TARGET_GLES2 void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture, const GLenum target, const GLint level, const Vector3i& offset, BufferImage3D& image) { - image.buffer()->bind(Buffer::Target::PixelUnpack); + image.buffer().bind(Buffer::Target::PixelUnpack); (texture->*subImage3DImplementation)(target, level, offset, image.size(), image.format(), image.type(), nullptr); } #endif diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 9f34b50f5..687f0def9 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -281,7 +281,7 @@ class MAGNUM_EXPORT AbstractTexture { GLenum _target; private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); typedef void(AbstractTexture::*BindImplementation)(GLint); void MAGNUM_LOCAL bindImplementationDefault(GLint layer); diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 7957e2461..5e50750a6 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -51,9 +51,9 @@ Buffer::MapRangeImplementation Buffer::mapRangeImplementation = &Buffer::mapRang Buffer::FlushMappedRangeImplementation Buffer::flushMappedRangeImplementation = &Buffer::flushMappedRangeImplementationDefault; Buffer::UnmapImplementation Buffer::unmapImplementation = &Buffer::unmapImplementationDefault; -void Buffer::initializeContextBasedFunctionality(Context* context) { +void Buffer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Buffer: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; copyImplementation = &Buffer::copyImplementationDSA; @@ -67,7 +67,7 @@ void Buffer::initializeContextBasedFunctionality(Context* context) { unmapImplementation = &Buffer::unmapImplementationDSA; } - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Buffer: using" << Extensions::GL::ARB::invalidate_subdata::string() << "features"; invalidateImplementation = &Buffer::invalidateImplementationARB; @@ -87,7 +87,7 @@ Buffer::Buffer(Buffer::Target targetHint): _targetHint(targetHint) } Buffer::~Buffer() { - GLuint* bindings = Context::current()->state()->buffer->bindings; + GLuint* bindings = Context::current()->state().buffer->bindings; /* Remove all current bindings from the state */ for(std::size_t i = 1; i != Implementation::BufferState::TargetCount; ++i) @@ -97,7 +97,7 @@ Buffer::~Buffer() { } void Buffer::bind(Target target, GLuint id) { - GLuint& bound = Context::current()->state()->buffer->bindings[Implementation::BufferState::indexForTarget(target)]; + GLuint& bound = Context::current()->state().buffer->bindings[Implementation::BufferState::indexForTarget(target)]; /* Already bound, nothing to do */ if(bound == id) return; @@ -108,7 +108,7 @@ void Buffer::bind(Target target, GLuint id) { } Buffer::Target Buffer::bindInternal(Target hint) { - GLuint* bindings = Context::current()->state()->buffer->bindings; + GLuint* bindings = Context::current()->state().buffer->bindings; GLuint& hintBinding = bindings[Implementation::BufferState::indexForTarget(hint)]; /* Shortcut - if already bound to hint, return */ @@ -161,13 +161,13 @@ void Buffer::unmapSub() { #endif #ifndef MAGNUM_TARGET_GLES2 -void Buffer::copyImplementationDefault(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - glCopyBufferSubData(static_cast(read->bindInternal(Target::CopyRead)), static_cast(write->bindInternal(Target::CopyWrite)), readOffset, writeOffset, size); +void Buffer::copyImplementationDefault(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { + glCopyBufferSubData(static_cast(read.bindInternal(Target::CopyRead)), static_cast(write.bindInternal(Target::CopyWrite)), readOffset, writeOffset, size); } #ifndef MAGNUM_TARGET_GLES -void Buffer::copyImplementationDSA(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - glNamedCopyBufferSubDataEXT(read->_id, write->_id, readOffset, writeOffset, size); +void Buffer::copyImplementationDSA(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { + glNamedCopyBufferSubDataEXT(read._id, write._id, readOffset, writeOffset, size); } #endif #endif diff --git a/src/Buffer.h b/src/Buffer.h index 4076fa8ea..73163292e 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -459,7 +459,7 @@ class MAGNUM_EXPORT Buffer { * @requires_gl31 %Extension @extension{ARB,copy_buffer} * @requires_gles30 %Buffer copying is not available in OpenGL ES 2.0. */ - static void copy(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { + static void copy(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { copyImplementation(read, write, readOffset, writeOffset, size); } #endif @@ -826,16 +826,16 @@ class MAGNUM_EXPORT Buffer { #endif private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); static void bind(Target hint, GLuint id); Target MAGNUM_LOCAL bindInternal(Target hint); #ifndef MAGNUM_TARGET_GLES2 - typedef void(*CopyImplementation)(Buffer*, Buffer*, GLintptr, GLintptr, GLsizeiptr); - static void MAGNUM_LOCAL copyImplementationDefault(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); + typedef void(*CopyImplementation)(Buffer&, Buffer&, GLintptr, GLintptr, GLsizeiptr); + static void MAGNUM_LOCAL copyImplementationDefault(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); #ifndef MAGNUM_TARGET_GLES - static void MAGNUM_LOCAL copyImplementationDSA(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); + static void MAGNUM_LOCAL copyImplementationDSA(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); #endif static CopyImplementation copyImplementation; #endif diff --git a/src/BufferImage.h b/src/BufferImage.h index 24dfc3a6e..634a02b76 100644 --- a/src/BufferImage.h +++ b/src/BufferImage.h @@ -66,7 +66,7 @@ template class MAGNUM_EXPORT BufferImage: public Abstrac typename DimensionTraits::VectorType size() const { return _size; } /** @brief %Image buffer */ - Buffer* buffer() { return &_buffer; } + Buffer& buffer() { return _buffer; } /** * @brief Set image data diff --git a/src/BufferTexture.cpp b/src/BufferTexture.cpp index 55231f970..7ff447fa4 100644 --- a/src/BufferTexture.cpp +++ b/src/BufferTexture.cpp @@ -34,8 +34,8 @@ namespace Magnum { BufferTexture::SetBufferImplementation BufferTexture::setBufferImplementation = &BufferTexture::setBufferImplementationDefault; BufferTexture::SetBufferRangeImplementation BufferTexture::setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault; -void BufferTexture::initializeContextBasedFunctionality(Context* context) { - if(context->isExtensionSupported()) { +void BufferTexture::initializeContextBasedFunctionality(Context& context) { + if(context.isExtensionSupported()) { Debug() << "BufferTexture: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; setBufferImplementation = &BufferTexture::setBufferImplementationDSA; @@ -43,22 +43,22 @@ void BufferTexture::initializeContextBasedFunctionality(Context* context) { } } -void BufferTexture::setBufferImplementationDefault(BufferTextureFormat internalFormat, Buffer* buffer) { +void BufferTexture::setBufferImplementationDefault(BufferTextureFormat internalFormat, Buffer& buffer) { bindInternal(); - glTexBuffer(GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id()); + glTexBuffer(GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer.id()); } -void BufferTexture::setBufferImplementationDSA(BufferTextureFormat internalFormat, Buffer* buffer) { - glTextureBufferEXT(id(), GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id()); +void BufferTexture::setBufferImplementationDSA(BufferTextureFormat internalFormat, Buffer& buffer) { + glTextureBufferEXT(id(), GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer.id()); } -void BufferTexture::setBufferRangeImplementationDefault(BufferTextureFormat internalFormat, Buffer* buffer, GLintptr offset, GLsizeiptr size) { +void BufferTexture::setBufferRangeImplementationDefault(BufferTextureFormat internalFormat, Buffer& buffer, GLintptr offset, GLsizeiptr size) { bindInternal(); - glTexBufferRange(GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id(), offset, size); + glTexBufferRange(GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer.id(), offset, size); } -void BufferTexture::setBufferRangeImplementationDSA(BufferTextureFormat internalFormat, Buffer* buffer, GLintptr offset, GLsizeiptr size) { - glTextureBufferRangeEXT(id(), GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id(), offset, size); +void BufferTexture::setBufferRangeImplementationDSA(BufferTextureFormat internalFormat, Buffer& buffer, GLintptr offset, GLsizeiptr size) { + glTextureBufferRangeEXT(id(), GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer.id(), offset, size); } } diff --git a/src/BufferTexture.h b/src/BufferTexture.h index 086d2a959..4bb1dacdc 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -164,12 +164,13 @@ using setBuffer(), you can fill the buffer at any time using data setting functions in Buffer itself. Note that the buffer is not managed (e.g. deleted on destruction) by the -texture, so you have to manage it on your own. On the other hand it allows you -to use one buffer for more textures or store more than one data in it. +texture, so you have to manage it on your own and ensure that it is available +for whole texture lifetime. On the other hand it allows you to use one buffer +for more textures or store more than one data in it. Example usage: @code -Buffer* buffer; +Buffer buffer; BufferTexture texture; texture.setBuffer(BufferTextureFormat::RGB32F, buffer); @@ -221,7 +222,7 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexBuffer} * or @fn_gl_extension{TextureBuffer,EXT,direct_state_access} */ - void setBuffer(BufferTextureFormat internalFormat, Buffer* buffer) { + void setBuffer(BufferTextureFormat internalFormat, Buffer& buffer) { (this->*setBufferImplementation)(internalFormat, buffer); } @@ -239,21 +240,21 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and @fn_gl{TexBufferRange} * or @fn_gl_extension{TextureBufferRange,EXT,direct_state_access} */ - void setBuffer(BufferTextureFormat internalFormat, Buffer* buffer, GLintptr offset, GLsizeiptr size) { + void setBuffer(BufferTextureFormat internalFormat, Buffer& buffer, GLintptr offset, GLsizeiptr size) { (this->*setBufferRangeImplementation)(internalFormat, buffer, offset, size); } private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); - typedef void(BufferTexture::*SetBufferImplementation)(BufferTextureFormat, Buffer*); - void MAGNUM_LOCAL setBufferImplementationDefault(BufferTextureFormat internalFormat, Buffer* buffer); - void MAGNUM_LOCAL setBufferImplementationDSA(BufferTextureFormat internalFormat, Buffer* buffer); + typedef void(BufferTexture::*SetBufferImplementation)(BufferTextureFormat, Buffer&); + void MAGNUM_LOCAL setBufferImplementationDefault(BufferTextureFormat internalFormat, Buffer& buffer); + void MAGNUM_LOCAL setBufferImplementationDSA(BufferTextureFormat internalFormat, Buffer& buffer); static SetBufferImplementation setBufferImplementation; - typedef void(BufferTexture::*SetBufferRangeImplementation)(BufferTextureFormat, Buffer*, GLintptr, GLsizeiptr); - void MAGNUM_LOCAL setBufferRangeImplementationDefault(BufferTextureFormat internalFormat, Buffer* buffer, GLintptr offset, GLsizeiptr size); - void MAGNUM_LOCAL setBufferRangeImplementationDSA(BufferTextureFormat internalFormat, Buffer* buffer, GLintptr offset, GLsizeiptr size); + typedef void(BufferTexture::*SetBufferRangeImplementation)(BufferTextureFormat, Buffer&, GLintptr, GLsizeiptr); + void MAGNUM_LOCAL setBufferRangeImplementationDefault(BufferTextureFormat internalFormat, Buffer& buffer, GLintptr offset, GLsizeiptr size); + void MAGNUM_LOCAL setBufferRangeImplementationDSA(BufferTextureFormat internalFormat, Buffer& buffer, GLintptr offset, GLsizeiptr size); static SetBufferRangeImplementation setBufferRangeImplementation; }; diff --git a/src/Context.cpp b/src/Context.cpp index d84d5fbbe..9fa4e2563 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -407,19 +407,19 @@ Context::Context() { _state = new Implementation::State; /* Initialize functionality based on current OpenGL version and extensions */ - AbstractFramebuffer::initializeContextBasedFunctionality(this); - AbstractShaderProgram::initializeContextBasedFunctionality(this); - AbstractTexture::initializeContextBasedFunctionality(this); - Buffer::initializeContextBasedFunctionality(this); + AbstractFramebuffer::initializeContextBasedFunctionality(*this); + AbstractShaderProgram::initializeContextBasedFunctionality(*this); + AbstractTexture::initializeContextBasedFunctionality(*this); + Buffer::initializeContextBasedFunctionality(*this); #ifndef MAGNUM_TARGET_GLES - BufferTexture::initializeContextBasedFunctionality(this); + BufferTexture::initializeContextBasedFunctionality(*this); #endif - DebugMarker::initializeContextBasedFunctionality(this); - DefaultFramebuffer::initializeContextBasedFunctionality(this); - Framebuffer::initializeContextBasedFunctionality(this); - Mesh::initializeContextBasedFunctionality(this); - Renderbuffer::initializeContextBasedFunctionality(this); - Renderer::initializeContextBasedFunctionality(this); + DebugMarker::initializeContextBasedFunctionality(*this); + DefaultFramebuffer::initializeContextBasedFunctionality(*this); + Framebuffer::initializeContextBasedFunctionality(*this); + Mesh::initializeContextBasedFunctionality(*this); + Renderbuffer::initializeContextBasedFunctionality(*this); + Renderer::initializeContextBasedFunctionality(*this); } Context::~Context() { diff --git a/src/Context.h b/src/Context.h index 358707c15..018f8ffcf 100644 --- a/src/Context.h +++ b/src/Context.h @@ -355,7 +355,7 @@ class MAGNUM_EXPORT Context { } #ifndef DOXYGEN_GENERATING_OUTPUT - Implementation::State* state() { return _state; } + Implementation::State& state() { return *_state; } #endif private: diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 352223448..4f6478e18 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -61,8 +61,8 @@ CubeMapTexture texture; texture.setMagnificationFilter(Sampler::Filter::Linear) // ... .setStorage(Math::log2(256)+1, TextureFormat::RGBA8, {256, 256}) - .setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, &positiveX) - .setSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, &negativeX) + .setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, positiveX) + .setSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, negativeX) // ... @endcode diff --git a/src/DebugMarker.cpp b/src/DebugMarker.cpp index 44b2e6919..47049c742 100644 --- a/src/DebugMarker.cpp +++ b/src/DebugMarker.cpp @@ -33,10 +33,10 @@ namespace Magnum { DebugMarker::MarkImplementation DebugMarker::markImplementation = &DebugMarker::markImplementationDefault; -void DebugMarker::initializeContextBasedFunctionality(Context* context) { +void DebugMarker::initializeContextBasedFunctionality(Context& context) { /** @todo Re-enable when extension wrangler is available for ES */ #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "DebugMarker: using" << Extensions::GL::GREMEDY::string_marker::string() << "features"; markImplementation = &DebugMarker::markImplementationDebugger; diff --git a/src/DebugMarker.h b/src/DebugMarker.h index 04bf3625a..2c32e18a7 100644 --- a/src/DebugMarker.h +++ b/src/DebugMarker.h @@ -58,7 +58,7 @@ class MAGNUM_EXPORT DebugMarker { } private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); typedef void(*MarkImplementation)(const std::string&); static MAGNUM_LOCAL void markImplementationDefault(const std::string& string); diff --git a/src/DefaultFramebuffer.cpp b/src/DefaultFramebuffer.cpp index cc6e7789e..02fabecdd 100644 --- a/src/DefaultFramebuffer.cpp +++ b/src/DefaultFramebuffer.cpp @@ -78,8 +78,8 @@ void DefaultFramebuffer::invalidate(std::initializer_liststate()->framebuffer; +void DefaultFramebuffer::initializeContextBasedFunctionality(Context& context) { + Implementation::FramebufferState* state = context.state().framebuffer; /* Initial framebuffer size */ GLint viewport[4]; @@ -88,7 +88,7 @@ void DefaultFramebuffer::initializeContextBasedFunctionality(Context* context) { /* Fake initial glViewport() call for ApiTrace */ #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); #endif } diff --git a/src/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index c860e5d3e..e04fc75d1 100644 --- a/src/DefaultFramebuffer.h +++ b/src/DefaultFramebuffer.h @@ -58,7 +58,7 @@ any drawing in your @ref Platform::GlutApplication::drawEvent() "drawEvent()" implementation, for example: @code void drawEvent() { - defaultFramebuffer.clear(AbstractFramebuffer::Clear::Color|AbstractFramebuffer::Clear::Depth); + defaultFramebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth); // ... } @@ -410,7 +410,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { #endif private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); }; /** @brief Default framebuffer instance */ diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index fcadfd546..5458066fe 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -60,7 +60,7 @@ Framebuffer::Framebuffer(const Rectanglei& viewport) { Framebuffer::~Framebuffer() { /* If bound, remove itself from state */ - Implementation::FramebufferState* state = Context::current()->state()->framebuffer; + Implementation::FramebufferState* state = Context::current()->state().framebuffer; if(state->readBinding == _id) state->readBinding = 0; if(state->drawBinding == _id) state->drawBinding = 0; @@ -107,15 +107,15 @@ void Framebuffer::invalidate(std::initializer_list attac delete[] _attachments; } -Framebuffer& Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int mipLevel) { +Framebuffer& Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D& texture, Int mipLevel) { /** @todo Check for texture target compatibility */ - (this->*texture2DImplementation)(attachment, GLenum(texture->target()), texture->id(), mipLevel); + (this->*texture2DImplementation)(attachment, GLenum(texture.target()), texture.id(), mipLevel); return *this; } -void Framebuffer::initializeContextBasedFunctionality(Context* context) { +void Framebuffer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Framebuffer: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; renderbufferImplementation = &Framebuffer::renderbufferImplementationDSA; @@ -128,21 +128,21 @@ void Framebuffer::initializeContextBasedFunctionality(Context* context) { #endif } -void Framebuffer::renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer* renderbuffer) { - glFramebufferRenderbuffer(GLenum(bindInternal()), GLenum(attachment), GL_RENDERBUFFER, renderbuffer->id()); +void Framebuffer::renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer) { + glFramebufferRenderbuffer(GLenum(bindInternal()), GLenum(attachment), GL_RENDERBUFFER, renderbuffer.id()); } #ifndef MAGNUM_TARGET_GLES -void Framebuffer::renderbufferImplementationDSA(BufferAttachment attachment, Renderbuffer* renderbuffer) { - glNamedFramebufferRenderbufferEXT(_id, GLenum(attachment), GL_RENDERBUFFER, renderbuffer->id()); +void Framebuffer::renderbufferImplementationDSA(BufferAttachment attachment, Renderbuffer& renderbuffer) { + glNamedFramebufferRenderbufferEXT(_id, GLenum(attachment), GL_RENDERBUFFER, renderbuffer.id()); } -void Framebuffer::texture1DImplementationDefault(BufferAttachment attachment, Texture1D* texture, GLint mipLevel) { - glFramebufferTexture1D(GLenum(bindInternal()), GLenum(attachment), static_cast(texture->target()), texture->id(), mipLevel); +void Framebuffer::texture1DImplementationDefault(BufferAttachment attachment, Texture1D& texture, GLint mipLevel) { + glFramebufferTexture1D(GLenum(bindInternal()), GLenum(attachment), static_cast(texture.target()), texture.id(), mipLevel); } -void Framebuffer::texture1DImplementationDSA(BufferAttachment attachment, Texture1D* texture, GLint mipLevel) { - glNamedFramebufferTexture1DEXT(_id, GLenum(attachment), GLenum(texture->target()), texture->id(), mipLevel); +void Framebuffer::texture1DImplementationDSA(BufferAttachment attachment, Texture1D& texture, GLint mipLevel) { + glNamedFramebufferTexture1DEXT(_id, GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel); } #endif @@ -156,11 +156,11 @@ void Framebuffer::texture2DImplementationDSA(BufferAttachment attachment, GLenum } #endif -void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Texture3D* texture, GLint mipLevel, GLint layer) { +void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Texture3D& texture, GLint mipLevel, GLint layer) { /** @todo Check for texture target compatibility */ /** @todo Get some extension wrangler for glFramebufferTexture3D() (extension only) */ #ifndef MAGNUM_TARGET_GLES - glFramebufferTexture3D(GLenum(bindInternal()), GLenum(attachment), static_cast(texture->target()), texture->id(), mipLevel, layer); + glFramebufferTexture3D(GLenum(bindInternal()), GLenum(attachment), static_cast(texture.target()), texture.id(), mipLevel, layer); #else static_cast(attachment); static_cast(texture); @@ -170,8 +170,8 @@ void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Te } #ifndef MAGNUM_TARGET_GLES -void Framebuffer::texture3DImplementationDSA(BufferAttachment attachment, Texture3D* texture, GLint mipLevel, GLint layer) { - glNamedFramebufferTexture3DEXT(_id, GLenum(attachment), GLenum(texture->target()), texture->id(), mipLevel, layer); +void Framebuffer::texture3DImplementationDSA(BufferAttachment attachment, Texture3D& texture, GLint mipLevel, GLint layer) { + glNamedFramebufferTexture3DEXT(_id, GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel, layer); } #endif diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 8e1c84768..2276426ce 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -55,9 +55,9 @@ Renderbuffer depthStencil; // configure the textures and allocate texture memory... -framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), &color); -framebuffer.attachTexture2D(Framebuffer::ColorAttachment(1), &normal); -framebuffer.attachRenderbuffer(Framebuffer::BufferAttachment::DepthStencil, &depthStencil); +framebuffer.attachTexture2D(Framebuffer::ColorAttachment(0), color); +framebuffer.attachTexture2D(Framebuffer::ColorAttachment(1), normal); +framebuffer.attachRenderbuffer(Framebuffer::BufferAttachment::DepthStencil, depthStencil); @endcode Then you need to map outputs of your shader to color attachments in the @@ -73,13 +73,13 @@ off-screen framebuffer, then bind the default and render the textures on screen: @code void drawEvent() { - defaultFramebuffer.clear(DefaultFramebuffer::Clear::Color) - framebuffer.clear(Framebuffer::Clear::Color|Framebuffer::Clear::Depth|Framebuffer::Clear::Stencil); + defaultFramebuffer.clear(FramebufferClear::Color) + framebuffer.clear(FramebufferClear::Color|FramebufferClear::Depth|FramebufferClear::Stencil); - framebuffer.bind(Framebuffer::Target::Draw); + framebuffer.bind(FramebufferTarget::Draw); // ... - defaultFramebuffer.bind(DefaultFramebuffer::Target::Draw); + defaultFramebuffer.bind(Framebuffer::Target::Draw); // ... } @endcode @@ -405,7 +405,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see @fn_gl{BindFramebuffer}, @fn_gl{FramebufferRenderbuffer} or * @fn_gl_extension{NamedFramebufferRenderbuffer,EXT,direct_state_access} */ - Framebuffer& attachRenderbuffer(BufferAttachment attachment, Renderbuffer* renderbuffer) { + Framebuffer& attachRenderbuffer(BufferAttachment attachment, Renderbuffer& renderbuffer) { (this->*renderbufferImplementation)(attachment, renderbuffer); return *this; } @@ -425,7 +425,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} * @requires_gl Only 2D and 3D textures are available in OpenGL ES. */ - Framebuffer& attachTexture1D(BufferAttachment attachment, Texture1D* texture, Int level) { + Framebuffer& attachTexture1D(BufferAttachment attachment, Texture1D& texture, Int level) { (this->*texture1DImplementation)(attachment, texture, level); return *this; } @@ -444,7 +444,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see attachCubeMapTexture(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ - Framebuffer& attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int level); + Framebuffer& attachTexture2D(BufferAttachment attachment, Texture2D& texture, Int level); /** * @brief Attach cube map texture to given buffer @@ -460,8 +460,8 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @see attachTexture2D(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} */ - Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, Int level) { - (this->*texture2DImplementation)(attachment, GLenum(coordinate), texture->id(), level); + Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture& texture, CubeMapTexture::Coordinate coordinate, Int level) { + (this->*texture2DImplementation)(attachment, GLenum(coordinate), texture.id(), level); return *this; } @@ -480,7 +480,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} * @requires_es_extension %Extension @es_extension{OES,texture_3D} */ - Framebuffer& attachTexture3D(BufferAttachment attachment, Texture3D* texture, Int level, Int layer) { + Framebuffer& attachTexture3D(BufferAttachment attachment, Texture3D& texture, Int level, Int layer) { /** @todo Check for texture target compatibility */ (this->*texture3DImplementation)(attachment, texture, level, layer); return *this; @@ -495,19 +495,19 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { #endif private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); - typedef void(Framebuffer::*RenderbufferImplementation)(BufferAttachment, Renderbuffer*); - void MAGNUM_LOCAL renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer* renderbuffer); + typedef void(Framebuffer::*RenderbufferImplementation)(BufferAttachment, Renderbuffer&); + void MAGNUM_LOCAL renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL renderbufferImplementationDSA(BufferAttachment attachment, Renderbuffer* renderbuffer); + void MAGNUM_LOCAL renderbufferImplementationDSA(BufferAttachment attachment, Renderbuffer& renderbuffer); #endif static RenderbufferImplementation renderbufferImplementation; #ifndef MAGNUM_TARGET_GLES - typedef void(Framebuffer::*Texture1DImplementation)(BufferAttachment, Texture1D*, GLint); - void MAGNUM_LOCAL texture1DImplementationDefault(BufferAttachment attachment, Texture1D* texture, GLint level); - void MAGNUM_LOCAL texture1DImplementationDSA(BufferAttachment attachment, Texture1D* texture, GLint level); + typedef void(Framebuffer::*Texture1DImplementation)(BufferAttachment, Texture1D&, GLint); + void MAGNUM_LOCAL texture1DImplementationDefault(BufferAttachment attachment, Texture1D& texture, GLint level); + void MAGNUM_LOCAL texture1DImplementationDSA(BufferAttachment attachment, Texture1D& texture, GLint level); static Texture1DImplementation texture1DImplementation; #endif @@ -518,10 +518,10 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { #endif static MAGNUM_LOCAL Texture2DImplementation texture2DImplementation; - typedef void(Framebuffer::*Texture3DImplementation)(BufferAttachment, Texture3D*, GLint, GLint); - void MAGNUM_LOCAL texture3DImplementationDefault(BufferAttachment attachment, Texture3D* texture, GLint level, GLint layer); + typedef void(Framebuffer::*Texture3DImplementation)(BufferAttachment, Texture3D&, GLint, GLint); + void MAGNUM_LOCAL texture3DImplementationDefault(BufferAttachment attachment, Texture3D& texture, GLint level, GLint layer); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_LOCAL texture3DImplementationDSA(BufferAttachment attachment, Texture3D* texture, GLint level, GLint layer); + void MAGNUM_LOCAL texture3DImplementationDSA(BufferAttachment attachment, Texture3D& texture, GLint level, GLint layer); #endif static Texture3DImplementation texture3DImplementation; }; diff --git a/src/Mesh.cpp b/src/Mesh.cpp index d8d519a57..e5b394a3b 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -69,7 +69,7 @@ Mesh::Mesh(Primitive primitive): _primitive(primitive), _vertexCount(0), _indexC Mesh::~Mesh() { /* Remove current vao from the state */ - GLuint& current = Context::current()->state()->mesh->currentVAO; + GLuint& current = Context::current()->state().mesh->currentVAO; if(current == vao) current = 0; (this->*destroyImplementation)(); @@ -117,10 +117,10 @@ Mesh& Mesh::operator=(Mesh&& other) { return *this; } -Mesh& Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { +Mesh& Mesh::setIndexBuffer(Buffer& buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { #ifdef CORRADE_TARGET_NACL - CORRADE_ASSERT(buffer->targetHint() == Buffer::Target::ElementArray, - "Mesh::setIndexBuffer(): the buffer has unexpected target hint, expected" << Buffer::Target::ElementArray << "but got" << buffer->targetHint(), this); + CORRADE_ASSERT(buffer.targetHint() == Buffer::Target::ElementArray, + "Mesh::setIndexBuffer(): the buffer has unexpected target hint, expected" << Buffer::Target::ElementArray << "but got" << buffer.targetHint(), this); #endif indexOffset = offset; @@ -162,7 +162,7 @@ void Mesh::draw() { void Mesh::bindVAO(GLuint vao) { /** @todo Get some extension wrangler instead to avoid linker errors to glBindVertexArray() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 - GLuint& current = Context::current()->state()->mesh->currentVAO; + GLuint& current = Context::current()->state().mesh->currentVAO; if(current != vao) glBindVertexArray(current = vao); #else static_cast(vao); @@ -191,16 +191,16 @@ void Mesh::vertexAttribPointer(const LongAttribute& attribute) { #endif #endif -void Mesh::initializeContextBasedFunctionality(Context* context) { +void Mesh::initializeContextBasedFunctionality(Context& context) { /** @todo VAOs are in ES 3.0 and as extension in ES 2.0, enable them when some extension wrangler is available */ #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Mesh: using" << Extensions::GL::APPLE::vertex_array_object::string() << "features"; createImplementation = &Mesh::createImplementationVAO; destroyImplementation = &Mesh::destroyImplementationVAO; - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Mesh: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; attributePointerImplementation = &Mesh::attributePointerImplementationDSA; @@ -299,18 +299,18 @@ void Mesh::attributePointerImplementationDSA(const LongAttribute& attribute) { #endif #endif -void Mesh::bindIndexBufferImplementationDefault(Buffer* buffer) { - indexBuffer = buffer; +void Mesh::bindIndexBufferImplementationDefault(Buffer& buffer) { + indexBuffer = &buffer; } -void Mesh::bindIndexBufferImplementationVAO(Buffer* buffer) { +void Mesh::bindIndexBufferImplementationVAO(Buffer& buffer) { bindVAO(vao); /* Reset ElementArray binding to force explicit glBindBuffer call later */ /** @todo Do this cleaner way */ - Context::current()->state()->buffer->bindings[Implementation::BufferState::indexForTarget(Buffer::Target::ElementArray)] = 0; + Context::current()->state().buffer->bindings[Implementation::BufferState::indexForTarget(Buffer::Target::ElementArray)] = 0; - buffer->bind(Buffer::Target::ElementArray); + buffer.bind(Buffer::Target::ElementArray); } void Mesh::bindImplementationDefault() { diff --git a/src/Mesh.h b/src/Mesh.h index bc37733f1..5afadf688 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -57,9 +57,10 @@ conveniently compress the indices, fill the index buffer and configure the mesh instead of calling setIndexCount() and setIndexBuffer() manually. Note that neither vertex buffers nor index buffer is managed (e.g. deleted on -destruction) by the mesh, so you have to manage them on your own. On the other -hand it allows you to use one buffer for more meshes (each mesh for example -configured for different shader) or store data for more meshes in one buffer. +destruction) by the mesh, so you have to manage them on your own and ensure +that they are available for whole mesh lifetime. On the other hand it allows +you to use one buffer for more meshes (each mesh for example configured for +different shader) or store data for more meshes in one buffer. If the mesh has non-zero index count, it is treated as indexed mesh, otherwise it is treated as non-indexed mesh. If both index and vertex count is zero, the @@ -77,8 +78,8 @@ class MyShader: public AbstractShaderProgram { // ... }; -Mesh mesh; Buffer vertexBuffer; +Mesh mesh; // Fill vertex buffer with position data static constexpr Vector3 positions[30] = { @@ -97,8 +98,8 @@ mesh.setPrimitive(Mesh::Primitive::Triangles) @code // Non-indexed primitive with positions and normals Trade::MeshData3D plane = Primitives::Plane::solid(); -Mesh mesh; Buffer vertexBuffer; +Mesh mesh; // Fill vertex buffer with interleaved position and normal data MeshTools::interleave(mesh, buffer, Buffer::Usage::StaticDraw, @@ -177,23 +178,23 @@ class MyShader: public AbstractShaderProgram { // ... }; -Mesh* mesh; +Mesh mesh; // Fill position buffer with positions specified as two-component XY (i.e., // no Z component, which is meant to be always 0) -Buffer* positionBuffer; +Buffer positionBuffer; Vector2 positions[30] = { // ... }; // Specify layout of positions buffer -- only two components, unspecified Z // component will be automatically set to 0 -mesh->addVertexBuffer(positionBuffer, 0, +mesh.addVertexBuffer(positionBuffer, 0, MyShader::Position(MyShader::Position::Components::Two)); // Fill color buffer with colors specified as four-byte BGRA (e.g. directly // from TGA file) -Buffer* colorBuffer; +Buffer colorBuffer; GLubyte colors[4*30] = { // ... }; @@ -201,7 +202,7 @@ colorBuffer.setData(colors, Buffer::Usage::StaticDraw); // Specify layout of color buffer -- BGRA, each component unsigned byte and we // want to normalize them from [0, 255] to [0.0f, 1.0f] -mesh->addVertexBuffer(colorBuffer, 0, MyShader::Color( +mesh.addVertexBuffer(colorBuffer, 0, MyShader::Color( MyShader::Color::Components::BGRA, MyShader::Color::DataType::UnsignedByte, MyShader::Color::DataOption::Normalized)); @@ -425,8 +426,8 @@ class MAGNUM_EXPORT Mesh { * but it accepts only position and normal, so you have to skip the * texture coordinate array: * @code - * Mesh mesh; * Buffer buffer; + * Mesh mesh; * mesh.addVertexBuffer(buffer, * 35, // offset of the data * Shaders::PhongShader::Position(), // position array @@ -457,7 +458,7 @@ class MAGNUM_EXPORT Mesh { * @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} * if @extension{APPLE,vertex_array_object} is available */ - template Mesh& addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes); + template Mesh& addVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes); /** * @brief Add buffer with interleaved vertex attributes for use with given shader @@ -478,8 +479,8 @@ class MAGNUM_EXPORT Mesh { * position and normal, so you have to skip weight and texture * coordinate in each vertex: * @code - * Mesh mesh; * Buffer buffer; + * Mesh mesh; * mesh.addInterleavedVertexBuffer(buffer, * 35, // skip other data * sizeof(Float), // skip vertex weight @@ -517,7 +518,7 @@ class MAGNUM_EXPORT Mesh { * @fn_gl_extension{VertexArrayVertexAttribOffset,EXT,direct_state_access} * if @extension{APPLE,vertex_array_object} is available */ - template inline Mesh& addInterleavedVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { + template inline Mesh& addInterleavedVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes) { addInterleavedVertexBufferInternal(buffer, offset, strideOfInterleaved(attributes...), attributes...); return *this; } @@ -528,7 +529,7 @@ class MAGNUM_EXPORT Mesh { * * See addInterleavedVertexBuffer() for more information. */ - template inline Mesh& addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute) { + template inline Mesh& addVertexBufferStride(Buffer& buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute) { addInterleavedVertexBufferInternal(buffer, offset, stride, attribute); return *this; } @@ -553,7 +554,7 @@ class MAGNUM_EXPORT Mesh { * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @extension{APPLE,vertex_array_object} is available) */ - Mesh& setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end); + Mesh& setIndexBuffer(Buffer& buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end); /** * @brief Set index buffer @@ -568,7 +569,7 @@ class MAGNUM_EXPORT Mesh { * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @extension{APPLE,vertex_array_object} is available) */ - Mesh& setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type) { + Mesh& setIndexBuffer(Buffer& buffer, GLintptr offset, IndexType type) { return setIndexBuffer(buffer, offset, type, 0, 0); } @@ -620,20 +621,20 @@ class MAGNUM_EXPORT Mesh { #endif #endif - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); /* Adding non-interleaved vertex attributes */ - template inline void addVertexBufferInternal(Buffer* buffer, GLintptr offset, const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { + template inline void addVertexBufferInternal(Buffer& buffer, GLintptr offset, const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { addVertexAttribute(buffer, attribute, offset, 0); /* Add size of this attribute array to offset for next attribute */ addVertexBufferInternal(buffer, offset+attribute.dataSize()*_vertexCount, attributes...); } - template inline void addVertexBufferInternal(Buffer* buffer, GLintptr offset, GLintptr gap, const T&... attributes) { + template inline void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLintptr gap, const T&... attributes) { /* Add the gap to offset for next attribute */ addVertexBufferInternal(buffer, offset+gap, attributes...); } - inline void addVertexBufferInternal(Buffer*, GLintptr) {} + inline void addVertexBufferInternal(Buffer&, GLintptr) {} /* Computing stride of interleaved vertex attributes */ template inline static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { @@ -645,22 +646,22 @@ class MAGNUM_EXPORT Mesh { inline static GLsizei strideOfInterleaved() { return 0; } /* Adding interleaved vertex attributes */ - template inline void addInterleavedVertexBufferInternal(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { + template inline void addInterleavedVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute, const U&... attributes) { addVertexAttribute(buffer, attribute, offset, stride); /* Add size of this attribute to offset for next attribute */ addInterleavedVertexBufferInternal(buffer, offset+attribute.dataSize(), stride, attributes...); } - template inline void addInterleavedVertexBufferInternal(Buffer* buffer, GLintptr offset, GLsizei stride, GLintptr gap, const T&... attributes) { + template inline void addInterleavedVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, GLintptr gap, const T&... attributes) { /* Add the gap to offset for next attribute */ addInterleavedVertexBufferInternal(buffer, offset+gap, stride, attributes...); } - inline void addInterleavedVertexBufferInternal(Buffer*, GLsizei, GLintptr) {} + inline void addInterleavedVertexBufferInternal(Buffer&, GLsizei, GLintptr) {} - template inline void addVertexAttribute(typename std::enable_if::Type, Float>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { + template inline void addVertexAttribute(typename std::enable_if::Type, Float>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { for(UnsignedInt i = 0; i != Implementation::Attribute::vectorCount(); ++i) (this->*attributePointerImplementation)(Attribute{ - buffer, + &buffer, location+i, static_cast(attribute.components()), static_cast(attribute.dataType()), @@ -671,9 +672,9 @@ class MAGNUM_EXPORT Mesh { } #ifndef MAGNUM_TARGET_GLES2 - template inline void addVertexAttribute(typename std::enable_if::Type>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { + template inline void addVertexAttribute(typename std::enable_if::Type>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { (this->*attributeIPointerImplementation)(IntegerAttribute{ - buffer, + &buffer, location, static_cast(attribute.components()), static_cast(attribute.dataType()), @@ -683,10 +684,10 @@ class MAGNUM_EXPORT Mesh { } #ifndef MAGNUM_TARGET_GLES - template inline void addVertexAttribute(typename std::enable_if::Type, Double>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { + template inline void addVertexAttribute(typename std::enable_if::Type, Double>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute& attribute, GLintptr offset, GLsizei stride) { for(UnsignedInt i = 0; i != Implementation::Attribute::vectorCount(); ++i) (this->*attributeLPointerImplementation)(LongAttribute{ - buffer, + &buffer, location+i, static_cast(attribute.components()), static_cast(attribute.dataType()), @@ -743,9 +744,9 @@ class MAGNUM_EXPORT Mesh { #endif #endif - typedef void(Mesh::*BindIndexBufferImplementation)(Buffer*); - void MAGNUM_LOCAL bindIndexBufferImplementationDefault(Buffer* buffer); - void MAGNUM_LOCAL bindIndexBufferImplementationVAO(Buffer* buffer); + typedef void(Mesh::*BindIndexBufferImplementation)(Buffer&); + void MAGNUM_LOCAL bindIndexBufferImplementationDefault(Buffer& buffer); + void MAGNUM_LOCAL bindIndexBufferImplementationVAO(Buffer& buffer); static MAGNUM_LOCAL BindIndexBufferImplementation bindIndexBufferImplementation; typedef void(Mesh::*BindImplementation)(); @@ -783,7 +784,7 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, Mesh::Primitive value); /** @debugoperator{Magnum::Mesh} */ Debug MAGNUM_EXPORT operator<<(Debug debug, Mesh::IndexType value); -template inline Mesh& Mesh::addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { +template inline Mesh& Mesh::addVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes) { CORRADE_ASSERT(sizeof...(attributes) == 1 || _vertexCount != 0, "Mesh::addVertexBuffer(): vertex count must be set before binding attributes", *this); diff --git a/src/Renderbuffer.cpp b/src/Renderbuffer.cpp index 36237aa0b..82562a66d 100644 --- a/src/Renderbuffer.cpp +++ b/src/Renderbuffer.cpp @@ -42,14 +42,14 @@ Renderbuffer::StorageMultisampleImplementation Renderbuffer::storageMultisampleI Renderbuffer::~Renderbuffer() { /* If bound, remove itself from state */ - GLuint& binding = Context::current()->state()->framebuffer->renderbufferBinding; + GLuint& binding = Context::current()->state().framebuffer->renderbufferBinding; if(binding == _id) binding = 0; glDeleteRenderbuffers(1, &_id); } void Renderbuffer::bind() { - GLuint& binding = Context::current()->state()->framebuffer->renderbufferBinding; + GLuint& binding = Context::current()->state().framebuffer->renderbufferBinding; if(binding == _id) return; @@ -57,20 +57,20 @@ void Renderbuffer::bind() { glBindRenderbuffer(GL_RENDERBUFFER, _id); } -void Renderbuffer::initializeContextBasedFunctionality(Context* context) { +void Renderbuffer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Renderbuffer: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; storageImplementation = &Renderbuffer::storageImplementationDSA; storageMultisampleImplementation = &Renderbuffer::storageMultisampleImplementationDSA; } #elif !defined(MAGNUM_TARGET_GLES3) - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Renderbuffer: using" << Extensions::GL::ANGLE::framebuffer_multisample::string() << "features"; storageMultisampleImplementation = &Renderbuffer::storageMultisampleImplementationANGLE; - } else if (context->isExtensionSupported()) { + } else if (context.isExtensionSupported()) { Debug() << "Renderbuffer: using" << Extensions::GL::NV::framebuffer_multisample::string() << "features"; storageMultisampleImplementation = &Renderbuffer::storageMultisampleImplementationNV; diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index b4b425386..6e30d85d5 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -114,7 +114,7 @@ class MAGNUM_EXPORT Renderbuffer { } private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); typedef void(Renderbuffer::*StorageImplementation)(RenderbufferFormat, const Vector2i&); void MAGNUM_LOCAL storageImplementationDefault(RenderbufferFormat internalFormat, const Vector2i& size); diff --git a/src/Renderer.cpp b/src/Renderer.cpp index d823af8d8..77db22f6c 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -164,7 +164,7 @@ void Renderer::setLogicOperation(const LogicOperation operation) { #ifndef MAGNUM_TARGET_GLES3 Renderer::ResetNotificationStrategy Renderer::resetNotificationStrategy() { - ResetNotificationStrategy& strategy = Context::current()->state()->renderer->resetNotificationStrategy; + ResetNotificationStrategy& strategy = Context::current()->state().renderer->resetNotificationStrategy; if(strategy == ResetNotificationStrategy()) { #ifndef MAGNUM_TARGET_GLES @@ -178,9 +178,9 @@ Renderer::ResetNotificationStrategy Renderer::resetNotificationStrategy() { } #endif -void Renderer::initializeContextBasedFunctionality(Context* context) { +void Renderer::initializeContextBasedFunctionality(Context& context) { #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) { + if(context.isExtensionSupported()) { Debug() << "Renderer: using" << Extensions::GL::ARB::ES2_compatibility::string() << "features"; clearDepthfImplementation = &Renderer::clearDepthfImplementationES; @@ -189,9 +189,9 @@ void Renderer::initializeContextBasedFunctionality(Context* context) { #ifndef MAGNUM_TARGET_GLES3 #ifndef MAGNUM_TARGET_GLES - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) #else - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) #endif { #ifndef MAGNUM_TARGET_GLES diff --git a/src/Renderer.h b/src/Renderer.h index e6cbc7609..cbef32112 100644 --- a/src/Renderer.h +++ b/src/Renderer.h @@ -1026,7 +1026,7 @@ class MAGNUM_EXPORT Renderer { /*@}*/ private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); + static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); typedef void(*ClearDepthfImplementation)(GLfloat); #ifndef MAGNUM_TARGET_GLES diff --git a/src/Resource.h b/src/Resource.h index 888f2b6dd..be5619d45 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -178,15 +178,15 @@ class Resource { } /** - * @brief %Resource data + * @brief Reference to resource data * * The resource must be loaded before accessing it. Use boolean * conversion operator or state() for testing whether it is loaded. */ - operator U*() { + operator U&() { acquire(); - CORRADE_ASSERT(data, "Resource: accessing not loaded data with key" << key(), nullptr); - return static_cast(data); + CORRADE_ASSERT(data, "Resource: accessing not loaded data with key" << key(), *static_cast(data)); + return *static_cast(data); } /** @overload */ diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 7bb276b23..a1d4df745 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -225,8 +225,12 @@ cube->draw(); template implementation file. */ template class ResourceManager: private Implementation::ResourceManagerData... { public: - /** @brief Global instance */ - static ResourceManager* instance(); + /** + * @brief Global instance + * + * Assumes that the instance exists. + */ + static ResourceManager& instance(); /** * @brief Constructor @@ -391,6 +395,7 @@ template class ResourceManager: private Implementation::Resource /** * @brief Set loader for given type of resources + * @param loader Loader or `nullptr` if unsetting previous loader. * @return Reference to self (for method chaining) * * See AbstractResourceLoader documentation for more information. @@ -580,9 +585,9 @@ template inline ResourceManagerData::Data::~Data() { } -template ResourceManager* ResourceManager::instance() { - CORRADE_ASSERT(internalInstance(), "ResourceManager::instance(): no instance exists", nullptr); - return internalInstance(); +template ResourceManager& ResourceManager::instance() { + CORRADE_ASSERT(internalInstance(), "ResourceManager::instance(): no instance exists", *internalInstance()); + return *internalInstance(); } template ResourceManager::ResourceManager() { diff --git a/src/Sampler.cpp b/src/Sampler.cpp index 648822415..2d65ffe11 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -47,7 +47,7 @@ static_assert((filter_or(Nearest, Base) == GL_NEAREST) && #ifndef MAGNUM_TARGET_GLES3 Float Sampler::maxSupportedAnisotropy() { - GLfloat& value = Context::current()->state()->texture->maxSupportedAnisotropy; + GLfloat& value = Context::current()->state().texture->maxSupportedAnisotropy; /** @todo Re-enable when extension header is available */ #ifndef MAGNUM_TARGET_GLES diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index 1e977c70e..c6d38cf02 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -262,7 +262,7 @@ void ResourceManagerTest::clearWhileReferenced() { void ResourceManagerTest::loader() { class IntResourceLoader: public AbstractResourceLoader { public: - IntResourceLoader(): resource(ResourceManager::instance()->get("data")) {} + IntResourceLoader(): resource(ResourceManager::instance().get("data")) {} void load() { set("hello", new Int(773), ResourceDataState::Final, ResourcePolicy::Resident); From 2ea5b4c9ceb7c1cde135bb0824560580f8c671d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:37:36 +0200 Subject: [PATCH 79/90] Reducing pointer chasings, part 3b: less pointer passing in MeshTools. MeshTools::interleave() might cause porting problems, as the error is now much more verbose if you accidentally pass Mesh* instead of Mesh&. --- src/MeshTools/CompressIndices.cpp | 6 +++--- src/MeshTools/CompressIndices.h | 2 +- src/MeshTools/Interleave.h | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/MeshTools/CompressIndices.cpp b/src/MeshTools/CompressIndices.cpp index df2e871ed..3735abd2e 100644 --- a/src/MeshTools/CompressIndices.cpp +++ b/src/MeshTools/CompressIndices.cpp @@ -69,7 +69,7 @@ std::tuple compressIndices(const std::vecto return compressIndicesInternal(indices, *std::max_element(indices.begin(), indices.end())); } -void compressIndices(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const std::vector& indices) { +void compressIndices(Mesh& mesh, Buffer& buffer, Buffer::Usage usage, const std::vector& indices) { auto minmax = std::minmax_element(indices.begin(), indices.end()); /** @todo Performance hint when range can be represented by smaller value? */ @@ -79,9 +79,9 @@ void compressIndices(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const std: char* data; std::tie(indexCount, indexType, data) = compressIndicesInternal(indices, *minmax.second); - mesh->setIndexCount(indices.size()) + mesh.setIndexCount(indices.size()) .setIndexBuffer(buffer, 0, indexType, *minmax.first, *minmax.second); - buffer->setData(indexCount*Mesh::indexSize(indexType), data, usage); + buffer.setData(indexCount*Mesh::indexSize(indexType), data, usage); delete[] data; } diff --git a/src/MeshTools/CompressIndices.h b/src/MeshTools/CompressIndices.h index 80cd544ef..4acf0ff3b 100644 --- a/src/MeshTools/CompressIndices.h +++ b/src/MeshTools/CompressIndices.h @@ -77,7 +77,7 @@ Mesh::setIndexCount() and Mesh::setIndexBuffer() on your own. @see MeshTools::interleave() */ -void MAGNUM_MESHTOOLS_EXPORT compressIndices(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const std::vector& indices); +void MAGNUM_MESHTOOLS_EXPORT compressIndices(Mesh& mesh, Buffer& buffer, Buffer::Usage usage, const std::vector& indices); }} diff --git a/src/MeshTools/Interleave.h b/src/MeshTools/Interleave.h index 8396219ae..82e424d03 100644 --- a/src/MeshTools/Interleave.h +++ b/src/MeshTools/Interleave.h @@ -60,19 +60,19 @@ class Interleave { return std::make_tuple(_attributeCount, _stride, _data); } - template void operator()(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const T&... attributes) { + template void operator()(Mesh& mesh, Buffer& buffer, Buffer::Usage usage, const T&... attributes) { operator()(attributes...); - mesh->setVertexCount(_attributeCount); - buffer->setData(_attributeCount*_stride, _data, usage); + mesh.setVertexCount(_attributeCount); + buffer.setData(_attributeCount*_stride, _data, usage); delete[] _data; } /* Specialization for only one attribute array */ - template typename std::enable_if::value, void>::type operator()(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const T& attribute) { - mesh->setVertexCount(attribute.size()); - buffer->setData(attribute, usage); + template typename std::enable_if::value, void>::type operator()(Mesh& mesh, Buffer& buffer, Buffer::Usage usage, const T& attribute) { + mesh.setVertexCount(attribute.size()); + buffer.setData(attribute, usage); } template static typename std::enable_if::value, std::size_t>::type attributeCount(const T& first, const U&... next) { @@ -180,7 +180,7 @@ See also interleave(Mesh*, Buffer*, Buffer::Usage, const T&...), which writes the interleaved array directly into buffer of given mesh. */ /* enable_if to avoid clash with overloaded function below */ -template inline typename std::enable_if::value, std::tuple>::type interleave(const T& first, const U&... next) { +template inline typename std::enable_if::value, std::tuple>::type interleave(const T& first, const U&... next) { return Implementation::Interleave()(first, next...); } @@ -207,7 +207,7 @@ mesh->setVertexCount(attribute.size()); @see MeshTools::compressIndices() */ -template inline void interleave(Mesh* mesh, Buffer* buffer, Buffer::Usage usage, const T&... attributes) { +template inline void interleave(Mesh& mesh, Buffer& buffer, Buffer::Usage usage, const T&... attributes) { return Implementation::Interleave()(mesh, buffer, usage, attributes...); } From 0d3bfd404463bf0946c8c46616f788aa169d48e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:40:55 +0200 Subject: [PATCH 80/90] Reducing pointer chasings, part 3c: less pointer passing in SceneGraph. Main change is that features take reference to containing object instead of pointer, as the feature must always belong to some object. Feature groups now return references to features and features return reference to containing object, as these cannot be null. Passing `*this` to AbstractFeature (and Camera[23]D) constructor might now clash with deleted copy constructor, added templated constructor to catch and resolve these ambiguous cases. --- doc/scenegraph.dox | 18 +++---- src/SceneGraph/AbstractCamera.h | 4 +- src/SceneGraph/AbstractCamera.hpp | 10 ++-- src/SceneGraph/AbstractFeature.h | 25 ++++++---- src/SceneGraph/AbstractFeature.hpp | 4 +- src/SceneGraph/AbstractGroupedFeature.h | 6 +-- src/SceneGraph/Animable.h | 4 +- src/SceneGraph/Animable.hpp | 64 ++++++++++++------------- src/SceneGraph/Camera2D.h | 9 +++- src/SceneGraph/Camera2D.hpp | 2 +- src/SceneGraph/Camera3D.h | 9 +++- src/SceneGraph/Camera3D.hpp | 2 +- src/SceneGraph/Drawable.h | 8 ++-- src/SceneGraph/FeatureGroup.h | 30 ++++++------ src/SceneGraph/FeatureGroup.hpp | 8 ++-- src/SceneGraph/Test/AnimableTest.cpp | 26 +++++----- src/SceneGraph/Test/CameraTest.cpp | 24 +++++----- src/SceneGraph/Test/ObjectTest.cpp | 14 +++--- 18 files changed, 144 insertions(+), 123 deletions(-) diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index 9cd506d36..83cc9fe9e 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -82,8 +82,8 @@ Parent object can be either passed in constructor or using Object::setParent(). @code Scene3D scene; -Object3D* first = new Object3D(&scene); -Object3D* second = new Object3D(first); +auto first = new Object3D(&scene); +auto second = new Object3D(first); @endcode %Object children can be accessed using Object::firstChild() and @@ -107,7 +107,7 @@ The object is derived from the transformation you specified earlier in the transformation implementation. %Scene, as a root object, cannot have any transformation. For convenience you can use method chaining: @code -Object3D* next = new Object3D; +auto next = new Object3D; next->setParent(another) .translate(Vector3::yAxis(3.0f)) .rotateY(35.0_degf); @@ -123,7 +123,7 @@ Each feature takes pointer to holder object in constructor, so adding a feature to an object might look like this: @code Object3D* o; -MyFeature* feature = new MyFeature(o); +auto feature = new MyFeature(o); @endcode Features of an object can be accessed using Object::firstFeature() and @@ -149,7 +149,7 @@ Simplified example: @code class Bomb: public Object3D, SceneGraph::Drawable3D, SceneGraph:.Animable3D { public: - Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D(this), SceneGraph::Animable3D(this) {} + Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D(*this), SceneGraph::Animable3D(*this) {} protected: // drawing implementation for Drawable feature @@ -195,8 +195,8 @@ cleaning function(s): @code class CachingObject: public Object3D, SceneGraph::AbstractFeature3D { public: - CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D(this) { - setCachedTransformations(CachedTransformation::Absolute); + CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D(*this) { + setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } protected: @@ -258,7 +258,7 @@ inherited after the %Object class: @code class MyObject: public Object3D, MyFeature { public: - MyObject(Object3D* parent): Object3D(parent), MyFeature(this) {} + MyObject(Object3D* parent): Object3D(parent), MyFeature(*this) {} }; @endcode When constructing MyObject, Object3D constructor is called first and then @@ -271,7 +271,7 @@ However, if we would inherit MyFeature first, it will cause problems: @code class MyObject: MyFeature, public Object3D { public: - MyObject(Object3D* parent): MyFeature(this), Object3D(parent) {} // crash! + MyObject(Object3D* parent): MyFeature(*this), Object3D(parent) {} // crash! }; @endcode MyFeature tries to add itself to feature list in not-yet-constructed Object3D, diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 1d5d80bd0..f1a03ada6 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -92,7 +92,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * applied as first. */ typename DimensionTraits::MatrixType cameraMatrix() { - AbstractFeature::object()->setClean(); + AbstractFeature::object().setClean(); return _cameraMatrix; } @@ -139,7 +139,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Constructor * @param object Object holding the camera */ - explicit AbstractCamera(AbstractObject* object); + explicit AbstractCamera(AbstractObject& object); ~AbstractCamera(); diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index ba4c48a15..cc1ef8e2e 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -68,7 +68,7 @@ template typename DimensionTraits AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { +template AbstractCamera::AbstractCamera(AbstractObject& object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } @@ -86,22 +86,22 @@ template void AbstractCamera::se } template void AbstractCamera::draw(DrawableGroup& group) { - AbstractObject* scene = AbstractFeature::object()->scene(); + AbstractObject* scene = AbstractFeature::object().scene(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); /* Compute camera matrix */ - AbstractFeature::object()->setClean(); + AbstractFeature::object().setClean(); /* Compute transformations of all objects in the group relative to the camera */ std::vector*> objects(group.size()); for(std::size_t i = 0; i != group.size(); ++i) - objects[i] = group[i]->object(); + objects[i] = &group[i].object(); std::vector::MatrixType> transformations = scene->transformationMatrices(objects, _cameraMatrix); /* Perform the drawing */ for(std::size_t i = 0; i != transformations.size(); ++i) - group[i]->draw(transformations[i], this); + group[i].draw(transformations[i], *this); } }} diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index de9c71892..decaf76b7 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -100,7 +100,7 @@ cleanInverted() or both. Example: @code class CachingFeature: public SceneGraph::AbstractFeature3D { public: - CachingFeature(SceneGraph::AbstractObject3D* object): SceneGraph::AbstractFeature3D(object) { + CachingFeature(SceneGraph::AbstractObject3D& object): SceneGraph::AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } @@ -133,11 +133,11 @@ parameter: @code class TransformingFeature: public SceneGraph::AbstractFeature3D { public: - template TransformingFeature(SceneGraph::Object* object): + template TransformingFeature(SceneGraph::Object& object): SceneGraph::AbstractFeature3D(object), transformation(object) {} private: - SceneGraph::AbstractTranslationRotation3D* transformation; + SceneGraph::AbstractTranslationRotation3D& transformation; }; @endcode If we take for example @ref Object "Object", it is @@ -145,7 +145,7 @@ derived from @ref AbstractObject "AbstractObject3D" and @ref BasicMatrixTransformation3D "MatrixTransformation3D", which is derived from @ref AbstractBasicTranslationRotationScaling3D "AbstractTranslationRotationScaling3D", which is derived from @ref AbstractBasicTranslationRotation3D "AbstractTranslationRotation3D", -which is automatically extracted from the pointer in our constructor. +which is automatically extracted from the reference in our constructor. @section AbstractFeature-explicit-specializations Explicit template specializations @@ -174,18 +174,25 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * @brief Constructor * @param object %Object holding this feature */ - explicit AbstractFeature(AbstractObject* object); + explicit AbstractFeature(AbstractObject& object); + + #ifndef DOXYGEN_GENERATING_OUTPUT + /* This is here to avoid ambiguity with deleted copy constructor when + passing `*this` from class subclassing both AbstractFeature and + AbstractObject */ + template, U>::value>::type> AbstractFeature(U& object): AbstractFeature(static_cast&>(object)) {} + #endif virtual ~AbstractFeature() = 0; /** @brief %Object holding this feature */ - AbstractObject* object() { - return Containers::LinkedListItem, AbstractObject>::list(); + AbstractObject& object() { + return *Containers::LinkedListItem, AbstractObject>::list(); } /** @overload */ - const AbstractObject* object() const { - return Containers::LinkedListItem, AbstractObject>::list(); + const AbstractObject& object() const { + return *Containers::LinkedListItem, AbstractObject>::list(); } /** @brief Previous feature or `nullptr`, if this is first feature */ diff --git a/src/SceneGraph/AbstractFeature.hpp b/src/SceneGraph/AbstractFeature.hpp index f0da6915e..0684c4670 100644 --- a/src/SceneGraph/AbstractFeature.hpp +++ b/src/SceneGraph/AbstractFeature.hpp @@ -32,8 +32,8 @@ namespace Magnum { namespace SceneGraph { -template AbstractFeature::AbstractFeature(AbstractObject* object) { - object->Containers::template LinkedList>::insert(this); +template AbstractFeature::AbstractFeature(AbstractObject& object) { + object.Containers::template LinkedList>::insert(this); } template AbstractFeature::~AbstractFeature() = default; diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index dd589c8b2..2a280a5e9 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -78,8 +78,8 @@ template class AbstractGroupedFe * Adds the feature to the object and to group, if specified. * @see FeatureGroup::add() */ - explicit AbstractGroupedFeature(AbstractObject* object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { - if(group) group->add(static_cast(this)); + explicit AbstractGroupedFeature(AbstractObject& object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { + if(group) group->add(static_cast(*this)); } /** @@ -89,7 +89,7 @@ template class AbstractGroupedFe * any. */ ~AbstractGroupedFeature() { - if(_group) _group->remove(static_cast(this)); + if(_group) _group->remove(static_cast(*this)); } /** @brief Group this feature belongs to */ diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 3221d64de..c8d81cef8 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -78,7 +78,7 @@ typedef SceneGraph::Scene Scene3D; class AnimableObject: public Object3D, SceneGraph::Animable3D { public: - AnimableObject(Object* parent = nullptr, SceneGraph::DrawableGroup3D* group = nullptr): Object3D(parent), SceneGraph::Animable3D(this, group) { + AnimableObject(Object* parent = nullptr, SceneGraph::DrawableGroup3D* group = nullptr): Object3D(parent), SceneGraph::Animable3D(*this, group) { setDuration(10.0f); // ... } @@ -153,7 +153,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Animabl * adds the feature to the object and also to group, if specified. * @see setDuration(), setState(), setRepeated(), AnimableGroup::add() */ - explicit Animable(AbstractObject* object, AnimableGroup* group = nullptr); + explicit Animable(AbstractObject& object, AnimableGroup* group = nullptr); ~Animable(); diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index b9a35e596..5ba80c88f 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { -template Animable::Animable(AbstractObject* object, AnimableGroup* group): AbstractGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} +template Animable::Animable(AbstractObject& object, AnimableGroup* group): AbstractGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} template Animable::~Animable() {} @@ -65,74 +65,74 @@ template void AnimableGroup::ste wakeUp = false; for(std::size_t i = 0; i != AnimableGroup::size(); ++i) { - Animable* animable = (*this)[i]; + Animable& animable = (*this)[i]; /* The animation was stopped recently, just decrease count of running animations if the animation was running before */ - if(animable->previousState != AnimationState::Stopped && animable->currentState == AnimationState::Stopped) { - if(animable->previousState == AnimationState::Running) + if(animable.previousState != AnimationState::Stopped && animable.currentState == AnimationState::Stopped) { + if(animable.previousState == AnimationState::Running) --_runningCount; - animable->previousState = AnimationState::Stopped; - animable->animationStopped(); + animable.previousState = AnimationState::Stopped; + animable.animationStopped(); continue; /* The animation was paused recently, set pause time to previous frame time */ - } else if(animable->previousState == AnimationState::Running && animable->currentState == AnimationState::Paused) { - animable->previousState = AnimationState::Paused; - animable->pauseTime = time; + } else if(animable.previousState == AnimationState::Running && animable.currentState == AnimationState::Paused) { + animable.previousState = AnimationState::Paused; + animable.pauseTime = time; --_runningCount; - animable->animationPaused(); + animable.animationPaused(); continue; /* Skip the rest for not running animations */ - } else if(animable->currentState != AnimationState::Running) { - CORRADE_INTERNAL_ASSERT(animable->previousState == animable->currentState); + } else if(animable.currentState != AnimationState::Running) { + CORRADE_INTERNAL_ASSERT(animable.previousState == animable.currentState); continue; /* The animation was started recently, set start time to previous frame time, reset repeat count */ - } else if(animable->previousState == AnimationState::Stopped) { - animable->previousState = AnimationState::Running; - animable->startTime = time; - animable->repeats = 0; + } else if(animable.previousState == AnimationState::Stopped) { + animable.previousState = AnimationState::Running; + animable.startTime = time; + animable.repeats = 0; ++_runningCount; - animable->animationStarted(); + animable.animationStarted(); /* The animation was resumed recently, add pause duration to start time */ - } else if(animable->previousState == AnimationState::Paused) { - animable->previousState = AnimationState::Running; - animable->startTime += time - animable->pauseTime; + } else if(animable.previousState == AnimationState::Paused) { + animable.previousState = AnimationState::Running; + animable.startTime += time - animable.pauseTime; ++_runningCount; - animable->animationResumed(); + animable.animationResumed(); } - CORRADE_INTERNAL_ASSERT(animable->previousState == AnimationState::Running); + CORRADE_INTERNAL_ASSERT(animable.previousState == AnimationState::Running); /* Animation time exceeded duration */ - if(animable->_duration != 0.0f && time-animable->startTime > animable->_duration) { + if(animable._duration != 0.0f && time-animable.startTime > animable._duration) { /* Not repeated or repeat count exceeded, stop */ - if(!animable->_repeated || animable->repeats+1 == animable->_repeatCount) { - animable->previousState = AnimationState::Stopped; - animable->currentState = AnimationState::Stopped; + if(!animable._repeated || animable.repeats+1 == animable._repeatCount) { + animable.previousState = AnimationState::Stopped; + animable.currentState = AnimationState::Stopped; --_runningCount; - animable->animationStopped(); + animable.animationStopped(); continue; } /* Increase repeat count and add duration to startTime */ - ++animable->repeats; - animable->startTime += animable->_duration; + ++animable.repeats; + animable.startTime += animable._duration; } /* Animation is still running, perform animation step */ - CORRADE_ASSERT(time-animable->startTime >= 0.0f, + CORRADE_ASSERT(time-animable.startTime >= 0.0f, "SceneGraph::AnimableGroup::step(): animation was started in future - probably wrong time passed", ); CORRADE_ASSERT(delta >= 0.0f, "SceneGraph::AnimableGroup::step(): negative delta passed", ); - animable->animationStep(time - animable->startTime, delta); + animable.animationStep(time - animable.startTime, delta); } - CORRADE_INTERNAL_ASSERT(_runningCount <= AnimableGroup::size()); + CORRADE_INTERNAL_ASSERT((_runningCount <= AnimableGroup::size())); } }} diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 3016a405e..d1be4b0db 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -65,7 +65,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractC * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). * @see setProjection() */ - explicit BasicCamera2D(AbstractObject<2, T>* object); + explicit BasicCamera2D(AbstractObject<2, T>& object); + + #ifndef DOXYGEN_GENERATING_OUTPUT + /* This is here to avoid ambiguity with deleted copy constructor when + passing `*this` from class subclassing both BasicCamera2D and + AbstractObject */ + template, U>::value>::type> BasicCamera2D(U& object): BasicCamera2D(static_cast&>(object)) {} + #endif /** * @brief Set projection diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 447c0aee1..302d74e9b 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { -template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} +template BasicCamera2D::BasicCamera2D(AbstractObject<2, T>& object): AbstractCamera<2, T>(object) {} template BasicCamera2D& BasicCamera2D::setProjection(const Math::Vector2& size) { AbstractCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 234a2ad15..6d6c665f4 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -67,7 +67,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractC * @brief Constructor * @param object %Object holding this feature */ - explicit BasicCamera3D(AbstractObject<3, T>* object); + explicit BasicCamera3D(AbstractObject<3, T>& object); + + #ifndef DOXYGEN_GENERATING_OUTPUT + /* This is here to avoid ambiguity with deleted copy constructor when + passing `*this` from class subclassing both BasicCamera3D and + AbstractObject */ + template, U>::value>::type> BasicCamera3D(U& object): BasicCamera3D(static_cast&>(object)) {} + #endif /** * @brief Set orthographic projection diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index c1e5bda74..bef3b77e9 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -35,7 +35,7 @@ namespace Magnum { namespace SceneGraph { -template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(T(0)), _far(T(0)) {} +template BasicCamera3D::BasicCamera3D(AbstractObject<3, T>& object): AbstractCamera<3, T>(object), _near(T(0)), _far(T(0)) {} template BasicCamera3D& BasicCamera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index a224f4296..b8e388a2f 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -49,11 +49,11 @@ typedef SceneGraph::Scene Scene3D; class DrawableObject: public Object3D, SceneGraph::Drawable3D { public: - DrawableObject(Object* parent = nullptr, SceneGraph::DrawableGroup3D* group = nullptr): Object3D(parent), SceneGraph::Drawable3D(this, group) { + DrawableObject(Object* parent = nullptr, SceneGraph::DrawableGroup3D* group = nullptr): Object3D(parent), SceneGraph::Drawable3D(*this, group) { // ... } - void draw(const Matrix4& transformationMatrix, AbstractCamera3D* camera) override { + void draw(const Matrix4& transformationMatrix, AbstractCamera3D& camera) override { // ... } } @@ -127,7 +127,7 @@ template class Drawable: public AbstractGrouped * Adds the feature to the object and also to the group, if specified. * Otherwise you can use DrawableGroup::add(). */ - explicit Drawable(AbstractObject* object, DrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} + explicit Drawable(AbstractObject& object, DrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} /** * @brief Draw the object using given camera @@ -137,7 +137,7 @@ template class Drawable: public AbstractGrouped * * Projection matrix can be retrieved from AbstractCamera::projectionMatrix(). */ - virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractCamera* camera) = 0; + virtual void draw(const typename DimensionTraits::MatrixType& transformationMatrix, AbstractCamera& camera) = 0; }; #ifndef CORRADE_GCC46_COMPATIBILITY diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index e632e8ec5..742c4b2c2 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -47,8 +47,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac explicit AbstractFeatureGroup(); virtual ~AbstractFeatureGroup(); - void add(AbstractFeature* feature); - void remove(AbstractFeature* feature); + void add(AbstractFeature& feature); + void remove(AbstractFeature& feature); std::vector*> features; }; @@ -84,13 +84,13 @@ template class FeatureGroup: pub } /** @brief Feature at given index */ - Feature* operator[](std::size_t index) { - return static_cast(AbstractFeatureGroup::features[index]); + Feature& operator[](std::size_t index) { + return *static_cast(AbstractFeatureGroup::features[index]); } /** @overload */ - const Feature* operator[](std::size_t index) const { - return static_cast(AbstractFeatureGroup::features[index]); + const Feature& operator[](std::size_t index) const { + return *static_cast(AbstractFeatureGroup::features[index]); } /** @@ -100,7 +100,7 @@ template class FeatureGroup: pub * If the features is part of another group, it is removed from it. * @see remove(), AbstractGroupedFeature::AbstractGroupedFeature() */ - FeatureGroup& add(Feature* feature); + FeatureGroup& add(Feature& feature); /** * @brief Remove feature from the group @@ -109,7 +109,7 @@ template class FeatureGroup: pub * The feature must be part of the group. * @see add() */ - FeatureGroup& remove(Feature* feature); + FeatureGroup& remove(Feature& feature); }; #ifndef CORRADE_GCC46_COMPATIBILITY @@ -162,23 +162,23 @@ template FeatureGroup::features) static_cast(i)->_group = nullptr; } -template FeatureGroup& FeatureGroup::add(Feature* feature) { +template FeatureGroup& FeatureGroup::add(Feature& feature) { /* Remove from previous group */ - if(feature->_group) - feature->_group->remove(feature); + if(feature._group) + feature._group->remove(feature); /* Crossreference the feature and group together */ AbstractFeatureGroup::add(feature); - feature->_group = this; + feature._group = this; return *this; } -template FeatureGroup& FeatureGroup::remove(Feature* feature) { - CORRADE_ASSERT(feature->_group == this, +template FeatureGroup& FeatureGroup::remove(Feature& feature) { + CORRADE_ASSERT(feature._group == this, "SceneGraph::AbstractFeatureGroup::remove(): feature is not part of this group", *this); AbstractFeatureGroup::remove(feature); - feature->_group = nullptr; + feature._group = nullptr; return *this; } diff --git a/src/SceneGraph/FeatureGroup.hpp b/src/SceneGraph/FeatureGroup.hpp index 0f2cd1f1f..4caf9855e 100644 --- a/src/SceneGraph/FeatureGroup.hpp +++ b/src/SceneGraph/FeatureGroup.hpp @@ -37,12 +37,12 @@ namespace Magnum { namespace SceneGraph { template AbstractFeatureGroup::AbstractFeatureGroup() = default; template AbstractFeatureGroup::~AbstractFeatureGroup() = default; -template void AbstractFeatureGroup::add(AbstractFeature* feature) { - features.push_back(feature); +template void AbstractFeatureGroup::add(AbstractFeature& feature) { + features.push_back(&feature); } -template void AbstractFeatureGroup::remove(AbstractFeature* feature) { - features.erase(std::find(features.begin(), features.end(), feature)); +template void AbstractFeatureGroup::remove(AbstractFeature& feature) { + features.erase(std::find(features.begin(), features.end(), &feature)); } }} diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/SceneGraph/Test/AnimableTest.cpp index 3eba97476..eb9c9eb7d 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/SceneGraph/Test/AnimableTest.cpp @@ -61,7 +61,7 @@ AnimableTest::AnimableTest() { void AnimableTest::state() { class StateTrackingAnimable: public SceneGraph::Animable3D { public: - StateTrackingAnimable(AbstractObject3D* object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group) { + StateTrackingAnimable(AbstractObject3D& object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group) { setDuration(1.0f); } @@ -81,7 +81,7 @@ void AnimableTest::state() { CORRADE_COMPARE(group.runningCount(), 0); /* Verify initial state */ - StateTrackingAnimable animable(&object, &group); + StateTrackingAnimable animable(object, &group); CORRADE_COMPARE(animable.state(), AnimationState::Stopped); CORRADE_VERIFY(animable.trackedState.empty()); group.step(1.0f, 1.0f); @@ -143,18 +143,18 @@ void AnimableTest::state() { CORRADE_COMPARE(group.runningCount(), 0); /* Verify running count can go past 0/1 */ - auto a = new StateTrackingAnimable(&object, &group); - auto b = new StateTrackingAnimable(&object, &group); + auto a = new StateTrackingAnimable(object, &group); + auto b = new StateTrackingAnimable(object, &group); a->setState(AnimationState::Running); b->setState(AnimationState::Running); - group.add(a).add(b); + group.add(*a).add(*b); group.step(1.0f, 1.0f); CORRADE_COMPARE(group.runningCount(), 2); } class OneShotAnimable: public SceneGraph::Animable3D { public: - OneShotAnimable(AbstractObject3D* object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f) { + OneShotAnimable(AbstractObject3D& object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f) { setDuration(10.0f); setState(AnimationState::Running); } @@ -179,7 +179,7 @@ class OneShotAnimable: public SceneGraph::Animable3D { void AnimableTest::step() { class InifiniteAnimable: public SceneGraph::Animable3D { public: - InifiniteAnimable(AbstractObject3D* object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f), delta(0.0f) {} + InifiniteAnimable(AbstractObject3D& object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f), delta(0.0f) {} Float time, delta; @@ -192,7 +192,7 @@ void AnimableTest::step() { Object3D object; AnimableGroup3D group; - InifiniteAnimable animable(&object, &group); + InifiniteAnimable animable(object, &group); /* Calling step() if no object is running should do nothing */ group.step(5.0f, 0.5f); @@ -217,7 +217,7 @@ void AnimableTest::step() { void AnimableTest::duration() { Object3D object; AnimableGroup3D group; - OneShotAnimable animable(&object, &group); + OneShotAnimable animable(object, &group); CORRADE_VERIFY(!animable.isRepeated()); /* First animation step is in duration, verify that animation is still @@ -238,7 +238,7 @@ void AnimableTest::duration() { void AnimableTest::repeat() { class RepeatingAnimable: public SceneGraph::Animable3D { public: - RepeatingAnimable(AbstractObject3D* object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f) { + RepeatingAnimable(AbstractObject3D& object, AnimableGroup3D* group = nullptr): SceneGraph::Animable3D(object, group), time(-1.0f) { setDuration(10.0f); setState(AnimationState::Running); setRepeated(true); @@ -254,7 +254,7 @@ void AnimableTest::repeat() { Object3D object; AnimableGroup3D group; - RepeatingAnimable animable(&object, &group); + RepeatingAnimable animable(object, &group); CORRADE_COMPARE(animable.repeatCount(), 0); /* First animation steps is in first loop iteration */ @@ -299,7 +299,7 @@ void AnimableTest::repeat() { void AnimableTest::stop() { Object3D object; AnimableGroup3D group; - OneShotAnimable animable(&object, &group); + OneShotAnimable animable(object, &group); CORRADE_COMPARE(animable.repeatCount(), 0); /* Eat up some absolute time */ @@ -324,7 +324,7 @@ void AnimableTest::stop() { void AnimableTest::pause() { Object3D object; AnimableGroup3D group; - OneShotAnimable animable(&object, &group); + OneShotAnimable animable(object, &group); /* First two steps, animation is running */ group.step(1.0f, 0.5f); diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/SceneGraph/Test/CameraTest.cpp index 54402cdc2..14ed3c555 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/SceneGraph/Test/CameraTest.cpp @@ -107,14 +107,14 @@ void CameraTest::fixAspectRatio() { void CameraTest::defaultProjection2D() { Object2D o; - Camera2D camera(&o); + Camera2D camera(o); CORRADE_COMPARE(camera.projectionMatrix(), Matrix3()); CORRADE_COMPARE(camera.projectionSize(), Vector2(2.0f)); } void CameraTest::defaultProjection3D() { Object3D o; - Camera3D camera(&o); + Camera3D camera(o); CORRADE_COMPARE(camera.projectionMatrix(), Matrix4()); CORRADE_COMPARE(camera.projectionSize(), Vector2(2.0f)); } @@ -122,7 +122,7 @@ void CameraTest::defaultProjection3D() { void CameraTest::projectionSize2D() { Vector2 projectionSize(4.0f, 3.0f); Object2D o; - Camera2D camera(&o); + Camera2D camera(o); camera.setProjection(projectionSize); CORRADE_COMPARE(camera.projectionSize(), projectionSize); } @@ -130,21 +130,21 @@ void CameraTest::projectionSize2D() { void CameraTest::projectionSizeOrthographic() { Vector2 projectionSizeRectangle(5.0f, 4.0f); Object3D o; - Camera3D camera(&o); + Camera3D camera(o); camera.setOrthographic(projectionSizeRectangle, 1, 9); CORRADE_COMPARE(camera.projectionSize(), projectionSizeRectangle); } void CameraTest::projectionSizePerspective() { Object3D o; - Camera3D camera(&o); + Camera3D camera(o); camera.setPerspective(Deg(27.0f), 2.35f, 32.0f, 100); CORRADE_COMPARE(camera.projectionSize(), Vector2(0.48015756f, 0.204322f)); } void CameraTest::projectionSizeViewport() { Object3D o; - Camera3D camera(&o); + Camera3D camera(o); camera.setViewport({200, 300}); CORRADE_COMPARE(camera.projectionSize(), Vector2(2.0f, 2.0f)); @@ -158,10 +158,10 @@ void CameraTest::projectionSizeViewport() { void CameraTest::draw() { class Drawable: public SceneGraph::Drawable3D { public: - Drawable(AbstractObject3D* object, DrawableGroup3D* group, Matrix4& result): SceneGraph::Drawable3D(object, group), result(result) {} + Drawable(AbstractObject3D& object, DrawableGroup3D* group, Matrix4& result): SceneGraph::Drawable3D(object, group), result(result) {} protected: - void draw(const Matrix4& transformationMatrix, AbstractCamera3D*) { + void draw(const Matrix4& transformationMatrix, AbstractCamera3D&) override { result = transformationMatrix; } @@ -175,19 +175,19 @@ void CameraTest::draw() { Object3D first(&scene); Matrix4 firstTransformation; first.scale(Vector3(5.0f)); - new Drawable(&first, &group, firstTransformation); + new Drawable(first, &group, firstTransformation); Object3D second(&scene); Matrix4 secondTransformation; second.translate(Vector3::yAxis(3.0f)); - new Drawable(&second, &group, secondTransformation); + new Drawable(second, &group, secondTransformation); Object3D third(&second); Matrix4 thirdTransformation; third.translate(Vector3::zAxis(-1.5f)); - new Drawable(&third, &group, thirdTransformation); + new Drawable(third, &group, thirdTransformation); - Camera3D camera(&third); + Camera3D camera(third); camera.draw(group); CORRADE_COMPARE(firstTransformation, Matrix4::translation({0.0f, -3.0f, 1.5f})*Matrix4::scaling(Vector3(5.0f))); diff --git a/src/SceneGraph/Test/ObjectTest.cpp b/src/SceneGraph/Test/ObjectTest.cpp index 272b915d7..0dbbefe7a 100644 --- a/src/SceneGraph/Test/ObjectTest.cpp +++ b/src/SceneGraph/Test/ObjectTest.cpp @@ -52,7 +52,7 @@ typedef SceneGraph::Scene Scene3D; class CachingObject: public Object3D, AbstractFeature3D { public: - CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature3D(this) { + CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature3D(*this) { setCachedTransformations(CachedTransformation::Absolute); } @@ -271,7 +271,7 @@ void ObjectTest::setClean() { class CachingFeature: public AbstractFeature3D { public: - CachingFeature(AbstractObject3D* object): AbstractFeature3D(object) { + CachingFeature(AbstractObject3D& object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } @@ -284,7 +284,7 @@ void ObjectTest::setClean() { class CachingInvertedFeature: public AbstractFeature3D { public: - CachingInvertedFeature(AbstractObject3D* object): AbstractFeature3D(object) { + CachingInvertedFeature(AbstractObject3D& object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::InvertedAbsolute); } @@ -300,8 +300,8 @@ void ObjectTest::setClean() { CachingObject* childTwo = new CachingObject(childOne); childTwo->translate(Vector3::xAxis(1.0f)); - CachingFeature* childTwoFeature = new CachingFeature(childTwo); - CachingInvertedFeature* childTwoFeature2 = new CachingInvertedFeature(childTwo); + CachingFeature* childTwoFeature = new CachingFeature(*childTwo); + CachingInvertedFeature* childTwoFeature2 = new CachingInvertedFeature(*childTwo); CachingObject* childThree = new CachingObject(childTwo); childThree->rotate(Deg(90.0f), Vector3::yAxis()); @@ -369,7 +369,7 @@ void ObjectTest::setCleanListHierarchy() { class CachingFeature: public AbstractFeature3D { public: - CachingFeature(AbstractObject3D* object): AbstractFeature3D(object) { + CachingFeature(AbstractObject3D& object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } @@ -385,7 +385,7 @@ void ObjectTest::setCleanListHierarchy() { CachingObject* childTwo = new CachingObject(childOne); childTwo->translate(Vector3::xAxis(1.0f)); - CachingFeature* childTwoFeature = new CachingFeature(childTwo); + CachingFeature* childTwoFeature = new CachingFeature(*childTwo); CachingObject* childThree = new CachingObject(childTwo); childThree->rotate(Deg(90.0f), Vector3::yAxis()); From f669dd7c23db7ad360bbce543b191a650e3aa8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:54:08 +0200 Subject: [PATCH 81/90] Reducing pointer chasings, part 3d: less pointer passing in Shapes. Mostly just adapted to SceneGraph changes, functions not expecting nullptr are now taking/returning reference. --- src/Shapes/AbstractShape.cpp | 8 ++++---- src/Shapes/AbstractShape.h | 12 ++++++------ src/Shapes/Composition.cpp | 6 +++--- src/Shapes/Composition.h | 19 +++++++++---------- .../Implementation/CollisionDispatch.cpp | 16 ++++++++-------- src/Shapes/Implementation/CollisionDispatch.h | 2 +- src/Shapes/Shape.h | 16 ++++++++-------- src/Shapes/ShapeGroup.cpp | 8 ++++---- src/Shapes/ShapeGroup.h | 2 +- src/Shapes/Test/ShapeTest.cpp | 16 ++++++++-------- 10 files changed, 52 insertions(+), 53 deletions(-) diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index c552ab15d..f6cee4d27 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace Shapes { -template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature, Float>(object, group) { +template AbstractShape::AbstractShape(SceneGraph::AbstractObject& object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature, Float>(object, group) { SceneGraph::AbstractFeature::setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } @@ -44,11 +44,11 @@ template const ShapeGroup* AbstractShape auto AbstractShape::type() const -> Type { - return abstractTransformedShape()->type(); + return abstractTransformedShape().type(); } -template bool AbstractShape::collides(const AbstractShape* other) const { - return Implementation::collides(abstractTransformedShape(), other->abstractTransformedShape()); +template bool AbstractShape::collides(const AbstractShape& other) const { + return Implementation::collides(abstractTransformedShape(), other.abstractTransformedShape()); } template void AbstractShape::markDirty() { diff --git a/src/Shapes/AbstractShape.h b/src/Shapes/AbstractShape.h index b4e30e8e6..cd888807e 100644 --- a/src/Shapes/AbstractShape.h +++ b/src/Shapes/AbstractShape.h @@ -37,8 +37,8 @@ namespace Magnum { namespace Shapes { namespace Implementation { - template inline const AbstractShape* getAbstractShape(const Shapes::AbstractShape* shape) { - return shape->abstractTransformedShape(); + template inline const AbstractShape& getAbstractShape(const Shapes::AbstractShape& shape) { + return shape.abstractTransformedShape(); } } @@ -50,7 +50,7 @@ brief introduction. @see AbstractShape2D, AbstractShape3D */ template class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractGroupedFeature, Float> { - friend const Implementation::AbstractShape* Implementation::getAbstractShape<>(const AbstractShape*); + friend const Implementation::AbstractShape& Implementation::getAbstractShape<>(const AbstractShape&); public: enum: UnsignedInt { @@ -79,7 +79,7 @@ template class MAGNUM_SHAPES_EXPORT AbstractShape: publi * @param object Object holding this feature * @param group Group this shape belongs to */ - explicit AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group = nullptr); + explicit AbstractShape(SceneGraph::AbstractObject& object, ShapeGroup* group = nullptr); /** * @brief Shape group containing this shape @@ -99,14 +99,14 @@ template class MAGNUM_SHAPES_EXPORT AbstractShape: publi * * Default implementation returns false. */ - bool collides(const AbstractShape* other) const; + bool collides(const AbstractShape& other) const; protected: /** Marks also the group as dirty */ void markDirty() override; private: - virtual const Implementation::AbstractShape MAGNUM_SHAPES_LOCAL * abstractTransformedShape() const = 0; + virtual const Implementation::AbstractShape MAGNUM_SHAPES_LOCAL & abstractTransformedShape() const = 0; }; /** @brief Base class for two-dimensional object shapes */ diff --git a/src/Shapes/Composition.cpp b/src/Shapes/Composition.cpp index 9f4fc5707..7a9fe3857 100644 --- a/src/Shapes/Composition.cpp +++ b/src/Shapes/Composition.cpp @@ -132,7 +132,7 @@ template Composition Composition return out; } -template bool Composition::collides(const Implementation::AbstractShape* const a, const std::size_t node, const std::size_t shapeBegin, const std::size_t shapeEnd) const { +template bool Composition::collides(const Implementation::AbstractShape& a, const std::size_t node, const std::size_t shapeBegin, const std::size_t shapeEnd) const { /* Empty group */ if(shapeBegin == shapeEnd) return false; @@ -141,7 +141,7 @@ template bool Composition::collides(const Im /* Collision on the left child. If the node is leaf one (no left child exists), do it directly, recurse instead. */ const bool collidesLeft = (_nodes[node].rightNode == 0 || _nodes[node].rightNode == 2) ? - Implementation::collides(a, _shapes[shapeBegin]) : + Implementation::collides(a, *_shapes[shapeBegin]) : collides(a, node+1, shapeBegin, shapeBegin+_nodes[node].rightShape); /* NOT operation */ @@ -155,7 +155,7 @@ template bool Composition::collides(const Im /* Now the collision result depends only on the right child. Similar to collision on the left child. */ return (_nodes[node].rightNode < 2) ? - Implementation::collides(a, _shapes[shapeBegin+_nodes[node].rightShape]) : + Implementation::collides(a, *_shapes[shapeBegin+_nodes[node].rightShape]) : collides(a, node+_nodes[node].rightNode-1, shapeBegin+_nodes[node].rightShape, shapeEnd); } diff --git a/src/Shapes/Composition.h b/src/Shapes/Composition.h index c2530c1fc..5552352cc 100644 --- a/src/Shapes/Composition.h +++ b/src/Shapes/Composition.h @@ -42,11 +42,11 @@ namespace Magnum { namespace Shapes { namespace Implementation { template struct ShapeHelper; - template inline AbstractShape* getAbstractShape(Composition& group, std::size_t i) { - return group._shapes[i]; + template inline AbstractShape& getAbstractShape(Composition& group, std::size_t i) { + return *group._shapes[i]; } - template inline const AbstractShape* getAbstractShape(const Composition& group, std::size_t i) { - return group._shapes[i]; + template inline const AbstractShape& getAbstractShape(const Composition& group, std::size_t i) { + return *group._shapes[i]; } } @@ -63,8 +63,8 @@ enum class CompositionOperation: UnsignedByte { Result of logical operations on shapes. See @ref shapes for brief introduction. */ template class MAGNUM_SHAPES_EXPORT Composition { - friend Implementation::AbstractShape* Implementation::getAbstractShape<>(Composition&, std::size_t); - friend const Implementation::AbstractShape* Implementation::getAbstractShape<>(const Composition&, std::size_t); + friend Implementation::AbstractShape& Implementation::getAbstractShape<>(Composition&, std::size_t); + friend const Implementation::AbstractShape& Implementation::getAbstractShape<>(const Composition&, std::size_t); friend struct Implementation::ShapeHelper>; public: @@ -142,8 +142,7 @@ template class MAGNUM_SHAPES_EXPORT Composition { #else template auto operator%(const T& other) const -> typename std::enable_if::type()), typename Implementation::ShapeDimensionTraits::Type>::value, bool>::type { #endif - Implementation::Shape a(other); - return collides(&a); + return collides(Implementation::Shape(other)); } private: @@ -152,11 +151,11 @@ template class MAGNUM_SHAPES_EXPORT Composition { CompositionOperation operation; }; - bool collides(const Implementation::AbstractShape* a) const { + bool collides(const Implementation::AbstractShape& a) const { return collides(a, 0, 0, _shapeCount); } - bool collides(const Implementation::AbstractShape* a, std::size_t node, std::size_t shapeBegin, std::size_t shapeEnd) const; + bool collides(const Implementation::AbstractShape& a, std::size_t node, std::size_t shapeBegin, std::size_t shapeEnd) const; template constexpr static std::size_t shapeCount(const T&) { return 1; diff --git a/src/Shapes/Implementation/CollisionDispatch.cpp b/src/Shapes/Implementation/CollisionDispatch.cpp index f359d059f..d4c0e8602 100644 --- a/src/Shapes/Implementation/CollisionDispatch.cpp +++ b/src/Shapes/Implementation/CollisionDispatch.cpp @@ -35,13 +35,13 @@ namespace Magnum { namespace Shapes { namespace Implementation { -template<> bool collides(const AbstractShape<2>* const a, const AbstractShape<2>* const b) { - if(a->type() < b->type()) return collides(b, a); +template<> bool collides(const AbstractShape<2>& a, const AbstractShape<2>& b) { + if(a.type() < b.type()) return collides(b, a); - switch(UnsignedInt(a->type())*UnsignedInt(b->type())) { + switch(UnsignedInt(a.type())*UnsignedInt(b.type())) { #define _c(aType, aClass, bType, bClass) \ case UnsignedInt(ShapeDimensionTraits<2>::Type::aType)*UnsignedInt(ShapeDimensionTraits<2>::Type::bType): \ - return static_cast*>(a)->shape % static_cast*>(b)->shape; + return static_cast&>(a).shape % static_cast&>(b).shape; _c(Sphere, Sphere2D, Point, Point2D) _c(Sphere, Sphere2D, Line, Line2D) _c(Sphere, Sphere2D, LineSegment, LineSegment2D) @@ -57,13 +57,13 @@ template<> bool collides(const AbstractShape<2>* const a, const AbstractShape<2> return false; } -template<> bool collides(const AbstractShape<3>* const a, const AbstractShape<3>* const b) { - if(a->type() < b->type()) return collides(b, a); +template<> bool collides(const AbstractShape<3>& a, const AbstractShape<3>& b) { + if(a.type() < b.type()) return collides(b, a); - switch(UnsignedInt(a->type())*UnsignedInt(b->type())) { + switch(UnsignedInt(a.type())*UnsignedInt(b.type())) { #define _c(aType, aClass, bType, bClass) \ case UnsignedInt(ShapeDimensionTraits<3>::Type::aType)*UnsignedInt(ShapeDimensionTraits<3>::Type::bType): \ - return static_cast*>(a)->shape % static_cast*>(b)->shape; + return static_cast&>(a).shape % static_cast&>(b).shape; _c(Sphere, Sphere3D, Point, Point3D) _c(Sphere, Sphere3D, Line, Line3D) _c(Sphere, Sphere3D, LineSegment, LineSegment3D) diff --git a/src/Shapes/Implementation/CollisionDispatch.h b/src/Shapes/Implementation/CollisionDispatch.h index 99517c970..a226e822c 100644 --- a/src/Shapes/Implementation/CollisionDispatch.h +++ b/src/Shapes/Implementation/CollisionDispatch.h @@ -39,7 +39,7 @@ multiply the two numbers together and switch() on the result. Because of multiplying two prime numbers, there is no ambiguity (the result is unique for each combination). */ -template bool collides(const AbstractShape* a, const AbstractShape* b); +template bool collides(const AbstractShape& a, const AbstractShape& b); }}} diff --git a/src/Shapes/Shape.h b/src/Shapes/Shape.h index 71854bd5c..e4ac03523 100644 --- a/src/Shapes/Shape.h +++ b/src/Shapes/Shape.h @@ -56,7 +56,7 @@ islands. @code Shapes::ShapeGroup3D shapes; -Object3D* object; +Object3D object; auto shape = new Shapes::Shape(object, {{}, 0.75f}, &shapes); Shapes::AbstractShape3D* firstCollision = shapes.firstCollision(shape); @@ -75,17 +75,17 @@ template class Shape: public AbstractShape { * @param shape Shape * @param group Group this shape belongs to */ - explicit Shape(SceneGraph::AbstractObject* object, const T& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { + explicit Shape(SceneGraph::AbstractObject& object, const T& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { Implementation::ShapeHelper::set(*this, shape); } /** @overload */ - explicit Shape(SceneGraph::AbstractObject* object, T&& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { + explicit Shape(SceneGraph::AbstractObject& object, T&& shape, ShapeGroup* group = nullptr): AbstractShape(object, group) { Implementation::ShapeHelper::set(*this, std::move(shape)); } /** @overload */ - explicit Shape(SceneGraph::AbstractObject* object, ShapeGroup* group = nullptr): AbstractShape(object, group) {} + explicit Shape(SceneGraph::AbstractObject& object, ShapeGroup* group = nullptr): AbstractShape(object, group) {} /** @brief Shape */ const T& shape() const { return _shape.shape; } @@ -110,8 +110,8 @@ template class Shape: public AbstractShape { void clean(const typename DimensionTraits::MatrixType& absoluteTransformationMatrix) override; private: - const Implementation::AbstractShape* abstractTransformedShape() const override { - return &_transformedShape; + const Implementation::AbstractShape& abstractTransformedShape() const override { + return _transformedShape; } Implementation::Shape _shape, _transformedShape; @@ -119,12 +119,12 @@ template class Shape: public AbstractShape { template inline Shape& Shape::setShape(const T& shape) { Implementation::ShapeHelper::set(*this, shape); - this->object()->setDirty(); + this->object().setDirty(); return *this; } template inline const T& Shape::transformedShape() { - this->object()->setClean(); + this->object().setClean(); return _transformedShape.shape; } diff --git a/src/Shapes/ShapeGroup.cpp b/src/Shapes/ShapeGroup.cpp index 7c28e30dc..a44d06480 100644 --- a/src/Shapes/ShapeGroup.cpp +++ b/src/Shapes/ShapeGroup.cpp @@ -33,7 +33,7 @@ template void ShapeGroup::setClean() { if(!this->isEmpty()) { std::vector*> objects(this->size()); for(std::size_t i = 0; i != this->size(); ++i) - objects[i] = (*this)[i]->object(); + objects[i] = &(*this)[i].object(); SceneGraph::AbstractObject::setClean(objects); } @@ -41,11 +41,11 @@ template void ShapeGroup::setClean() { dirty = false; } -template AbstractShape* ShapeGroup::firstCollision(const AbstractShape* shape) { +template AbstractShape* ShapeGroup::firstCollision(const AbstractShape& shape) { setClean(); for(std::size_t i = 0; i != this->size(); ++i) - if((*this)[i] != shape && (*this)[i]->collides(shape)) - return (*this)[i]; + if(&(*this)[i] != &shape && (*this)[i].collides(shape)) + return &(*this)[i]; return nullptr; } diff --git a/src/Shapes/ShapeGroup.h b/src/Shapes/ShapeGroup.h index bd181def2..fb683650c 100644 --- a/src/Shapes/ShapeGroup.h +++ b/src/Shapes/ShapeGroup.h @@ -86,7 +86,7 @@ template class MAGNUM_SHAPES_EXPORT ShapeGroup: public S * collisions, returns `nullptr`. Calls setClean() before the * operation. */ - AbstractShape* firstCollision(const AbstractShape* shape); + AbstractShape* firstCollision(const AbstractShape& shape); private: bool dirty; diff --git a/src/Shapes/Test/ShapeTest.cpp b/src/Shapes/Test/ShapeTest.cpp index 7c8e2d8b0..432c55a9d 100644 --- a/src/Shapes/Test/ShapeTest.cpp +++ b/src/Shapes/Test/ShapeTest.cpp @@ -60,11 +60,11 @@ void ShapeTest::clean() { ShapeGroup3D shapes; Object3D a(&scene); - auto shape = new Shapes::Shape(&a, {{1.0f, -2.0f, 3.0f}}, &shapes); + auto shape = new Shapes::Shape(a, {{1.0f, -2.0f, 3.0f}}, &shapes); a.scale(Vector3(-2.0f)); Object3D b(&scene); - new Shapes::Shape(&b, &shapes); + new Shapes::Shape(b, &shapes); /* Everything is dirty at the beginning */ CORRADE_VERIFY(shapes.isDirty()); @@ -100,13 +100,13 @@ void ShapeTest::firstCollision() { ShapeGroup3D shapes; Object3D a(&scene); - auto aShape = new Shape(&a, {{1.0f, -2.0f, 3.0f}, 1.5f}, &shapes); + Shape aShape(a, {{1.0f, -2.0f, 3.0f}, 1.5f}, &shapes); Object3D b(&scene); - auto bShape = new Shape(&b, {{3.0f, -2.0f, 3.0f}}, &shapes); + Shape bShape(b, {{3.0f, -2.0f, 3.0f}}, &shapes); Object3D c(&scene); - new Shape(&c, &shapes); + Shape cShape(c, &shapes); /* No collisions initially */ CORRADE_VERIFY(!shapes.firstCollision(aShape)); @@ -118,8 +118,8 @@ void ShapeTest::firstCollision() { /* Collision */ CORRADE_VERIFY(shapes.isDirty()); - CORRADE_VERIFY(shapes.firstCollision(aShape) == bShape); - CORRADE_VERIFY(shapes.firstCollision(bShape) == aShape); + CORRADE_VERIFY(shapes.firstCollision(aShape) == &bShape); + CORRADE_VERIFY(shapes.firstCollision(bShape) == &aShape); CORRADE_VERIFY(!shapes.isDirty()); } @@ -129,7 +129,7 @@ void ShapeTest::shapeGroup() { /* Verify construction */ Object2D a(&scene); - auto shape = new Shape(&a, Shapes::Sphere2D({}, 0.5f) || Shapes::Point2D({0.25f, -1.0f})); + auto shape = new Shape(a, Shapes::Sphere2D({}, 0.5f) || Shapes::Point2D({0.25f, -1.0f})); CORRADE_COMPARE(shape->transformedShape().size(), 2); /* Verify the original shape is updated */ From 141a3df45685a4763a62d1e4c6db6963168a6502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:51:37 +0200 Subject: [PATCH 82/90] Reducing pointer chasings, part 3e: less pointer passing in DebugTools. In most cases just adapted to changes in root namespace and SceneGraph. ForceRenderer now takes const reference to force vector and additionally disallows passing rvalue to it. --- doc/debug-tools.dox | 2 +- src/DebugTools/ForceRenderer.cpp | 26 +++++------ src/DebugTools/ForceRenderer.h | 9 ++-- .../Implementation/AbstractShapeRenderer.cpp | 30 ++++++------- .../Implementation/AxisAlignedBoxRenderer.cpp | 2 +- .../Implementation/AxisAlignedBoxRenderer.h | 3 +- src/DebugTools/Implementation/BoxRenderer.cpp | 2 +- src/DebugTools/Implementation/BoxRenderer.h | 3 +- .../Implementation/LineSegmentRenderer.cpp | 2 +- .../Implementation/LineSegmentRenderer.h | 3 +- .../Implementation/PointRenderer.cpp | 2 +- src/DebugTools/Implementation/PointRenderer.h | 3 +- .../Implementation/SphereRenderer.cpp | 2 +- .../Implementation/SphereRenderer.h | 7 +-- src/DebugTools/ObjectRenderer.cpp | 28 ++++++------ src/DebugTools/ObjectRenderer.h | 4 +- src/DebugTools/ShapeRenderer.cpp | 44 +++++++++---------- src/DebugTools/ShapeRenderer.h | 8 ++-- 18 files changed, 94 insertions(+), 86 deletions(-) diff --git a/doc/debug-tools.dox b/doc/debug-tools.dox index 517fee209..95f4ded6d 100644 --- a/doc/debug-tools.dox +++ b/doc/debug-tools.dox @@ -69,7 +69,7 @@ DebugTools::ResourceManager::instance()->set("my", // renderer is automatically added to the object features and also to // specified drawable group. Object3D* object; -new DebugTools::ObjectRenderer2D(object, "my", debugDrawables); +new DebugTools::ObjectRenderer2D(*object, "my", debugDrawables); @endcode See DebugTools::ObjectRenderer and DebugTools::ShapeRenderer for more diff --git a/src/DebugTools/ForceRenderer.cpp b/src/DebugTools/ForceRenderer.cpp index ac0cf7427..c1bbb53bd 100644 --- a/src/DebugTools/ForceRenderer.cpp +++ b/src/DebugTools/ForceRenderer.cpp @@ -64,15 +64,15 @@ const std::array indices{{ } -template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance()->get(options)) { +template ForceRenderer::ForceRenderer(SceneGraph::AbstractObject& object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), forcePosition(forcePosition), force(force), options(ResourceManager::instance().get(options)) { /* Shader */ - shader = ResourceManager::instance()->get>(shaderKey()); - if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::Flat); + shader = ResourceManager::instance().get>(shaderKey()); + if(!shader) ResourceManager::instance().set(shader.key(), new Shaders::Flat); /* Mesh and vertex buffer */ - mesh = ResourceManager::instance()->get("force"); - vertexBuffer = ResourceManager::instance()->get("force-vertices"); - indexBuffer = ResourceManager::instance()->get("force-indices"); + mesh = ResourceManager::instance().get("force"); + vertexBuffer = ResourceManager::instance().get("force-vertices"); + indexBuffer = ResourceManager::instance().get("force-indices"); if(mesh) return; /* Create the mesh */ @@ -80,22 +80,22 @@ template ForceRenderer::ForceRenderer(SceneG Buffer* indexBuffer = new Buffer(Buffer::Target::ElementArray); vertexBuffer->setData(positions, Buffer::Usage::StaticDraw); - ResourceManager::instance()->set(this->vertexBuffer.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + ResourceManager::instance().set(this->vertexBuffer.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); indexBuffer->setData(indices, Buffer::Usage::StaticDraw); - ResourceManager::instance()->set(this->indexBuffer.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + ResourceManager::instance().set(this->indexBuffer.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); Mesh* mesh = new Mesh; mesh->setPrimitive(Mesh::Primitive::Lines) .setIndexCount(indices.size()) - .addVertexBuffer(vertexBuffer, 0, + .addVertexBuffer(*vertexBuffer, 0, typename Shaders::Flat::Position(Shaders::Flat::Position::Components::Two)) - .setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, positions.size()); - ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); + .setIndexBuffer(*indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, positions.size()); + ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { - shader->setTransformationProjectionMatrix(camera->projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), *force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) +template void ForceRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) { + shader->setTransformationProjectionMatrix(camera.projectionMatrix()*Implementation::forceRendererTransformation(transformationMatrix.transformPoint(forcePosition), force)*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->scale()))) .setColor(options->color()) .use(); mesh->draw(); diff --git a/src/DebugTools/ForceRenderer.h b/src/DebugTools/ForceRenderer.h index df5babf4e..2bb1704ad 100644 --- a/src/DebugTools/ForceRenderer.h +++ b/src/DebugTools/ForceRenderer.h @@ -117,14 +117,17 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ForceRenderer: p * saved as reference to original vector and thus it must be available * for the whole lifetime of the renderer. */ - explicit ForceRenderer(SceneGraph::AbstractObject* object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType* force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + explicit ForceRenderer(SceneGraph::AbstractObject& object, const typename DimensionTraits::VectorType& forcePosition, const typename DimensionTraits::VectorType& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + + /** @overload */ + ForceRenderer(SceneGraph::AbstractObject&, const typename DimensionTraits::VectorType&, typename DimensionTraits::VectorType&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup* = nullptr) = delete; protected: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; private: const typename DimensionTraits::VectorType forcePosition; - const typename DimensionTraits::VectorType* const force; + const typename DimensionTraits::VectorType& force; Resource options; Resource> shader; diff --git a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp index c8e7789d8..856d9497b 100644 --- a/src/DebugTools/Implementation/AbstractShapeRenderer.cpp +++ b/src/DebugTools/Implementation/AbstractShapeRenderer.cpp @@ -47,21 +47,21 @@ template<> void create<2>(Trade::MeshData2D& data, Resource& meshResource, /* Vertex buffer */ Buffer* buffer = new Buffer(Buffer::Target::Array); buffer->setData(data.positions(0), Buffer::Usage::StaticDraw); - ResourceManager::instance()->set(vertexBufferResource.key(), buffer, ResourceDataState::Final, ResourcePolicy::Manual); + ResourceManager::instance().set(vertexBufferResource.key(), buffer, ResourceDataState::Final, ResourcePolicy::Manual); /* Mesh configuration */ Mesh* mesh = new Mesh; mesh->setPrimitive(data.primitive()) .setVertexCount(data.positions(0).size()) - .addVertexBuffer(buffer, 0, Shaders::Flat2D::Position()); - ResourceManager::instance()->set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); + .addVertexBuffer(*buffer, 0, Shaders::Flat2D::Position()); + ResourceManager::instance().set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); /* Index buffer, if needed, if not, resource key doesn't have to be set */ if(data.isIndexed()) { CORRADE_INTERNAL_ASSERT(indexBufferResource.key() != ResourceKey()); Buffer* indexBuffer = new Buffer(Buffer::Target::ElementArray); - MeshTools::compressIndices(mesh, indexBuffer, Buffer::Usage::StaticDraw, data.indices()); - ResourceManager::instance()->set(indexBufferResource.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + MeshTools::compressIndices(*mesh, *indexBuffer, Buffer::Usage::StaticDraw, data.indices()); + ResourceManager::instance().set(indexBufferResource.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); } } @@ -69,33 +69,33 @@ template<> void create<3>(Trade::MeshData3D& data, Resource& meshResource, /* Vertex buffer */ Buffer* vertexBuffer = new Buffer(Buffer::Target::Array); vertexBuffer->setData(data.positions(0), Buffer::Usage::StaticDraw); - ResourceManager::instance()->set(vertexBufferResource.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + ResourceManager::instance().set(vertexBufferResource.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); /* Mesh configuration */ Mesh* mesh = new Mesh; mesh->setPrimitive(data.primitive()) .setVertexCount(data.positions(0).size()) - .addVertexBuffer(vertexBuffer, 0, Shaders::Flat3D::Position()); - ResourceManager::instance()->set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); + .addVertexBuffer(*vertexBuffer, 0, Shaders::Flat3D::Position()); + ResourceManager::instance().set(meshResource.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); /* Index buffer, if needed, if not, resource key doesn't have to be set */ if(data.isIndexed()) { CORRADE_INTERNAL_ASSERT(indexBufferResource.key() != ResourceKey()); Buffer* indexBuffer = new Buffer(Buffer::Target::ElementArray); - MeshTools::compressIndices(mesh, indexBuffer, Buffer::Usage::StaticDraw, data.indices()); - ResourceManager::instance()->set(indexBufferResource.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + MeshTools::compressIndices(*mesh, *indexBuffer, Buffer::Usage::StaticDraw, data.indices()); + ResourceManager::instance().set(indexBufferResource.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); } } } template AbstractShapeRenderer::AbstractShapeRenderer(ResourceKey meshKey, ResourceKey vertexBufferKey, ResourceKey indexBufferKey) { - wireframeShader = ResourceManager::instance()->get>(shaderKey()); - wireframeMesh = ResourceManager::instance()->get(meshKey); - vertexBuffer = ResourceManager::instance()->get(vertexBufferKey); - indexBuffer = ResourceManager::instance()->get(indexBufferKey); + wireframeShader = ResourceManager::instance().get>(shaderKey()); + wireframeMesh = ResourceManager::instance().get(meshKey); + vertexBuffer = ResourceManager::instance().get(vertexBufferKey); + indexBuffer = ResourceManager::instance().get(indexBufferKey); - if(!wireframeShader) ResourceManager::instance()->set(shaderKey(), + if(!wireframeShader) ResourceManager::instance().set(shaderKey(), new Shaders::Flat, ResourceDataState::Final, ResourcePolicy::Resident); } diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index 5a497c2da..dd90f600b 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template AxisAlignedBoxRenderer::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape* axisAlignedBox): axisAlignedBox(static_cast>*>(axisAlignedBox)->shape) {} +template AxisAlignedBoxRenderer::AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape& axisAlignedBox): axisAlignedBox(static_cast>&>(axisAlignedBox).shape) {} template void AxisAlignedBoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h index b50cb5777..999cc4bf1 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.h @@ -34,7 +34,8 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template class AxisAlignedBoxRenderer: public AbstractBoxRenderer { public: - AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape* axisAlignedBox); + explicit AxisAlignedBoxRenderer(const Shapes::Implementation::AbstractShape& axisAlignedBox); + AxisAlignedBoxRenderer(Shapes::Implementation::AbstractShape&&) = delete; void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; diff --git a/src/DebugTools/Implementation/BoxRenderer.cpp b/src/DebugTools/Implementation/BoxRenderer.cpp index dd5a45239..16ce142ee 100644 --- a/src/DebugTools/Implementation/BoxRenderer.cpp +++ b/src/DebugTools/Implementation/BoxRenderer.cpp @@ -31,7 +31,7 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template BoxRenderer::BoxRenderer(const Shapes::Implementation::AbstractShape* box): box(static_cast>*>(box)->shape) {} +template BoxRenderer::BoxRenderer(const Shapes::Implementation::AbstractShape& box): box(static_cast>&>(box).shape) {} template void BoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { AbstractBoxRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix*box.transformation()) diff --git a/src/DebugTools/Implementation/BoxRenderer.h b/src/DebugTools/Implementation/BoxRenderer.h index c027ae6d8..54b00cfd2 100644 --- a/src/DebugTools/Implementation/BoxRenderer.h +++ b/src/DebugTools/Implementation/BoxRenderer.h @@ -34,7 +34,8 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template class BoxRenderer: public AbstractBoxRenderer { public: - BoxRenderer(const Shapes::Implementation::AbstractShape* box); + explicit BoxRenderer(const Shapes::Implementation::AbstractShape& box); + BoxRenderer(const Shapes::Implementation::AbstractShape&&) = delete; void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.cpp b/src/DebugTools/Implementation/LineSegmentRenderer.cpp index 9d0ee7524..0ed2c53e5 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.cpp +++ b/src/DebugTools/Implementation/LineSegmentRenderer.cpp @@ -50,7 +50,7 @@ namespace { template<> inline Trade::MeshData3D meshData<3>() { return Primitives::Line3D::wireframe(); } } -template LineSegmentRenderer::LineSegmentRenderer(const Shapes::Implementation::AbstractShape* line): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), line(static_cast>*>(line)->shape) { +template LineSegmentRenderer::LineSegmentRenderer(const Shapes::Implementation::AbstractShape& line): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), line(static_cast>&>(line).shape) { if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } diff --git a/src/DebugTools/Implementation/LineSegmentRenderer.h b/src/DebugTools/Implementation/LineSegmentRenderer.h index 946870cc2..556db46ec 100644 --- a/src/DebugTools/Implementation/LineSegmentRenderer.h +++ b/src/DebugTools/Implementation/LineSegmentRenderer.h @@ -34,7 +34,8 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template class LineSegmentRenderer: public AbstractShapeRenderer { public: - LineSegmentRenderer(const Shapes::Implementation::AbstractShape* line); + explicit LineSegmentRenderer(const Shapes::Implementation::AbstractShape& line); + LineSegmentRenderer(const Shapes::Implementation::AbstractShape&&) = delete; void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; diff --git a/src/DebugTools/Implementation/PointRenderer.cpp b/src/DebugTools/Implementation/PointRenderer.cpp index 458014adb..7a5243180 100644 --- a/src/DebugTools/Implementation/PointRenderer.cpp +++ b/src/DebugTools/Implementation/PointRenderer.cpp @@ -48,7 +48,7 @@ namespace { template<> inline Trade::MeshData3D meshData<3>() { return Primitives::Crosshair3D::wireframe(); } } -template PointRenderer::PointRenderer(const Shapes::Implementation::AbstractShape* point): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), point(static_cast>*>(point)->shape) { +template PointRenderer::PointRenderer(const Shapes::Implementation::AbstractShape& point): AbstractShapeRenderer(meshKey(), vertexBufferKey(), {}), point(static_cast>&>(point).shape) { if(!AbstractShapeRenderer::wireframeMesh) AbstractShapeRenderer::createResources(meshData()); } diff --git a/src/DebugTools/Implementation/PointRenderer.h b/src/DebugTools/Implementation/PointRenderer.h index 2b194e663..adb88415b 100644 --- a/src/DebugTools/Implementation/PointRenderer.h +++ b/src/DebugTools/Implementation/PointRenderer.h @@ -34,7 +34,8 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template class PointRenderer: public AbstractShapeRenderer { public: - PointRenderer(const Shapes::Implementation::AbstractShape* point); + explicit PointRenderer(const Shapes::Implementation::AbstractShape& point); + PointRenderer(Shapes::Implementation::AbstractShape&&) = delete; void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; diff --git a/src/DebugTools/Implementation/SphereRenderer.cpp b/src/DebugTools/Implementation/SphereRenderer.cpp index 8f13afac0..9a6815738 100644 --- a/src/DebugTools/Implementation/SphereRenderer.cpp +++ b/src/DebugTools/Implementation/SphereRenderer.cpp @@ -43,7 +43,7 @@ AbstractSphereRenderer<3>::AbstractSphereRenderer(): AbstractShapeRenderer<3>("s if(!wireframeMesh) createResources(Primitives::UVSphere::wireframe(40, 20)); } -template SphereRenderer::SphereRenderer(const Shapes::Implementation::AbstractShape* sphere): sphere(static_cast>*>(sphere)->shape) {} +template SphereRenderer::SphereRenderer(const Shapes::Implementation::AbstractShape& sphere): sphere(static_cast>&>(sphere).shape) {} template void SphereRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) { AbstractShapeRenderer::wireframeShader->setTransformationProjectionMatrix(projectionMatrix* diff --git a/src/DebugTools/Implementation/SphereRenderer.h b/src/DebugTools/Implementation/SphereRenderer.h index 232231732..14687a6ee 100644 --- a/src/DebugTools/Implementation/SphereRenderer.h +++ b/src/DebugTools/Implementation/SphereRenderer.h @@ -36,17 +36,18 @@ template class AbstractSphereRenderer; template<> class AbstractSphereRenderer<2>: public AbstractShapeRenderer<2> { public: - AbstractSphereRenderer(); + explicit AbstractSphereRenderer(); }; template<> class AbstractSphereRenderer<3>: public AbstractShapeRenderer<3> { public: - AbstractSphereRenderer(); + explicit AbstractSphereRenderer(); }; template class SphereRenderer: public AbstractSphereRenderer { public: - SphereRenderer(const Shapes::Implementation::AbstractShape* sphere); + explicit SphereRenderer(const Shapes::Implementation::AbstractShape& sphere); + SphereRenderer(const Shapes::Implementation::AbstractShape&&) = delete; void draw(Resource& options, const typename DimensionTraits::MatrixType& projectionMatrix) override; diff --git a/src/DebugTools/ObjectRenderer.cpp b/src/DebugTools/ObjectRenderer.cpp index 143fcf8b3..98b6a7dc7 100644 --- a/src/DebugTools/ObjectRenderer.cpp +++ b/src/DebugTools/ObjectRenderer.cpp @@ -142,15 +142,15 @@ const std::array Renderer<3>::indices{{ } -template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), options(ResourceManager::instance()->get(options)) { +template ObjectRenderer::ObjectRenderer(SceneGraph::AbstractObject& object, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(object, drawables), options(ResourceManager::instance().get(options)) { /* Shader */ - shader = ResourceManager::instance()->get>(Renderer::shader()); - if(!shader) ResourceManager::instance()->set(shader.key(), new Shaders::VertexColor); + shader = ResourceManager::instance().get>(Renderer::shader()); + if(!shader) ResourceManager::instance().set(shader.key(), new Shaders::VertexColor); /* Mesh and vertex buffer */ - mesh = ResourceManager::instance()->get(Renderer::mesh()); - vertexBuffer = ResourceManager::instance()->get(Renderer::vertexBuffer()); - indexBuffer = ResourceManager::instance()->get(Renderer::indexBuffer()); + mesh = ResourceManager::instance().get(Renderer::mesh()); + vertexBuffer = ResourceManager::instance().get(Renderer::vertexBuffer()); + indexBuffer = ResourceManager::instance().get(Renderer::indexBuffer()); if(mesh) return; /* Create the mesh */ @@ -158,23 +158,23 @@ template ObjectRenderer::ObjectRenderer(Scen Buffer* indexBuffer = new Buffer(Buffer::Target::ElementArray); Mesh* mesh = new Mesh; - MeshTools::interleave(mesh, vertexBuffer, Buffer::Usage::StaticDraw, Renderer::positions, Renderer::colors); - ResourceManager::instance()->set(this->vertexBuffer.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + MeshTools::interleave(*mesh, *vertexBuffer, Buffer::Usage::StaticDraw, Renderer::positions, Renderer::colors); + ResourceManager::instance().set(this->vertexBuffer.key(), vertexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); indexBuffer->setData(Renderer::indices, Buffer::Usage::StaticDraw); - ResourceManager::instance()->set(this->indexBuffer.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); + ResourceManager::instance().set(this->indexBuffer.key(), indexBuffer, ResourceDataState::Final, ResourcePolicy::Manual); mesh->setPrimitive(Mesh::Primitive::Lines) .setIndexCount(Renderer::indices.size()) - .addInterleavedVertexBuffer(vertexBuffer, 0, + .addInterleavedVertexBuffer(*vertexBuffer, 0, typename Shaders::VertexColor::Position(), typename Shaders::VertexColor::Color()) - .setIndexBuffer(indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, Renderer::positions.size()); - ResourceManager::instance()->set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); + .setIndexBuffer(*indexBuffer, 0, Mesh::IndexType::UnsignedByte, 0, Renderer::positions.size()); + ResourceManager::instance().set(this->mesh.key(), mesh, ResourceDataState::Final, ResourcePolicy::Manual); } -template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) { - shader->setTransformationProjectionMatrix(camera->projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) +template void ObjectRenderer::draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) { + shader->setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix*DimensionTraits::MatrixType::scaling(typename DimensionTraits::VectorType(options->size()))) .use(); mesh->draw(); diff --git a/src/DebugTools/ObjectRenderer.h b/src/DebugTools/ObjectRenderer.h index df99e2b34..928e63568 100644 --- a/src/DebugTools/ObjectRenderer.h +++ b/src/DebugTools/ObjectRenderer.h @@ -95,10 +95,10 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ObjectRenderer: * * The renderer is automatically added to object's features. */ - explicit ObjectRenderer(SceneGraph::AbstractObject* object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + explicit ObjectRenderer(SceneGraph::AbstractObject& object, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); protected: - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; private: Resource options; diff --git a/src/DebugTools/ShapeRenderer.cpp b/src/DebugTools/ShapeRenderer.cpp index 1c36ff272..f659779eb 100644 --- a/src/DebugTools/ShapeRenderer.cpp +++ b/src/DebugTools/ShapeRenderer.cpp @@ -39,74 +39,74 @@ namespace Magnum { namespace DebugTools { namespace Implementation { -template<> void createDebugMesh(ShapeRenderer<2>* renderer, const Shapes::Implementation::AbstractShape<2>* shape) { - switch(shape->type()) { +template<> void createDebugMesh(ShapeRenderer<2>& renderer, const Shapes::Implementation::AbstractShape<2>& shape) { + switch(shape.type()) { case Shapes::AbstractShape2D::Type::AxisAlignedBox: - renderer->renderers.push_back(new Implementation::AxisAlignedBoxRenderer<2>(shape)); + renderer.renderers.push_back(new Implementation::AxisAlignedBoxRenderer<2>(shape)); break; case Shapes::AbstractShape2D::Type::Box: - renderer->renderers.push_back(new Implementation::BoxRenderer<2>(shape)); + renderer.renderers.push_back(new Implementation::BoxRenderer<2>(shape)); break; case Shapes::AbstractShape2D::Type::LineSegment: - renderer->renderers.push_back(new Implementation::LineSegmentRenderer<2>(shape)); + renderer.renderers.push_back(new Implementation::LineSegmentRenderer<2>(shape)); break; case Shapes::AbstractShape2D::Type::Point: - renderer->renderers.push_back(new Implementation::PointRenderer<2>(shape)); + renderer.renderers.push_back(new Implementation::PointRenderer<2>(shape)); break; case Shapes::AbstractShape2D::Type::Sphere: - renderer->renderers.push_back(new Implementation::SphereRenderer<2>(shape)); + renderer.renderers.push_back(new Implementation::SphereRenderer<2>(shape)); break; case Shapes::AbstractShape2D::Type::Composition: { const Shapes::Composition2D& composition = - static_cast*>(shape)->shape; + static_cast&>(shape).shape; for(std::size_t i = 0; i != composition.size(); ++i) createDebugMesh(renderer, Shapes::Implementation::getAbstractShape(composition, i)); } break; default: - Warning() << "DebugTools::ShapeRenderer2D::createShapeRenderer(): type" << shape->type() << "not implemented"; + Warning() << "DebugTools::ShapeRenderer2D::createShapeRenderer(): type" << shape.type() << "not implemented"; } } -template<> void createDebugMesh(ShapeRenderer<3>* renderer, const Shapes::Implementation::AbstractShape<3>* shape) { - switch(shape->type()) { +template<> void createDebugMesh(ShapeRenderer<3>& renderer, const Shapes::Implementation::AbstractShape<3>& shape) { + switch(shape.type()) { case Shapes::AbstractShape3D::Type::AxisAlignedBox: - renderer->renderers.push_back(new Implementation::AxisAlignedBoxRenderer<3>(shape)); + renderer.renderers.push_back(new Implementation::AxisAlignedBoxRenderer<3>(shape)); break; case Shapes::AbstractShape3D::Type::Box: - renderer->renderers.push_back(new Implementation::BoxRenderer<3>(shape)); + renderer.renderers.push_back(new Implementation::BoxRenderer<3>(shape)); break; case Shapes::AbstractShape3D::Type::LineSegment: - renderer->renderers.push_back(new Implementation::LineSegmentRenderer<3>(shape)); + renderer.renderers.push_back(new Implementation::LineSegmentRenderer<3>(shape)); break; case Shapes::AbstractShape3D::Type::Point: - renderer->renderers.push_back(new Implementation::PointRenderer<3>(shape)); + renderer.renderers.push_back(new Implementation::PointRenderer<3>(shape)); break; case Shapes::AbstractShape3D::Type::Sphere: - renderer->renderers.push_back(new Implementation::SphereRenderer<3>(shape)); + renderer.renderers.push_back(new Implementation::SphereRenderer<3>(shape)); break; case Shapes::AbstractShape3D::Type::Composition: { const Shapes::Composition3D& composition = - static_cast*>(shape)->shape; + static_cast&>(shape).shape; for(std::size_t i = 0; i != composition.size(); ++i) createDebugMesh(renderer, Shapes::Implementation::getAbstractShape(composition, i)); } break; default: - Warning() << "DebugTools::ShapeRenderer3D::createShapeRenderer(): type" << shape->type() << "not implemented"; + Warning() << "DebugTools::ShapeRenderer3D::createShapeRenderer(): type" << shape.type() << "not implemented"; } } } -template ShapeRenderer::ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(shape->object(), drawables), options(ResourceManager::instance()->get(options)) { - Implementation::createDebugMesh(this, Shapes::Implementation::getAbstractShape(shape)); +template ShapeRenderer::ShapeRenderer(Shapes::AbstractShape& shape, ResourceKey options, SceneGraph::DrawableGroup* drawables): SceneGraph::Drawable(shape.object(), drawables), options(ResourceManager::instance().get(options)) { + Implementation::createDebugMesh(*this, Shapes::Implementation::getAbstractShape(shape)); } template ShapeRenderer::~ShapeRenderer() { for(auto i: renderers) delete i; } -template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractCamera* camera) { - typename DimensionTraits::MatrixType projectionMatrix = camera->projectionMatrix()*camera->cameraMatrix(); +template void ShapeRenderer::draw(const typename DimensionTraits::MatrixType&, SceneGraph::AbstractCamera& camera) { + typename DimensionTraits::MatrixType projectionMatrix = camera.projectionMatrix()*camera.cameraMatrix(); for(auto i: renderers) i->draw(options, projectionMatrix); } diff --git a/src/DebugTools/ShapeRenderer.h b/src/DebugTools/ShapeRenderer.h index 0da35cf1c..86add1e9e 100644 --- a/src/DebugTools/ShapeRenderer.h +++ b/src/DebugTools/ShapeRenderer.h @@ -46,7 +46,7 @@ template class ShapeRenderer; namespace Implementation { template class AbstractShapeRenderer; - template void createDebugMesh(ShapeRenderer* renderer, const Shapes::Implementation::AbstractShape* shape); + template void createDebugMesh(ShapeRenderer& renderer, const Shapes::Implementation::AbstractShape& shape); } /** @@ -139,7 +139,7 @@ new DebugTools::ShapeRenderer2D(shape, "red", debugDrawables); @see ShapeRenderer2D, ShapeRenderer3D */ template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::Drawable { - friend void Implementation::createDebugMesh<>(ShapeRenderer*, const Shapes::Implementation::AbstractShape*); + friend void Implementation::createDebugMesh<>(ShapeRenderer&, const Shapes::Implementation::AbstractShape&); public: /** @@ -154,13 +154,13 @@ template class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: p * @p shape must be available for the whole lifetime of the renderer * and if it is group, it must not change its internal structure. */ - explicit ShapeRenderer(Shapes::AbstractShape* shape, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); + explicit ShapeRenderer(Shapes::AbstractShape& shape, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup* drawables = nullptr); ~ShapeRenderer(); protected: /** @todoc Remove Float when Doxygen properly treats this as override */ - void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera* camera) override; + void draw(const typename DimensionTraits::MatrixType& transformationMatrix, SceneGraph::AbstractCamera& camera) override; private: Resource options; From 8a8b9aca5e0510757157232fdbc8887569661666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:58:07 +0200 Subject: [PATCH 83/90] Reducing pointer chasings, part 3f: less pointer passing in TextureTools. --- src/TextureTools/DistanceField.cpp | 10 +++++----- src/TextureTools/DistanceField.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/TextureTools/DistanceField.cpp b/src/TextureTools/DistanceField.cpp index 5c3adbe90..e2d185a8d 100644 --- a/src/TextureTools/DistanceField.cpp +++ b/src/TextureTools/DistanceField.cpp @@ -129,9 +129,9 @@ DistanceFieldShader::DistanceFieldShader(): radiusUniform(0), scalingUniform(1) } #ifndef MAGNUM_TARGET_GLES -void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectangle, const Int radius, const Vector2i&) +void distanceField(Texture2D& input, Texture2D& output, const Rectanglei& rectangle, const Int radius, const Vector2i&) #else -void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectangle, const Int radius, const Vector2i& imageSize) +void distanceField(Texture2D& input, Texture2D& output, const Rectanglei& rectangle, const Int radius, const Vector2i& imageSize) #endif { #ifndef MAGNUM_TARGET_GLES @@ -141,7 +141,7 @@ void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectan /** @todo Disable depth test, blending and then enable it back (if was previously) */ #ifndef MAGNUM_TARGET_GLES - Vector2i imageSize = input->imageSize(0); + Vector2i imageSize = input.imageSize(0); #endif Framebuffer framebuffer(rectangle); @@ -161,7 +161,7 @@ void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectan .setScaling(Vector2(imageSize)/rectangle.size()) .use(); - input->bind(DistanceFieldShader::TextureLayer); + input.bind(DistanceFieldShader::TextureLayer); #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isVersionSupported(Version::GL300)) @@ -190,7 +190,7 @@ void distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectan Vector2( 3.0, 1.0) }; buffer.setData(triangle, Buffer::Usage::StaticDraw); - mesh.addVertexBuffer(&buffer, 0, DistanceFieldShader::Position()); + mesh.addVertexBuffer(buffer, 0, DistanceFieldShader::Position()); } /* Draw the mesh */ diff --git a/src/TextureTools/DistanceField.h b/src/TextureTools/DistanceField.h index e44e6ba8d..811ff6ba3 100644 --- a/src/TextureTools/DistanceField.h +++ b/src/TextureTools/DistanceField.h @@ -85,9 +85,9 @@ http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnifica (jaggies, visible e.g. when rendering outlined fonts) */ #ifndef MAGNUM_TARGET_GLES -void MAGNUM_TEXTURETOOLS_EXPORT distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectangle, Int radius, const Vector2i& imageSize = Vector2i()); +void MAGNUM_TEXTURETOOLS_EXPORT distanceField(Texture2D& input, Texture2D& output, const Rectanglei& rectangle, Int radius, const Vector2i& imageSize = Vector2i()); #else -void MAGNUM_TEXTURETOOLS_EXPORT distanceField(Texture2D* input, Texture2D* output, const Rectanglei& rectangle, Int radius, const Vector2i& imageSize); +void MAGNUM_TEXTURETOOLS_EXPORT distanceField(Texture2D& input, Texture2D& output, const Rectanglei& rectangle, Int radius, const Vector2i& imageSize); #endif }} From a962262b6128207af61ad4bf8196431d0171b6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 17:59:20 +0200 Subject: [PATCH 84/90] Reducing pointer chasings, part 3g: less pointer passing in Text. The testing is now slightly more sloppy due to inability to not pass any Font or GlyphCache object. But it is actually better from user point of view, as it is now impossible to do that by accident. --- src/Text/AbstractFont.cpp | 6 ++--- src/Text/AbstractFont.h | 8 +++---- src/Text/AbstractFontConverter.cpp | 24 +++++++++---------- src/Text/AbstractFontConverter.h | 24 +++++++++---------- src/Text/DistanceFieldGlyphCache.cpp | 4 ++-- src/Text/GlyphCache.h | 2 +- src/Text/Test/AbstractFontConverterTest.cpp | 20 ++++++++-------- src/Text/Test/AbstractFontTest.cpp | 2 +- src/Text/Test/GlyphCacheGLTest.cpp | 2 +- src/Text/Test/TextRendererGLTest.cpp | 12 +++++----- src/Text/TextRenderer.cpp | 24 +++++++++---------- src/Text/TextRenderer.h | 26 +++++++++++---------- 12 files changed, 78 insertions(+), 76 deletions(-) diff --git a/src/Text/AbstractFont.cpp b/src/Text/AbstractFont.cpp index 6646f47a0..52c9feaff 100644 --- a/src/Text/AbstractFont.cpp +++ b/src/Text/AbstractFont.cpp @@ -115,7 +115,7 @@ Vector2 AbstractFont::glyphAdvance(const UnsignedInt glyph) { return doGlyphAdvance(glyph); } -void AbstractFont::fillGlyphCache(GlyphCache* const cache, const std::string& characters) { +void AbstractFont::fillGlyphCache(GlyphCache& cache, const std::string& characters) { CORRADE_ASSERT(isOpened(), "Text::AbstractFont::createGlyphCache(): no font opened", ); CORRADE_ASSERT(!(features() & Feature::PreparedGlyphCache), @@ -124,7 +124,7 @@ void AbstractFont::fillGlyphCache(GlyphCache* const cache, const std::string& ch doFillGlyphCache(cache, Utility::Unicode::utf32(characters)); } -void AbstractFont::doFillGlyphCache(GlyphCache*, const std::u32string&) { +void AbstractFont::doFillGlyphCache(GlyphCache&, const std::u32string&) { CORRADE_ASSERT(false, "Text::AbstractFont::fillGlyphCache(): feature advertised but not implemented", ); } @@ -141,7 +141,7 @@ GlyphCache* AbstractFont::doCreateGlyphCache() { CORRADE_ASSERT(false, "Text::AbstractFont::createGlyphCache(): feature advertised but not implemented", nullptr); } -AbstractLayouter* AbstractFont::layout(const GlyphCache* const cache, const Float size, const std::string& text) { +AbstractLayouter* AbstractFont::layout(const GlyphCache& cache, const Float size, const std::string& text) { CORRADE_ASSERT(isOpened(), "Text::AbstractFont::layout(): no font opened", nullptr); return doLayout(cache, size, text); diff --git a/src/Text/AbstractFont.h b/src/Text/AbstractFont.h index cf6a814bd..bab9763cd 100644 --- a/src/Text/AbstractFont.h +++ b/src/Text/AbstractFont.h @@ -175,7 +175,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * @ref Feature "Feature::PreparedGlyphCache" do not support partial * glyph cache filling, use createGlyphCache() instead. */ - void fillGlyphCache(GlyphCache* cache, const std::string& characters); + void fillGlyphCache(GlyphCache& cache, const std::string& characters); /** * @brief Create glyph cache @@ -195,7 +195,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * * @see fillGlyphCache(), createGlyphCache() */ - AbstractLayouter* layout(const GlyphCache* cache, Float size, const std::string& text); + AbstractLayouter* layout(const GlyphCache& cache, Float size, const std::string& text); #ifdef DOXYGEN_GENERATING_OUTPUT private: @@ -251,7 +251,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * The string is converted from UTF-8 to UTF-32, unique characters are * *not* removed. */ - virtual void doFillGlyphCache(GlyphCache* cache, const std::u32string& characters); + virtual void doFillGlyphCache(GlyphCache& cache, const std::u32string& characters); /** * @brief Implementation for createGlyphCache() @@ -259,7 +259,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { virtual GlyphCache* doCreateGlyphCache(); /** @brief Implementation for layout() */ - virtual AbstractLayouter* doLayout(const GlyphCache* cache, Float size, const std::string& text) = 0; + virtual AbstractLayouter* doLayout(const GlyphCache& cache, Float size, const std::string& text) = 0; }; CORRADE_ENUMSET_OPERATORS(AbstractFont::Features) diff --git a/src/Text/AbstractFontConverter.cpp b/src/Text/AbstractFontConverter.cpp index 94c626c31..8487a0f61 100644 --- a/src/Text/AbstractFontConverter.cpp +++ b/src/Text/AbstractFontConverter.cpp @@ -36,14 +36,14 @@ AbstractFontConverter::AbstractFontConverter() = default; AbstractFontConverter::AbstractFontConverter(PluginManager::AbstractManager* manager, std::string plugin): PluginManager::AbstractPlugin(manager, std::move(plugin)) {} -std::vector>> AbstractFontConverter::exportFontToData(AbstractFont* const font, GlyphCache* const cache, const std::string& filename, const std::string& characters) const { +std::vector>> AbstractFontConverter::exportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const { CORRADE_ASSERT(features() >= (Feature::ExportFont|Feature::ConvertData), "Text::AbstractFontConverter::exportFontToData(): feature not supported", {}); return doExportFontToData(font, cache, filename, uniqueUnicode(characters)); } -std::vector>> AbstractFontConverter::doExportFontToData(AbstractFont* const font, GlyphCache* const cache, const std::string& filename, const std::u32string& characters) const { +std::vector>> AbstractFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const { CORRADE_ASSERT(!(features() & Feature::MultiFile), "Text::AbstractFontConverter::exportFontToData(): feature advertised but not implemented", {}); @@ -52,7 +52,7 @@ std::vector>> AbstractFo return std::move(out); } -Containers::Array AbstractFontConverter::exportFontToSingleData(AbstractFont* const font, GlyphCache* const cache, const std::string& characters) const { +Containers::Array AbstractFontConverter::exportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::string& characters) const { CORRADE_ASSERT(features() >= (Feature::ExportFont|Feature::ConvertData), "Text::AbstractFontConverter::exportFontToSingleData(): feature not supported", nullptr); CORRADE_ASSERT(!(features() & Feature::MultiFile), @@ -61,19 +61,19 @@ Containers::Array AbstractFontConverter::exportFontToSingleData(A return doExportFontToSingleData(font, cache, uniqueUnicode(characters)); } -Containers::Array AbstractFontConverter::doExportFontToSingleData(AbstractFont*, GlyphCache*, const std::u32string&) const { +Containers::Array AbstractFontConverter::doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string&) const { CORRADE_ASSERT(false, "Text::AbstractFontConverter::exportFontToSingleData(): feature advertised but not implemented", nullptr); } -bool AbstractFontConverter::exportFontToFile(AbstractFont* const font, GlyphCache* const cache, const std::string& filename, const std::string& characters) const { +bool AbstractFontConverter::exportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const { CORRADE_ASSERT(features() & Feature::ExportFont, "Text::AbstractFontConverter::exportFontToFile(): feature not supported", false); return doExportFontToFile(font, cache, filename, uniqueUnicode(characters)); } -bool AbstractFontConverter::doExportFontToFile(AbstractFont* const font, GlyphCache* const cache, const std::string& filename, const std::u32string& characters) const { +bool AbstractFontConverter::doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const { CORRADE_ASSERT(features() & Feature::ConvertData, "Text::AbstractFontConverter::exportFontToFile(): not implemented", false); @@ -94,14 +94,14 @@ bool AbstractFontConverter::doExportFontToFile(AbstractFont* const font, GlyphCa return true; } -std::vector>> AbstractFontConverter::exportGlyphCacheToData(GlyphCache* cache, const std::string& filename) const { +std::vector>> AbstractFontConverter::exportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const { CORRADE_ASSERT(features() >= (Feature::ExportGlyphCache|Feature::ConvertData), "Text::AbstractFontConverter::exportGlyphCacheToData(): feature not supported", {}); return doExportGlyphCacheToData(cache, filename); } -std::vector>> AbstractFontConverter::doExportGlyphCacheToData(GlyphCache* cache, const std::string& filename) const { +std::vector>> AbstractFontConverter::doExportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const { CORRADE_ASSERT(!(features() & Feature::MultiFile), "Text::AbstractFontConverter::exportGlyphCacheToData(): feature advertised but not implemented", {}); @@ -110,7 +110,7 @@ std::vector>> AbstractFo return std::move(out); } -Containers::Array AbstractFontConverter::exportGlyphCacheToSingleData(GlyphCache* cache) const { +Containers::Array AbstractFontConverter::exportGlyphCacheToSingleData(GlyphCache& cache) const { CORRADE_ASSERT(features() >= (Feature::ExportGlyphCache|Feature::ConvertData), "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): feature not supported", nullptr); CORRADE_ASSERT(!(features() & Feature::MultiFile), @@ -119,19 +119,19 @@ Containers::Array AbstractFontConverter::exportGlyphCacheToSingle return doExportGlyphCacheToSingleData(cache); } -Containers::Array AbstractFontConverter::doExportGlyphCacheToSingleData(GlyphCache*) const { +Containers::Array AbstractFontConverter::doExportGlyphCacheToSingleData(GlyphCache&) const { CORRADE_ASSERT(false, "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): feature advertised but not implemented", nullptr); } -bool AbstractFontConverter::exportGlyphCacheToFile(GlyphCache* cache, const std::string& filename) const { +bool AbstractFontConverter::exportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const { CORRADE_ASSERT(features() & Feature::ExportGlyphCache, "Text::AbstractFontConverter::exportGlyphCacheToFile(): feature not supported", false); return doExportGlyphCacheToFile(cache, filename); } -bool AbstractFontConverter::doExportGlyphCacheToFile(GlyphCache* cache, const std::string& filename) const { +bool AbstractFontConverter::doExportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const { CORRADE_ASSERT(features() & Feature::ConvertData, "Text::AbstractFontConverter::exportGlyphCacheToFile(): not implemented", false); diff --git a/src/Text/AbstractFontConverter.h b/src/Text/AbstractFontConverter.h index c4508a7c0..2ea3c0aad 100644 --- a/src/Text/AbstractFontConverter.h +++ b/src/Text/AbstractFontConverter.h @@ -130,7 +130,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * in that case. * @see features(), exportFontToFile(), exportGlyphCacheToData() */ - std::vector>> exportFontToData(AbstractFont* font, GlyphCache* cache, const std::string& filename, const std::string& characters) const; + std::vector>> exportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const; /** * @brief Export font to single raw data @@ -142,7 +142,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * more information. * @see features(), exportFontToFile(), importFromSingleData() */ - Containers::Array exportFontToSingleData(AbstractFont* font, GlyphCache* cache, const std::string& characters) const; + Containers::Array exportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::string& characters) const; /** * @brief Export font to file @@ -154,7 +154,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * `false` otherwise. See exportFontToData() for more information. * @see features(), exportFontToData(), exportGlyphCacheToFile() */ - bool exportFontToFile(AbstractFont* font, GlyphCache* cache, const std::string& filename, const std::string& characters) const; + bool exportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::string& characters) const; /** * @brief Export glyph cache to raw data @@ -173,7 +173,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * smaller subset, fill the cache with less characters. * @see features(), exportGlyphCacheToFile(), exportFontToData() */ - std::vector>> exportGlyphCacheToData(GlyphCache* cache, const std::string& filename) const; + std::vector>> exportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const; /** * @brief Export glyph cache to single raw data @@ -185,7 +185,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * for more information. * @see features(), exportGlyphCacheToFile(), importGlyphCacheFromSingleData() */ - Containers::Array exportGlyphCacheToSingleData(GlyphCache* cache) const; + Containers::Array exportGlyphCacheToSingleData(GlyphCache& cache) const; /** * @brief Export glyph cache to file @@ -197,7 +197,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * `false` otherwise. * @see features(), exportGlyphCacheToData(), exportFontToFile() */ - bool exportGlyphCacheToFile(GlyphCache* cache, const std::string& filename) const; + bool exportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const; /** * @brief Import glyph cache from raw data @@ -251,10 +251,10 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * If the plugin doesn't have @ref Feature "Feature::MultiFile", * default implementation calls doExportFontToSingleData(). */ - virtual std::vector>> doExportFontToData(AbstractFont* font, GlyphCache* cache, const std::string& filename, const std::u32string& characters) const; + virtual std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const; /** @brief Implementation for exportFontToSingleData() */ - virtual Containers::Array doExportFontToSingleData(AbstractFont* font, GlyphCache* cache, const std::u32string& characters) const; + virtual Containers::Array doExportFontToSingleData(AbstractFont& font, GlyphCache& cache, const std::u32string& characters) const; /** * @brief Implementation for exportFontToFile() @@ -263,7 +263,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * implementation calls doExportFontToData() and saves the result to * given file(s). */ - virtual bool doExportFontToFile(AbstractFont* font, GlyphCache* cache, const std::string& filename, const std::u32string& characters) const; + virtual bool doExportFontToFile(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const; /** * @brief Implementation for exportGlyphCacheToData() @@ -271,10 +271,10 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * If the plugin doesn't have @ref Feature "Feature::MultiFile", * default implementation calls doExportGlyphCacheToSingleData(). */ - virtual std::vector>> doExportGlyphCacheToData(GlyphCache* cache, const std::string& filename) const; + virtual std::vector>> doExportGlyphCacheToData(GlyphCache& cache, const std::string& filename) const; /** @brief Implementation for exportGlyphCacheToSingleData() */ - virtual Containers::Array doExportGlyphCacheToSingleData(GlyphCache* cache) const; + virtual Containers::Array doExportGlyphCacheToSingleData(GlyphCache& cache) const; /** * @brief Implementation for exportGlyphCacheToFile() @@ -283,7 +283,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * implementation calls doExportGlyphCacheToData() and saves the result * to given file(s). */ - virtual bool doExportGlyphCacheToFile(GlyphCache* cache, const std::string& filename) const; + virtual bool doExportGlyphCacheToFile(GlyphCache& cache, const std::string& filename) const; /** * @brief Implementation for importGlyphCacheFromData() diff --git a/src/Text/DistanceFieldGlyphCache.cpp b/src/Text/DistanceFieldGlyphCache.cpp index 18dd71ff1..476ee61b7 100644 --- a/src/Text/DistanceFieldGlyphCache.cpp +++ b/src/Text/DistanceFieldGlyphCache.cpp @@ -80,7 +80,7 @@ void DistanceFieldGlyphCache::setImage(const Vector2i& offset, const ImageRefere .setImage(0, internalFormat, image); /* Create distance field from input texture */ - TextureTools::distanceField(&input, texture(), Rectanglei::fromSize(offset*scale, image.size()*scale), radius, image.size()); + TextureTools::distanceField(input, texture(), Rectanglei::fromSize(offset*scale, image.size()*scale), radius, image.size()); } void DistanceFieldGlyphCache::setDistanceFieldImage(const Vector2i& offset, const ImageReference2D& image) { @@ -97,7 +97,7 @@ void DistanceFieldGlyphCache::setDistanceFieldImage(const Vector2i& offset, cons "Text::DistanceFieldGlyphCache::setDistanceFieldImage(): expected" << ImageFormat::RGB << "but got" << image.format(), ); #endif - texture()->setSubImage(0, offset, image); + texture().setSubImage(0, offset, image); } }} diff --git a/src/Text/GlyphCache.h b/src/Text/GlyphCache.h index e0d8a7f0c..e587bf410 100644 --- a/src/Text/GlyphCache.h +++ b/src/Text/GlyphCache.h @@ -114,7 +114,7 @@ class MAGNUM_TEXT_EXPORT GlyphCache { std::size_t glyphCount() const { return glyphs.size(); } /** @brief Cache texture */ - Texture2D* texture() { return &_texture; } + Texture2D& texture() { return _texture; } /** * @brief Parameters of given glyph diff --git a/src/Text/Test/AbstractFontConverterTest.cpp b/src/Text/Test/AbstractFontConverterTest.cpp index 5aedd2830..643f45242 100644 --- a/src/Text/Test/AbstractFontConverterTest.cpp +++ b/src/Text/Test/AbstractFontConverterTest.cpp @@ -70,7 +70,7 @@ void AbstractFontConverterTest::convertGlyphs() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont; } - Containers::Array doExportFontToSingleData(AbstractFont*, GlyphCache*, const std::u32string& characters) const override { + Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string& characters) const override { this->characters = characters; return nullptr; } @@ -80,7 +80,7 @@ void AbstractFontConverterTest::convertGlyphs() { std::u32string characters; GlyphExporter exporter(characters); - exporter.exportFontToSingleData(nullptr, nullptr, "abC01a0 "); + exporter.exportFontToSingleData(*static_cast(nullptr), *static_cast(nullptr), "abC01a0 "); CORRADE_COMPARE(characters, (std::u32string{ U' ', U'0', U'1', U'C', U'a', U'b'})); } @@ -90,7 +90,7 @@ void AbstractFontConverterTest::exportFontToSingleData() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont; } - Containers::Array doExportFontToSingleData(AbstractFont*, GlyphCache*, const std::u32string&) const override { + Containers::Array doExportFontToSingleData(AbstractFont&, GlyphCache&, const std::u32string&) const override { Containers::Array data(1); data[0] = 0xee; return std::move(data); @@ -99,7 +99,7 @@ void AbstractFontConverterTest::exportFontToSingleData() { /* doExportFontToData() should call doExportFontToSingleData() */ SingleDataExporter exporter; - auto ret = exporter.exportFontToData(nullptr, nullptr, "font.out", {}); + auto ret = exporter.exportFontToData(*static_cast(nullptr), *static_cast(nullptr), "font.out", {}); CORRADE_COMPARE(ret.size(), 1); CORRADE_COMPARE(ret[0].first, "font.out"); CORRADE_COMPARE(ret[0].second.size(), 1); @@ -111,7 +111,7 @@ void AbstractFontConverterTest::exportFontToFile() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportFont|Feature::MultiFile; } - std::vector>> doExportFontToData(AbstractFont*, GlyphCache*, const std::string& filename, const std::u32string&) const override { + std::vector>> doExportFontToData(AbstractFont&, GlyphCache&, const std::string& filename, const std::u32string&) const override { Containers::Array file(1); file[0] = 0xf0; @@ -132,7 +132,7 @@ void AbstractFontConverterTest::exportFontToFile() { /* doExportToFile() should call doExportToData() */ DataExporter exporter; - bool exported = exporter.exportFontToFile(nullptr, nullptr, Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "font.out"), {}); + bool exported = exporter.exportFontToFile(*static_cast(nullptr), *static_cast(nullptr), Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "font.out"), {}); CORRADE_VERIFY(exported); CORRADE_COMPARE_AS(Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "font.out"), "\xf0", TestSuite::Compare::FileToString); @@ -145,7 +145,7 @@ void AbstractFontConverterTest::exportGlyphCacheToSingleData() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportGlyphCache; } - Containers::Array doExportGlyphCacheToSingleData(GlyphCache*) const override { + Containers::Array doExportGlyphCacheToSingleData(GlyphCache&) const override { Containers::Array data(1); data[0] = 0xee; return std::move(data); @@ -154,7 +154,7 @@ void AbstractFontConverterTest::exportGlyphCacheToSingleData() { /* doExportGlyphCacheToData() should call doExportGlyphCacheToSingleData() */ SingleDataExporter exporter; - auto ret = exporter.exportGlyphCacheToData(nullptr, "font.out"); + auto ret = exporter.exportGlyphCacheToData(*static_cast(nullptr), "font.out"); CORRADE_COMPARE(ret.size(), 1); CORRADE_COMPARE(ret[0].first, "font.out"); CORRADE_COMPARE(ret[0].second.size(), 1); @@ -166,7 +166,7 @@ void AbstractFontConverterTest::exportGlyphCacheToFile() { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ExportGlyphCache|Feature::MultiFile; } - std::vector>> doExportGlyphCacheToData(GlyphCache*, const std::string& filename) const override { + std::vector>> doExportGlyphCacheToData(GlyphCache&, const std::string& filename) const override { Containers::Array file(1); file[0] = 0xf0; @@ -187,7 +187,7 @@ void AbstractFontConverterTest::exportGlyphCacheToFile() { /* doExportGlyphCacheToFile() should call doExportGlyphCacheToData() */ DataExporter exporter; - bool exported = exporter.exportGlyphCacheToFile(nullptr, Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "glyphcache.out")); + bool exported = exporter.exportGlyphCacheToFile(*static_cast(nullptr), Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "glyphcache.out")); CORRADE_VERIFY(exported); CORRADE_COMPARE_AS(Utility::Directory::join(TEXT_TEST_OUTPUT_DIR, "glyphcache.out"), "\xf0", TestSuite::Compare::FileToString); diff --git a/src/Text/Test/AbstractFontTest.cpp b/src/Text/Test/AbstractFontTest.cpp index ae5bf4932..1a927ea3e 100644 --- a/src/Text/Test/AbstractFontTest.cpp +++ b/src/Text/Test/AbstractFontTest.cpp @@ -63,7 +63,7 @@ class SingleDataFont: public Text::AbstractFont { Vector2 doGlyphAdvance(UnsignedInt) override { return {}; } - AbstractLayouter* doLayout(const GlyphCache*, Float, const std::string&) { + AbstractLayouter* doLayout(const GlyphCache&, Float, const std::string&) override { return nullptr; } diff --git a/src/Text/Test/GlyphCacheGLTest.cpp b/src/Text/Test/GlyphCacheGLTest.cpp index 0e2b42874..61790a90e 100644 --- a/src/Text/Test/GlyphCacheGLTest.cpp +++ b/src/Text/Test/GlyphCacheGLTest.cpp @@ -47,7 +47,7 @@ void GlyphCacheGLTest::initialize() { MAGNUM_VERIFY_NO_ERROR(); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(cache.texture()->imageSize(0), Vector2i(1024, 2048)); + CORRADE_COMPARE(cache.texture().imageSize(0), Vector2i(1024, 2048)); #endif } diff --git a/src/Text/Test/TextRendererGLTest.cpp b/src/Text/Test/TextRendererGLTest.cpp index fdfc9f5c8..13ed94b10 100644 --- a/src/Text/Test/TextRendererGLTest.cpp +++ b/src/Text/Test/TextRendererGLTest.cpp @@ -73,7 +73,7 @@ class TestFont: public Text::AbstractFont { UnsignedInt doGlyphId(char32_t) override { return 0; } Vector2 doGlyphAdvance(UnsignedInt) override { return {}; } - AbstractLayouter* doLayout(const GlyphCache*, Float size, const std::string& text) override { + AbstractLayouter* doLayout(const GlyphCache&, Float size, const std::string& text) override { return new TestLayouter(size, text.size()); } }; @@ -86,7 +86,7 @@ void TextRendererGLTest::renderData() { std::vector textureCoordinates; std::vector indices; Rectangle bounds; - std::tie(positions, textureCoordinates, indices, bounds) = Text::AbstractTextRenderer::render(&font, nullptr, 0.25f, "abc"); + std::tie(positions, textureCoordinates, indices, bounds) = Text::AbstractTextRenderer::render(font, *static_cast(nullptr), 0.25f, "abc"); /* Three glyphs, three quads -> 12 vertices, 18 indices */ CORRADE_COMPARE(positions.size(), 12); @@ -165,7 +165,7 @@ void TextRendererGLTest::renderMesh() { Mesh mesh; Buffer vertexBuffer, indexBuffer; Rectangle bounds; - std::tie(mesh, bounds) = Text::TextRenderer3D::render(&font, nullptr, 0.25f, "abc", &vertexBuffer, &indexBuffer, Buffer::Usage::StaticDraw); + std::tie(mesh, bounds) = Text::TextRenderer3D::render(font, *static_cast(nullptr), 0.25f, "abc", vertexBuffer, indexBuffer, Buffer::Usage::StaticDraw); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to verify this on ES? */ @@ -203,7 +203,7 @@ void TextRendererGLTest::renderMesh() { void TextRendererGLTest::mutableText() { TestFont font; - Text::TextRenderer2D renderer(&font, nullptr, 0.25f); + Text::TextRenderer2D renderer(font, *static_cast(nullptr), 0.25f); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(renderer.capacity(), 0); CORRADE_COMPARE(renderer.rectangle(), Rectangle()); @@ -214,7 +214,7 @@ void TextRendererGLTest::mutableText() { CORRADE_COMPARE(renderer.capacity(), 4); /** @todo How to verify this on ES? */ #ifndef MAGNUM_TARGET_GLES - Containers::Array indices = renderer.indexBuffer()->data(); + Containers::Array indices = renderer.indexBuffer().data(); CORRADE_COMPARE(std::vector(indices.begin(), indices.end()), (std::vector{ 0, 1, 2, 1, 3, 2, 4, 5, 6, 5, 7, 6, @@ -228,7 +228,7 @@ void TextRendererGLTest::mutableText() { MAGNUM_VERIFY_NO_ERROR(); /** @todo How to verify this on ES? */ #ifndef MAGNUM_TARGET_GLES - Containers::Array vertices = renderer.vertexBuffer()->subData(0, 48); + Containers::Array vertices = renderer.vertexBuffer().subData(0, 48); CORRADE_COMPARE(std::vector(vertices.begin(), vertices.end()), (std::vector{ 0.0f, 0.5f, 0.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, diff --git a/src/Text/TextRenderer.cpp b/src/Text/TextRenderer.cpp index 12d977741..b263e6587 100644 --- a/src/Text/TextRenderer.cpp +++ b/src/Text/TextRenderer.cpp @@ -60,8 +60,8 @@ struct Vertex { } -std::tuple, std::vector, std::vector, Rectangle> AbstractTextRenderer::render(AbstractFont* const font, const GlyphCache* const cache, Float size, const std::string& text) { - AbstractLayouter* const layouter = font->layout(cache, size, text); +std::tuple, std::vector, std::vector, Rectangle> AbstractTextRenderer::render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text) { + AbstractLayouter* const layouter = font.layout(cache, size, text); const UnsignedInt vertexCount = layouter->glyphCount()*4; /* Output data */ @@ -119,8 +119,8 @@ std::tuple, std::vector, std::vector, return std::make_tuple(std::move(positions), std::move(texcoords), std::move(indices), rectangle); } -std::tuple AbstractTextRenderer::render(AbstractFont* const font, const GlyphCache* const cache, Float size, const std::string& text, Buffer* vertexBuffer, Buffer* indexBuffer, Buffer::Usage usage) { - AbstractLayouter* const layouter = font->layout(cache, size, text); +std::tuple AbstractTextRenderer::render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text, Buffer& vertexBuffer, Buffer& indexBuffer, Buffer::Usage usage) { + AbstractLayouter* const layouter = font.layout(cache, size, text); const UnsignedInt vertexCount = layouter->glyphCount()*4; const UnsignedInt indexCount = layouter->glyphCount()*6; @@ -158,7 +158,7 @@ std::tuple AbstractTextRenderer::render(AbstractFont* const fon /* Advance cursor position to next character */ cursorPosition += advance; } - vertexBuffer->setData(vertices, usage); + vertexBuffer.setData(vertices, usage); /* Fill index buffer */ Mesh::IndexType indexType; @@ -180,7 +180,7 @@ std::tuple AbstractTextRenderer::render(AbstractFont* const fon indices = new char[indicesSize]; createIndices(indices, layouter->glyphCount()); } - indexBuffer->setData(indicesSize, indices, usage); + indexBuffer.setData(indicesSize, indices, usage); delete indices; /* Configure mesh except for vertex buffer (depends on dimension count, done @@ -194,7 +194,7 @@ std::tuple AbstractTextRenderer::render(AbstractFont* const fon return std::make_tuple(std::move(mesh), rectangle); } -template std::tuple TextRenderer::render(AbstractFont* const font, const GlyphCache* const cache, Float size, const std::string& text, Buffer* vertexBuffer, Buffer* indexBuffer, Buffer::Usage usage) { +template std::tuple TextRenderer::render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text, Buffer& vertexBuffer, Buffer& indexBuffer, Buffer::Usage usage) { /* Finalize mesh configuration and return the result */ auto r = AbstractTextRenderer::render(font, cache, size, text, vertexBuffer, indexBuffer, usage); Mesh& mesh = std::get<0>(r); @@ -240,7 +240,7 @@ void AbstractTextRenderer::bufferUnmapImplementationDefault(Buffer& buffer) buffer.unmap(); } -AbstractTextRenderer::AbstractTextRenderer(AbstractFont* const font, const GlyphCache* const cache, Float size): _vertexBuffer(Buffer::Target::Array), _indexBuffer(Buffer::Target::ElementArray), font(font), cache(cache), size(size), _capacity(0) { +AbstractTextRenderer::AbstractTextRenderer(AbstractFont& font, const GlyphCache& cache, Float size): _vertexBuffer(Buffer::Target::Array), _indexBuffer(Buffer::Target::ElementArray), font(font), cache(cache), size(size), _capacity(0) { #ifndef MAGNUM_TARGET_GLES MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::ARB::map_buffer_range); #elif defined(MAGNUM_TARGET_GLES2) @@ -264,9 +264,9 @@ AbstractTextRenderer::AbstractTextRenderer(AbstractFont* const font, const Glyph AbstractTextRenderer::~AbstractTextRenderer() {} -template TextRenderer::TextRenderer(AbstractFont* const font, const GlyphCache* const cache, const Float size): AbstractTextRenderer(font, cache, size) { +template TextRenderer::TextRenderer(AbstractFont& font, const GlyphCache& cache, const Float size): AbstractTextRenderer(font, cache, size) { /* Finalize mesh configuration */ - _mesh.addInterleavedVertexBuffer(&_vertexBuffer, 0, + _mesh.addInterleavedVertexBuffer(_vertexBuffer, 0, typename Shaders::AbstractVector::Position(Shaders::AbstractVector::Position::Components::Two), typename Shaders::AbstractVector::TextureCoordinates()); } @@ -296,7 +296,7 @@ void AbstractTextRenderer::reserve(const uint32_t glyphCount, const Buffer::Usag } _indexBuffer.setData(indicesSize, nullptr, indexBufferUsage); _mesh.setIndexCount(0) - .setIndexBuffer(&_indexBuffer, 0, indexType, 0, vertexCount); + .setIndexBuffer(_indexBuffer, 0, indexType, 0, vertexCount); /* Map buffer for filling */ void* const indices = bufferMapImplementation(_indexBuffer, indicesSize); @@ -313,7 +313,7 @@ void AbstractTextRenderer::reserve(const uint32_t glyphCount, const Buffer::Usag } void AbstractTextRenderer::render(const std::string& text) { - AbstractLayouter* layouter = font->layout(cache, size, text); + AbstractLayouter* layouter = font.layout(cache, size, text); CORRADE_ASSERT(layouter->glyphCount() <= _capacity, "Text::TextRenderer::render(): capacity" << _capacity << "too small to render" << layouter->glyphCount() << "glyphs", ); diff --git a/src/Text/TextRenderer.h b/src/Text/TextRenderer.h index 7e03902ba..02c05da66 100644 --- a/src/Text/TextRenderer.h +++ b/src/Text/TextRenderer.h @@ -60,7 +60,7 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { * Returns tuple with vertex positions, texture coordinates, indices * and rectangle spanning the rendered text. */ - static std::tuple, std::vector, std::vector, Rectangle> render(AbstractFont* font, const GlyphCache* cache, Float size, const std::string& text); + static std::tuple, std::vector, std::vector, Rectangle> render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text); /** * @brief Capacity for rendered glyphs @@ -73,13 +73,13 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { Rectangle rectangle() const { return _rectangle; } /** @brief Vertex buffer */ - Buffer* vertexBuffer() { return &_vertexBuffer; } + Buffer& vertexBuffer() { return _vertexBuffer; } /** @brief Index buffer */ - Buffer* indexBuffer() { return &_indexBuffer; } + Buffer& indexBuffer() { return _indexBuffer; } /** @brief Mesh */ - Mesh* mesh() { return &_mesh; } + Mesh& mesh() { return _mesh; } /** * @brief Reserve capacity for rendered glyphs @@ -115,7 +115,8 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { * @param cache Glyph cache * @param size Font size */ - explicit AbstractTextRenderer(AbstractFont* font, const GlyphCache* cache, Float size); + explicit AbstractTextRenderer(AbstractFont& font, const GlyphCache& cache, Float size); + AbstractTextRenderer(AbstractFont&, GlyphCache&&, Float) = delete; /**< @overload */ ~AbstractTextRenderer(); @@ -124,14 +125,14 @@ class MAGNUM_TEXT_EXPORT AbstractTextRenderer { #else private: #endif - static std::tuple MAGNUM_LOCAL render(AbstractFont* font, const GlyphCache* cache, Float size, const std::string& text, Buffer* vertexBuffer, Buffer* indexBuffer, Buffer::Usage usage); + static std::tuple MAGNUM_LOCAL render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text, Buffer& vertexBuffer, Buffer& indexBuffer, Buffer::Usage usage); Mesh _mesh; Buffer _vertexBuffer, _indexBuffer; private: - AbstractFont* const font; - const GlyphCache* const cache; + AbstractFont& font; + const GlyphCache& cache; Float size; UnsignedInt _capacity; Rectangle _rectangle; @@ -178,7 +179,7 @@ Mesh mesh; // Render the text Rectangle rectangle; -std::tie(mesh, rectangle) = Text::TextRenderer2D::render(font, cache, 0.15f, +std::tie(mesh, rectangle) = Text::TextRenderer2D::render(*font, cache, 0.15f, "Hello World!", vertexBuffer, indexBuffer, Buffer::Usage::StaticDraw); // Draw white text centered on the screen @@ -201,7 +202,7 @@ Text::GlyphCache cache; Shaders::VectorShader2D shader; // Initialize renderer and reserve memory for enough glyphs -Text::TextRenderer2D renderer(font, cache, 0.15f); +Text::TextRenderer2D renderer(*font, cache, 0.15f); renderer.reserve(32, Buffer::Usage::DynamicDraw, Buffer::Usage::StaticDraw); // Update the text occasionally @@ -239,7 +240,7 @@ template class MAGNUM_TEXT_EXPORT TextRenderer: public A * Returns mesh prepared for use with Shaders::AbstractVectorShader * subclasses and rectangle spanning the rendered text. */ - static std::tuple render(AbstractFont* const font, const GlyphCache* const cache, Float size, const std::string& text, Buffer* vertexBuffer, Buffer* indexBuffer, Buffer::Usage usage); + static std::tuple render(AbstractFont& font, const GlyphCache& cache, Float size, const std::string& text, Buffer& vertexBuffer, Buffer& indexBuffer, Buffer::Usage usage); /** * @brief Constructor @@ -247,7 +248,8 @@ template class MAGNUM_TEXT_EXPORT TextRenderer: public A * @param cache Glyph cache * @param size Font size */ - explicit TextRenderer(AbstractFont* const font, const GlyphCache* const cache, Float size); + explicit TextRenderer(AbstractFont& font, const GlyphCache& cache, Float size); + TextRenderer(AbstractFont&, GlyphCache&&, Float) = delete; /**< @overload */ using AbstractTextRenderer::render; }; From d44f6ee94e526652ef6962ba1b4d147b9f86459f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 19:25:50 +0200 Subject: [PATCH 85/90] Add pointer conversion operator to Resource. Unlike reference conversion this doesn't fire assertion when resource is not loaded. --- src/Resource.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Resource.h b/src/Resource.h index be5619d45..03421eb6c 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -177,6 +177,16 @@ class Resource { return data; } + /** + * @brief Pointer to resource data + * + * Returns `nullptr` if the resource is not loaded. + */ + operator U*() { + acquire(); + return static_cast(data); + } + /** * @brief Reference to resource data * From 6ff4b06095d01a270ac66211ab444e57e863f232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Aug 2013 19:26:39 +0200 Subject: [PATCH 86/90] SceneGraph: add just-to-be-sure assertion. Now we have references all over the place, let's trust pointers even less. --- src/SceneGraph/Object.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index f2a2bf2d9..67ee09f69 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -163,6 +163,7 @@ template void Object::setClean() { template auto Object::doTransformationMatrices(const std::vector*>& objects, const MatrixType& initialTransformationMatrix) const -> std::vector { std::vector*> castObjects(objects.size()); for(std::size_t i = 0; i != objects.size(); ++i) + /* Non-null is checked in transformations() */ /** @todo Ensure this doesn't crash, somehow */ castObjects[i] = static_cast*>(objects[i]); @@ -201,6 +202,8 @@ template std::vector Ob /* Mark all original objects as joints and create initial list of joints from them */ for(std::size_t i = 0; i != objects.size(); ++i) { + CORRADE_INTERNAL_ASSERT(objects[i]); + /* Multiple occurences of one object in the array, don't overwrite it with different counter */ if(objects[i]->counter != 0xFFFFu) continue; From 2287e3d73effe17610b85cd25edbac6a8a7e29b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 2 Aug 2013 20:10:24 +0200 Subject: [PATCH 87/90] Doc++ --- doc/scenegraph.dox | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index 83cc9fe9e..3d59a8849 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -119,11 +119,12 @@ The object itself handles only parent/child relationship and transformation. To make the object renderable, animatable, add collision shape to it etc., you have to add a *feature* to it. -Each feature takes pointer to holder object in constructor, so adding a -feature to an object might look like this: +Each feature takes reference to holder object in constructor, so adding a +feature to an object might look just like this, as in some cases you don't even +need to keep the pointer to it: @code Object3D* o; -auto feature = new MyFeature(o); +new MyFeature(o); @endcode Features of an object can be accessed using Object::firstFeature() and From 41fd952e4af6acf55c1ff6ef951cb962ca21d915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 3 Aug 2013 11:51:30 +0200 Subject: [PATCH 88/90] OpenGL ES build fixes. --- src/AbstractFramebuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index 7edcd23d6..cd0497be5 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/AbstractFramebuffer.cpp @@ -212,20 +212,20 @@ void AbstractFramebuffer::initializeContextBasedFunctionality(Context& context) readTarget = FramebufferTarget::Read; drawTarget = FramebufferTarget::Draw; - if(context->isExtensionSupported()) + if(context.isExtensionSupported()) Debug() << "AbstractFramebuffer: using" << Extensions::GL::ANGLE::framebuffer_blit::string() << "features"; - else if(context->isExtensionSupported()) + else if(context.isExtensionSupported()) Debug() << "AbstractFramebuffer: using" << Extensions::GL::APPLE::framebuffer_multisample::string() << "features"; - else if(context->isExtensionSupported()) + else if(context.isExtensionSupported()) Debug() << "AbstractFramebuffer: using" << Extensions::GL::NV::framebuffer_blit::string() << "features"; /* NV_framebuffer_multisample requires NV_framebuffer_blit, which has these enums. However, on my system only NV_framebuffer_multisample is supported, but NV_framebuffer_blit isn't. I will hold my breath and assume these enums are available. */ - else if(context->isExtensionSupported()) + else if(context.isExtensionSupported()) Debug() << "AbstractFramebuffer: using" << Extensions::GL::NV::framebuffer_multisample::string() << "features"; /* If no such extension is available, reset back to unified target */ From 7eec63afd018e08c6f2fbe14f2db853f0c1f6c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 3 Aug 2013 14:56:24 +0200 Subject: [PATCH 89/90] Build fix. I have NO IDEA how this did compile and work. --- src/Test/BufferGLTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Test/BufferGLTest.cpp b/src/Test/BufferGLTest.cpp index fc21ff125..ebd9b1bf5 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -256,7 +256,7 @@ void BufferGLTest::copy() { Buffer buffer2; buffer2.setData(5, nullptr, Buffer::Usage::StaticDraw); - Buffer::copy(&buffer1, &buffer2, 1, 2, 3); + Buffer::copy(buffer1, buffer2, 1, 2, 3); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to verify the contents in ES? */ From 1102232a2477ac34ca946cf986192b7c50e3909e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 3 Aug 2013 14:57:09 +0200 Subject: [PATCH 90/90] GCC 4.6 compatibility: no delegating constructors. --- src/SceneGraph/AbstractFeature.h | 9 ++++++++- src/SceneGraph/Camera2D.h | 7 ++++++- src/SceneGraph/Camera3D.h | 7 ++++++- src/Test/ArrayTest.cpp | 4 ++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index decaf76b7..27aed780a 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -180,7 +180,14 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac /* This is here to avoid ambiguity with deleted copy constructor when passing `*this` from class subclassing both AbstractFeature and AbstractObject */ - template, U>::value>::type> AbstractFeature(U& object): AbstractFeature(static_cast&>(object)) {} + template, U>::value>::type> AbstractFeature(U& object) + #ifndef CORRADE_GCC46_COMPATIBILITY + : AbstractFeature(static_cast&>(object)) {} + #else + { + object.Containers::template LinkedList>::insert(this); + } + #endif #endif virtual ~AbstractFeature() = 0; diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index d1be4b0db..b11be1474 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -71,7 +71,12 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D: public AbstractC /* This is here to avoid ambiguity with deleted copy constructor when passing `*this` from class subclassing both BasicCamera2D and AbstractObject */ - template, U>::value>::type> BasicCamera2D(U& object): BasicCamera2D(static_cast&>(object)) {} + template, U>::value>::type> BasicCamera2D(U& object): + #ifndef CORRADE_GCC46_COMPATIBILITY + BasicCamera2D(static_cast&>(object)) {} + #else + AbstractCamera<2, T>(static_cast&>(object)) {} + #endif #endif /** diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 6d6c665f4..2b1c430e1 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -73,7 +73,12 @@ template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D: public AbstractC /* This is here to avoid ambiguity with deleted copy constructor when passing `*this` from class subclassing both BasicCamera3D and AbstractObject */ - template, U>::value>::type> BasicCamera3D(U& object): BasicCamera3D(static_cast&>(object)) {} + template, U>::value>::type> BasicCamera3D(U& object): + #ifndef CORRADE_GCC46_COMPATIBILITY + BasicCamera3D(static_cast&>(object)) {} + #else + AbstractCamera<3, T>(static_cast&>(object)) {} + #endif #endif /** diff --git a/src/Test/ArrayTest.cpp b/src/Test/ArrayTest.cpp index 69ade4dfe..1a677aa33 100644 --- a/src/Test/ArrayTest.cpp +++ b/src/Test/ArrayTest.cpp @@ -51,7 +51,11 @@ void ArrayTest::construct() { constexpr Array<3, Int> a = {5, 6, 7}; CORRADE_COMPARE(a, (Array<3, Int>(5, 6, 7))); + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Array<3, Int> a2 = 5; + #else + Array<3, Int> a2 = 5; /* Not constexpr under GCC < 4.7 */ + #endif CORRADE_COMPARE(a2, (Array<3, Int>(5, 5, 5))); constexpr Array1D b = 5;