From c3de32e55fcbe065ba5558102eaa78e7c6d221d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 3 Jul 2013 17:46:29 +0200 Subject: [PATCH] Getting rid of <>, part 7: documentation. --- doc/scenegraph.dox | 22 ++++++++++------------ src/SceneGraph/AbstractFeature.h | 17 ++++++++--------- src/SceneGraph/Animable.h | 6 +++--- src/SceneGraph/Camera2D.h | 2 +- src/SceneGraph/Camera3D.h | 2 +- src/SceneGraph/Drawable.h | 4 ++-- src/SceneGraph/Object.h | 4 ++-- src/Text/TextRenderer.h | 4 ++-- 8 files changed, 29 insertions(+), 32 deletions(-) diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index f20938241..e72d7cf42 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -45,13 +45,11 @@ main components: @section scenegraph-transformation Transformations Transformation handles object position, rotation etc. and its basic property -is dimension count (2D or 3D) and underlying floating-point type (by default -@ref Float type is used everywhere, but you can use @ref Double too). +is dimension count (2D or 3D) and underlying floating-point type. -@note All classes in SceneGraph have Float as default underlying floating-point - type, which means that you can omit that template parameter and write just - %AbstractObject<2> or %MatrixTransformation3D<> instead of - %AbstractObject<2, Float> and %MatrixTransformation3D<Float>. +@note All classes in SceneGraph are templated on underlying type. However, in + most cases Float is used and thus nearly all classes have convenience + aliases so you don't have to explicitly specify it. %Scene graph has implementation of transformations in both 2D and 3D, using either matrices or combination of position and rotation. Each implementation @@ -74,8 +72,8 @@ in 2D and part in 3D just wouldn't make sense). Common usage is to typedef %Scene and %Object with desired transformation type to save unnecessary typing later: @code -typedef SceneGraph::Scene> Scene3D; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Scene Scene3D; +typedef SceneGraph::Object Object3D; @endcode Then you can start building the hierarchy by *parenting* one object to another. @@ -149,9 +147,9 @@ implement needed functions in your own Object subclass without having to subclass each feature individually (and making the code overly verbose). Simplified example: @code -class Bomb: public Object3D, SceneGraph::Drawable3D<>, SceneGraph:.Animable3D<> { +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,9 +193,9 @@ it first, because by default the caching is disabled. You can enable it using AbstractFeature::setCachedTransformations() and then implement corresponding cleaning function(s): @code -class CachingObject: public Object3D, SceneGraph::AbstractFeature3D<> { +class CachingObject: public Object3D, SceneGraph::AbstractFeature3D { public: - CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D<>(this) { + CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D(this) { setCachedTransformations(CachedTransformation::Absolute); } diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 9deb03bc9..3cd00f42b 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); } @@ -134,18 +134,17 @@ parameter: class TransformingFeature: public SceneGraph::AbstractFeature3D { public: template TransformingFeature(SceneGraph::Object* object): - SceneGraph::AbstractFeature3D<>(object), transformation(object) {} + SceneGraph::AbstractFeature3D(object), transformation(object) {} private: - SceneGraph::AbstractTranslationRotation3D<>* transformation; + SceneGraph::AbstractTranslationRotation3D* transformation; }; @endcode -If we take for example @ref Object "Object>", it is -derived from @ref AbstractObject "AbstractObject3D<>" and -@ref MatrixTransformation3D "MatrixTransformation3D<>", which is derived from -@ref AbstractTranslationRotationScaling3D "AbstractTranslationRotationScaling3D<>", -which is derived from -@ref AbstractTranslationRotation3D "AbstractTranslationRotation3D<>", +If we take for example @ref Object "Object", it is +derived from @ref AbstractBasicObject "AbstractObject3D" and +@ref BasicMatrixTransformation3D "MatrixTransformation3D", which is derived +from @ref BasicAbstractTranslationRotationScaling3D "AbstractTranslationRotationScaling3D", +which is derived from @ref BasicAbstractTranslationRotation3D "AbstractTranslationRotation3D", which is automatically extracted from the pointer in our constructor. @section AbstractFeature-explicit-specializations Explicit template specializations diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 65f39ad57..8d22714d7 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -73,12 +73,12 @@ animationStep(). You can do it conveniently using multiple inheritance (see implement your animation, the function provides both absolute animation time and time delta. Example: @code -typedef SceneGraph::Object> Object3D; -typedef SceneGraph::Scene> Scene3D; +typedef SceneGraph::Object Object3D; +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); // ... } diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index ac5e892b0..02a935d1b 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -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::BasicCamera2D* camera = new SceneGraph::BasicCamera2D(&cameraObject); camera->setProjection({4.0f/3.0f, 1.0f}) ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 74edcddbb..77cba35a2 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::BasicCamera3D* camera = new SceneGraph::BasicCamera3D(&cameraObject); camera->setPerspective({}, 0.001f, 100.0f) ->setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); @endcode diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index 14e0398d4..e5beac03f 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -44,8 +44,8 @@ First thing is add Drawable feature to some object and implement draw(). You can do it conveniently using multiple inheritance (see @ref scenegraph-features for introduction). Example: @code -typedef SceneGraph::Object> Object3D; -typedef SceneGraph::Scene> Scene3D; +typedef SceneGraph::Object Object3D; +typedef SceneGraph::Scene Scene3D; class DrawableObject: public Object3D, SceneGraph::Drawable3D { public: diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 6f5c55c95..359547d68 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -59,8 +59,8 @@ for introduction. Common usage is to typedef Object with desired transformation type to save unnecessary typing later, along with Scene and possibly other types, e.g.: @code -typedef SceneGraph::Scene> Scene3D; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Scene Scene3D; +typedef SceneGraph::Object Object3D; @endcode Uses Corrade::Containers::LinkedList for parent/children relationship. diff --git a/src/Text/TextRenderer.h b/src/Text/TextRenderer.h index ee0ad3abe..57ba2d6fa 100644 --- a/src/Text/TextRenderer.h +++ b/src/Text/TextRenderer.h @@ -163,7 +163,7 @@ std::tie(mesh, rectangle) = Text::TextRenderer2D::render(font, cache, 0.15f, // Draw white text centered on the screen shader->setTransformationProjectionMatrix(projection*Matrix3::translation(-rectangle.width()/2.0f)) - ->setColor(Color3<>(1.0f)); + ->setColor(Color3(1.0f)); ->use(); glyphCache->texture()->bind(Shaders::VectorShader2D::FontTextureLayer); mesh.draw(); @@ -189,7 +189,7 @@ 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)); + ->setColor(Color3(1.0f)); ->use(); glyphCache->texture()->bind(Shaders::VectorShader2D::FontTextureLayer); renderer.mesh().draw();