Browse Source

SceneGraph: updates for the new documentation theme.

No proofreading.
pull/231/head
Vladimír Vondruš 8 years ago
parent
commit
0b491309fb
  1. 22
      src/Magnum/SceneGraph/AbstractFeature.h
  2. 15
      src/Magnum/SceneGraph/AbstractGroupedFeature.h
  3. 22
      src/Magnum/SceneGraph/AbstractObject.h
  4. 7
      src/Magnum/SceneGraph/AbstractTransformation.h
  5. 4
      src/Magnum/SceneGraph/AbstractTranslation.h
  6. 18
      src/Magnum/SceneGraph/AbstractTranslationRotation3D.h
  7. 33
      src/Magnum/SceneGraph/Animable.h
  8. 4
      src/Magnum/SceneGraph/AnimableGroup.h
  9. 20
      src/Magnum/SceneGraph/Camera.h
  10. 31
      src/Magnum/SceneGraph/Drawable.h
  11. 8
      src/Magnum/SceneGraph/FeatureGroup.h
  12. 12
      src/Magnum/SceneGraph/Object.h
  13. 4
      src/Magnum/SceneGraph/TranslationTransformation.h

22
src/Magnum/SceneGraph/AbstractFeature.h

@ -84,13 +84,13 @@ Contained in @ref Object, takes care of transformation caching. See
Uses @ref Corrade::Containers::LinkedList for accessing holder object and
sibling features.
## Subclassing
@section SceneGraph-AbstractFeature-subclassing Subclassing
Feature is templated on dimension count and underlying transformation type, so
it can be used only on object having transformation with the same dimension
count and type.
### Caching transformations in features
@subsection SceneGraph-AbstractFeature-subclassing-caching Caching transformations in features
Features can cache absolute transformation of the object instead of computing
it from scratch every time to achieve better performance. See
@ -98,9 +98,10 @@ it from scratch every time to achieve better performance. See
In order to have caching, you must enable it first, because by default the
caching is disabled. You can enable it using @ref setCachedTransformations()
and then implement corresponding cleaning function(s) -- either @ref clean(),
and then implement corresponding cleaning function(s) --- either @ref clean(),
@ref cleanInverted() or both. Example:
@code
@code{.cpp}
class CachingFeature: public SceneGraph::AbstractFeature3D {
public:
explicit CachingFeature(SceneGraph::AbstractObject3D& object): SceneGraph::AbstractFeature3D{object} {
@ -117,15 +118,16 @@ class CachingFeature: public SceneGraph::AbstractFeature3D {
@endcode
Before using the cached value explicitly request object cleaning by calling
`object()->setClean()`.
@cpp object()->setClean() @ce.
### Accessing object transformation
@subsection SceneGraph-AbstractFeature-subclassing-object-transformation Accessing object transformation
The feature has by default only access to @ref AbstractObject, which doesn't
know about any used transformation. By using small template trick in the
constructor it is possible to gain access to transformation interface in the
constructor:
@code
@code{.cpp}
class TransformingFeature: public SceneGraph::AbstractFeature3D {
public:
template<class T> explicit TransformingFeature(SceneGraph::Object<T>& object):
@ -138,7 +140,7 @@ class TransformingFeature: public SceneGraph::AbstractFeature3D {
See @ref scenegraph-features-transformation for more detailed information.
## Explicit template specializations
@section SceneGraph-AbstractFeature-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" type)
@ -286,7 +288,7 @@ template<UnsignedInt dimensions, class T> class AbstractFeature
/**
@brief Base feature for two-dimensional scenes
Convenience alternative to `AbstractFeature<2, T>`. See
Convenience alternative to @cpp AbstractFeature<2, T> @ce. See
@ref AbstractFeature for more information.
@see @ref AbstractFeature2D, @ref AbstractBasicFeature3D
*/
@ -304,7 +306,7 @@ typedef AbstractBasicFeature2D<Float> AbstractFeature2D;
/**
@brief Base feature for three-dimensional scenes
Convenience alternative to `AbstractFeature<3, T>`. See
Convenience alternative to @cpp AbstractFeature<3, T> @ce. See
@ref AbstractFeature for more information.
@see @ref AbstractFeature3D, @ref AbstractBasicFeature2D
*/

15
src/Magnum/SceneGraph/AbstractGroupedFeature.h

@ -41,11 +41,12 @@ namespace Magnum { namespace SceneGraph {
Used together with @ref FeatureGroup.
## Subclassing
@section SceneGraph-AbstractGroupedFeature-subclassing Subclassing
Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)
and typedef'ing @ref FeatureGroup to accept only given type, e.g.:
@code
@code{.cpp}
class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> {
// ...
};
@ -53,7 +54,7 @@ class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> {
typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup;
@endcode
## Explicit template specializations
@section SceneGraph-AbstractGroupedFeature-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" type)
@ -110,7 +111,7 @@ template<UnsignedInt dimensions, class Derived, class T> class AbstractGroupedFe
/**
@brief Base grouped feature for two-dimensional scenes
Convenience alternative to `AbstractGroupedFeature<2, Derived, T>`. See
Convenience alternative to @cpp AbstractGroupedFeature<2, Derived, T> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature2D, @ref AbstractBasicGroupedFeature3D
*/
@ -121,7 +122,7 @@ template<class Derived, class T> using AbstractBasicGroupedFeature2D = AbstractG
/**
@brief Base grouped feature for two-dimensional float scenes
Convenience alternative to `AbstractBasicGroupedFeature2D<Derived, Float>`.
Convenience alternative to @cpp AbstractBasicGroupedFeature2D<Derived, Float> @ce.
See @ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature3D
*/
@ -132,7 +133,7 @@ template<class Derived> using AbstractGroupedFeature2D = AbstractBasicGroupedFea
/**
@brief Base grouped feature for three-dimensional scenes
Convenience alternative to `AbstractGroupedFeature<3, Derived, T>`. See
Convenience alternative to @cpp AbstractGroupedFeature<3, Derived, T> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature3D, @ref AbstractBasicGroupedFeature2D
*/
@ -143,7 +144,7 @@ template<class Derived, class T> using AbstractBasicGroupedFeature3D = AbstractG
/**
@brief Base grouped feature for three-dimensional float scenes
Convenience alternative to `AbstractBasicGroupedFeature3D<Derived, Float>`.
Convenience alternative to @cpp AbstractBasicGroupedFeature3D<Derived, Float> @ce.
See @ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature2D
*/

22
src/Magnum/SceneGraph/AbstractObject.h

@ -52,7 +52,8 @@ subclass instead. See also @ref scenegraph for more information.
Uses @ref Corrade::Containers::LinkedList for efficient feature management.
Traversing through the feature list can be done using range-based for:
@code
@code{.cpp}
AbstractObject3D object;
for(AbstractFeature3D& feature: object.features()) {
// ...
@ -62,14 +63,14 @@ for(AbstractFeature3D& feature: object.features()) {
Or, if you need more flexibility, like in the following code. It is also
possible to go in reverse order using @ref Corrade::Containers::LinkedList::last()
and @ref AbstractFeature::previousFeature().
@code
@code{.cpp}
for(AbstractFeature3D* feature = object.features().first(); feature; feature = feature->nextFeature()) {
// ...
}
@endcode
@anchor SceneGraph-AbstractObject-explicit-specializations
## Explicit template specializations
@section SceneGraph-AbstractObject-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -159,7 +160,8 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/**
* @brief Scene
* @return Scene or `nullptr`, if the object is not part of any scene.
* @return Scene or @cpp nullptr @ce, if the object is not part of any
* scene.
*/
AbstractObject<dimensions, T>* scene() { return doScene(); }
@ -230,9 +232,9 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/**
* @brief Whether absolute transformation is dirty
*
* Returns `true` if transformation of the object or any parent has
* changed since last call to @ref setClean(), `false` otherwise. All
* objects are dirty by default.
* Returns @cpp true @ce if transformation of the object or any parent
* has changed since last call to @ref setClean(), @cpp false @ce
* otherwise. All objects are dirty by default.
* @see @ref scenegraph-features-caching
*/
bool isDirty() const { return doIsDirty(); }
@ -293,7 +295,7 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/**
@brief Base object for two-dimensional scenes
Convenience alternative to `AbstractObject<2, T>`. See
Convenience alternative to @cpp AbstractObject<2, T> @ce. See
@ref AbstractObject for more information.
@see @ref AbstractObject2D, @ref AbstractBasicObject3D
*/
@ -311,7 +313,7 @@ typedef AbstractBasicObject2D<Float> AbstractObject2D;
/**
@brief Base object for three-dimensional scenes
Convenience alternative to `AbstractObject<3, T>`. See
Convenience alternative to @cpp AbstractObject<3, T> @ce. See
@ref AbstractObject for more information.
@see @ref AbstractObject3D, @ref AbstractBasicObject2D
*/

7
src/Magnum/SceneGraph/AbstractTransformation.h

@ -42,8 +42,7 @@ namespace Magnum { namespace SceneGraph {
Provides transformation implementation for @ref Object instances. See
@ref scenegraph-features-transformation for more information.
@anchor SceneGraph-AbstractTransformation-explicit-specializations
## Explicit template specializations
@section SceneGraph-AbstractTransformation-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -107,7 +106,7 @@ enum class CORRADE_DEPRECATED_ENUM("use *() and *Local() overloads instead") Tra
/**
@brief Base transformation for two-dimensional scenes
Convenience alternative to `AbstractTransformation<2, T>`. See
Convenience alternative to @cpp AbstractTransformation<2, T> @ce. See
@ref AbstractTransformation for more information.
@see @ref AbstractTransformation2D, @ref AbstractBasicTransformation3D
*/
@ -125,7 +124,7 @@ typedef AbstractBasicTransformation2D<Float> AbstractTransformation2D;
/**
@brief Base transformation for three-dimensional scenes
Convenience alternative to `AbstractTransformation<3, T>`. See
Convenience alternative to @cpp AbstractTransformation<3, T> @ce. See
@ref AbstractTransformation for more information.
@see @ref AbstractTransformation3D, @ref AbstractBasicTransformation2D
*/

4
src/Magnum/SceneGraph/AbstractTranslation.h

@ -129,7 +129,7 @@ class AbstractTranslation: public AbstractTransformation<dimensions, T> {
/**
@brief Base transformation for two-dimensional scenes supporting translation
Convenience alternative to `AbstractTranslation<2, T, TranslationType>`.
Convenience alternative to @cpp AbstractTranslation<2, T, TranslationType> @ce.
See @ref AbstractTranslation for more information.
@see @ref AbstractTranslation2D, @ref AbstractBasicTranslation3D
*/
@ -152,7 +152,7 @@ typedef AbstractBasicTranslation2D<Float> AbstractTranslation2D;
/**
@brief Base transformation for three-dimensional scenes supporting translation
Convenience alternative to `AbstractTranslation<3, T, TranslationType>`.
Convenience alternative to @cpp AbstractTranslation<3, T, TranslationType> @ce.
See @ref AbstractTranslation for more information.
@see @ref AbstractTranslation3D, @ref AbstractBasicTranslation2D
*/

18
src/Magnum/SceneGraph/AbstractTranslationRotation3D.h

@ -101,7 +101,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* @return Reference to self (for method chaining)
*
* In some implementations faster than calling
* `rotate(angle, Vector3::xAxis())`, see subclasses for more
* @cpp rotate(angle, Vector3::xAxis()) @ce, see subclasses for more
* information.
* @see @ref rotateXLocal()
*/
@ -115,8 +115,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
*
* Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::xAxis())`, see subclasses for more
* information.
* @cpp rotateLocal(angle, Vector3::xAxis()) @ce, see subclasses for
* more information.
*/
AbstractBasicTranslationRotation3D<T>& rotateXLocal(Math::Rad<T> angle) {
doRotateXLocal(angle);
@ -151,7 +151,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* @return Reference to self (for method chaining)
*
* In some implementations faster than calling
* `rotate(angle, Vector3::yAxis())`, see subclasses for more
* @cpp rotate(angle, Vector3::yAxis()) @ce, see subclasses for more
* information.
* @see @ref rotateYLocal()
*/
@ -165,8 +165,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
*
* Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::yAxis())`, see subclasses for more
* information.
* @cpp rotateLocal(angle, Vector3::yAxis()) @ce, see subclasses for
* more information.
*/
AbstractBasicTranslationRotation3D<T>& rotateYLocal(Math::Rad<T> angle) {
doRotateY(angle);
@ -201,7 +201,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* @return Reference to self (for method chaining)
*
* In some implementations faster than calling
* `rotate(angle, Vector3::zAxis())`, see subclasses for more
* @cpp rotate(angle, Vector3::zAxis()) @ce, see subclasses for more
* information.
* @see @ref rotateZLocal()
*/
@ -215,8 +215,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
*
* Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::zAxis())`, see subclasses for more
* information.
* @cpp rotateLocal(angle, Vector3::zAxis()) @ce, see subclasses for
* more information.
*/
AbstractBasicTranslationRotation3D<T>& rotateZLocal(Math::Rad<T> angle) {
doRotateZLocal(angle);

33
src/Magnum/SceneGraph/Animable.h

@ -65,14 +65,15 @@ MAGNUM_SCENEGRAPH_EXPORT Debug& operator<<(Debug& debug, AnimationState value);
Adds animation feature to object. Each Animable is part of some
@ref AnimableGroup, which takes care of running the animations.
## Usage
@section SceneGraph-Animable Usage
First thing is to add @ref Animable feature to some object and implement
@ref animationStep(). You can do it conveniently using multiple inheritance
(see @ref scenegraph-features for introduction). Override @ref animationStep()
to implement your animation, the function provides both absolute animation
time and time delta. Example:
@code
@code{.cpp}
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
@ -97,7 +98,8 @@ given set of animations. You can also use @ref AnimableGroup::add() and
The animation is initially in stopped state and without repeat, see
@ref setState(), @ref setRepeated() and @ref setRepeatCount() for more
information.
@code
@code{.cpp}
Scene3D scene;
SceneGraph::AnimableGroup3D animables;
@ -110,7 +112,8 @@ Animation step is performed by calling @ref 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 @ref Timeline for that, see its documentation for more information.
@code
@code{.cpp}
Timeline timeline;
timeline.start();
@ -123,15 +126,15 @@ void MyApplication::drawEvent() {
}
@endcode
## Using multiple animable groups to improve performance
@section SceneGraph-Animable-multiple-groups Using multiple animable groups to improve performance
@ref AnimableGroup is optimized for case when no animation is running -- it
@ref 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::Running again. If you put animations which are not
pernamently running into separate group, they will not be traversed every time
the @ref AnimableGroup::step() gets called, saving precious frame time.
## Explicit template specializations
@section SceneGraph-Animable-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -192,7 +195,7 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
* @brief Enable/disable repeated animation
* @return Reference to self (for method chaining)
*
* Default is `false`.
* Default is @cpp false @ce.
* @see @ref setRepeatCount()
*/
Animable<dimensions, T>& setRepeated(bool repeated) {
@ -211,8 +214,8 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
* @brief Set repeat count
* @return Reference to self (for method chaining)
*
* Has effect only if repeated animation is enabled. `0` means
* infinitely repeated animation. Default is `0`.
* Has effect only if repeated animation is enabled. @cpp 0 @ce means
* infinitely repeated animation. Default is @cpp 0 @ce.
* @see @ref setRepeated()
*/
Animable<dimensions, T>& setRepeatCount(UnsignedShort count) {
@ -223,7 +226,7 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
/**
* @brief Group containing this animable
*
* If the animable doesn't belong to any group, returns `nullptr`.
* If the animable doesn't belong to any group, returns @cpp nullptr @ce.
*/
AnimableGroup<dimensions, T>* animables();
const AnimableGroup<dimensions, T>* animables() const; /**< @overload */
@ -233,8 +236,8 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
* @brief Set animation duration
* @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`.
* Sets duration of the animation cycle in seconds. Set to @cpp 0.0f @ce
* for infinite non-repeating animation. Default is @cpp 0.0f @ce.
*/
/* Protected so only animation implementer can change it */
Animable<dimensions, T>& setDuration(Float duration) {
@ -326,7 +329,7 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
/**
@brief Animable for two-dimensional scenes
Convenience alternative to `Animable<2, T>`. See @ref Animable for more
Convenience alternative to @cpp Animable<2, T> @ce. See @ref Animable for more
information.
@see @ref Animable2D, @ref BasicAnimable3D
*/
@ -344,7 +347,7 @@ typedef BasicAnimable2D<Float> Animable2D;
/**
@brief Animable for three-dimensional scenes
Convenience alternative to `Animable<3, T>`. See @ref Animable for more
Convenience alternative to @cpp Animable<3, T> @ce. See @ref Animable for more
information.
@see @ref Animable3D, @ref BasicAnimable2D
*/

4
src/Magnum/SceneGraph/AnimableGroup.h

@ -75,7 +75,7 @@ template<UnsignedInt dimensions, class T> class AnimableGroup: public FeatureGro
/**
@brief Animable group for two-dimensional scenes
Convenience alternative to `AnimableGroup<2, T>`. See Animable for
Convenience alternative to @cpp AnimableGroup<2, T> @ce. See @ref Animable for
more information.
@see @ref AnimableGroup2D, @ref BasicAnimableGroup3D
*/
@ -93,7 +93,7 @@ typedef BasicAnimableGroup2D<Float> AnimableGroup2D;
/**
@brief Animable group for three-dimensional scenes
Convenience alternative to `AnimableGroup<3, T>`. See Animable for
Convenience alternative to @cpp AnimableGroup<3, T> @ce. See @ref Animable for
more information.
@see @ref AnimableGroup3D, @ref BasicAnimableGroup2D
*/

20
src/Magnum/SceneGraph/Camera.h

@ -64,21 +64,22 @@ displays OpenGL unit cube `[(-1, -1, -1); (1, 1, 1)]` and doesn't do any aspect
ratio correction.
Common setup example for 2D scenes:
@code
@code{.cpp}
SceneGraph::Camera2D camera{&cameraObject};
camera.setProjectionMatrix(Matrix3::projection({4.0f/3.0f, 1.0f}))
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode
Common setup example for 3D scenes:
@code
@code{.cpp}
SceneGraph::Camera3D camera{&cameraObject};
camera.setProjectionMatrix(Matrix3::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f))
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode
@anchor SceneGraph-Camera-explicit-specializations
## Explicit template specializations
@section SceneGraph-Camera-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -203,13 +204,16 @@ template<UnsignedInt dimensions, class T> class Camera: public AbstractFeature<d
* @ref Platform::Sdl2Application::MouseEvent "Platform::*Application::MouseEvent")
* to floating-point coordinates on near XY plane with origin at camera
* position and Y up can be done using the following snippet:
* @code
*
* @code{.cpp}
* Vector2 position = (Vector2{event.position()}/defaultFramebuffer.viewport().size() - Vector2{0.5f})*Vector2::yScale(-1.0f)*camera.projectionSize();
* @endcode
*
* This is position relative to camera transformation, getting absolute
* transformation in 2D scene can be done for example using
* @ref SceneGraph::Object::absoluteTransformation():
* @code
*
* @code{.cpp}
* Vector2 absolutePosition = cameraObject->absoluteTransformation().transformPoint(position);
* @endcode
*
@ -258,7 +262,7 @@ template<UnsignedInt dimensions, class T> class Camera: public AbstractFeature<d
/**
@brief Camera for two-dimensional scenes
Convenience alternative to `Camera<2, T>`. See @ref Camera for more
Convenience alternative to @cpp Camera<2, T> @ce. See @ref Camera for more
information.
@see @ref Camera2D, @ref BasicCamera3D
*/
@ -276,7 +280,7 @@ typedef BasicCamera2D<Float> Camera2D;
/**
@brief Camera for three-dimensional scenes
Convenience alternative to `Camera<3, T>`. See @ref Camera for more
Convenience alternative to @cpp Camera<3, T> @ce. See @ref Camera for more
information.
@see @ref Camera3D, @ref BasicCamera2D
*/

31
src/Magnum/SceneGraph/Drawable.h

@ -40,13 +40,14 @@ Adds drawing functionality to the object. Each Drawable is part of some
@ref DrawableGroup and the whole group can be drawn with particular camera
using @ref Camera::draw().
## Usage
@section SceneGraph-Drawable-usage Usage
First thing is to add @ref Drawable feature to some object and implement
@ref draw() function. You can do it conveniently using multiple inheritance
(see @ref scenegraph-features for introduction). Example drawable object that
draws blue sphere:
@code
@code{.cpp}
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
@ -81,7 +82,8 @@ have single function to set composite transformation and projection matrix. In
that case you need to combine the two matrices manually like in the following
code. Some shaders have additional requirements for various transformation
matrices, see their respective documentation for details.
@code
@code{.cpp}
Shaders::Flat3D shader;
shader.setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix);
@endcode
@ -90,7 +92,8 @@ There is no way to just draw all the drawables in the scene, you need to create
some drawable group and add the drawable objects to both the scene and the
group. You can also use @ref DrawableGroup::add() and
@ref DrawableGroup::remove() instead of passing the group in the constructor.
@code
@code{.cpp}
Scene3D scene;
SceneGraph::DrawableGroup3D drawables;
@ -106,7 +109,8 @@ transformation). Using the camera and the drawable group you can perform
drawing in your @ref Platform::Sdl2Application::drawEvent() "drawEvent()"
implementation. See @ref Camera2D and @ref Camera3D documentation for more
information.
@code
@code{.cpp}
auto cameraObject = new Object3D(&scene);
cameraObject->translate(Vector3::zAxis(5.0f));
auto camera = new SceneGraph::Camera3D(&cameraObject);
@ -123,14 +127,15 @@ void MyApplication::drawEvent() {
}
@endcode
## Using multiple drawable groups to improve performance
@section SceneGraph-Drawable-multiple-groups Using multiple drawable groups to improve performance
You can organize your drawables to multiple groups to minimize OpenGL state
changes -- for example put all objects using the same shader, the same light
changes --- for example put all objects using the same shader, the same light
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
@ref draw() implementation. Example:
@code
@code{.cpp}
Shaders::PhongShader shader;
SceneGraph::DrawableGroup3D phongObjects, transparentObjects;
@ -155,7 +160,7 @@ void MyApplication::drawEvent() {
}
@endcode
## Explicit template specializations
@section SceneGraph-Drawable-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -208,7 +213,7 @@ template<UnsignedInt dimensions, class T> class Drawable: public AbstractGrouped
/**
@brief Drawable for two-dimensional scenes
Convenience alternative to `Drawable<2, T>`. See @ref Drawable for more
Convenience alternative to @cpp Drawable<2, T> @ce. See @ref Drawable for more
information.
@see @ref Drawable2D, @ref BasicDrawable3D
*/
@ -226,7 +231,7 @@ typedef BasicDrawable2D<Float> Drawable2D;
/**
@brief Drawable for three-dimensional scenes
Convenience alternative to `Drawable<3, T>`. See @ref Drawable for more
Convenience alternative to @cpp Drawable<3, T> @ce. See @ref Drawable for more
information.
@see @ref Drawable3D, @ref BasicDrawable3D
*/
@ -255,7 +260,7 @@ template<UnsignedInt dimensions, class T> using DrawableGroup = FeatureGroup<dim
/**
@brief Group of drawables for two-dimensional scenes
Convenience alternative to `DrawableGroup<2, T>`. See @ref Drawable for
Convenience alternative to @cpp DrawableGroup<2, T> @ce. See @ref Drawable for
more information.
@see @ref DrawableGroup2D, @ref BasicDrawableGroup3D
*/
@ -273,7 +278,7 @@ typedef BasicDrawableGroup2D<Float> DrawableGroup2D;
/**
@brief Group of drawables for three-dimensional scenes
Convenience alternative to `DrawableGroup<3, T>`. See @ref Drawable for
Convenience alternative to @cpp DrawableGroup<3, T> @ce. See @ref Drawable for
more information.
@see @ref DrawableGroup3D, @ref BasicDrawableGroup2D
*/

8
src/Magnum/SceneGraph/FeatureGroup.h

@ -116,7 +116,7 @@ template<UnsignedInt dimensions, class Feature, class T> class FeatureGroup: pub
/**
@brief Base feature group for two-dimensional scenes
Convenience alternative to `FeatureGroup<2, Feature, T>`. See
Convenience alternative to @cpp FeatureGroup<2, Feature, T> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup2D, @ref BasicFeatureGroup3D
*/
@ -127,7 +127,7 @@ template<class Feature, class T> using BasicFeatureGroup2D = FeatureGroup<2, Fea
/**
@brief Base feature group for two-dimensional float scenes
Convenience alternative to `BasicFeatureGroup2D<Feature, Float>`. See
Convenience alternative to @cpp BasicFeatureGroup2D<Feature, Float> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup3D
*/
@ -138,7 +138,7 @@ template<class Feature> using FeatureGroup2D = BasicFeatureGroup2D<Feature, Floa
/**
@brief Base feature group for three-dimensional scenes
Convenience alternative to `FeatureGroup<3, Feature, T>`. See
Convenience alternative to @cpp FeatureGroup<3, Feature, T> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup3D, @ref BasicFeatureGroup2D
*/
@ -149,7 +149,7 @@ template<class Feature, class T> using BasicFeatureGroup3D = FeatureGroup<3, Fea
/**
@brief Base feature group for three-dimensional float scenes
Convenience alternative to `BasicFeatureGroup3D<Feature, Float>`. See
Convenience alternative to @cpp BasicFeatureGroup3D<Feature, Float> @ce. See
@ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup2D
*/

12
src/Magnum/SceneGraph/Object.h

@ -58,14 +58,16 @@ for introduction.
Common usage is to typedef @ref Object with desired transformation type to save
unnecessary typing later, along with @ref Scene and possibly other types, e.g.:
@code
@code{.cpp}
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
@endcode
Uses @ref Corrade::Containers::LinkedList for efficient hierarchy management.
Traversing through the list of child objects can be done using range-based for:
@code
@code{.cpp}
Object3D o;
for(Object3D& child: o.children()) {
// ...
@ -75,14 +77,14 @@ for(Object3D& child: o.children()) {
Or, if you need more flexibility, like in the following code. It is also
possible to go in reverse order using @ref Corrade::Containers::LinkedList::last()
and @ref previousSibling().
@code
@code{.cpp}
for(Object3D* child = o->children().first(); child; child = child->nextSibling()) {
// ...
}
@endcode
@anchor SceneGraph-Object-explicit-specializations
## Explicit template specializations
@section SceneGraph-Object-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double"

4
src/Magnum/SceneGraph/TranslationTransformation.h

@ -172,7 +172,7 @@ class TranslationTransformation: public AbstractTranslation<dimensions, T, Trans
/**
@brief Base transformation for two-dimensional scenes supporting translation
Convenience alternative to `TranslationTransformation<2, T, TranslationType>`.
Convenience alternative to @cpp TranslationTransformation<2, T, TranslationType> @ce.
See @ref TranslationTransformation for more information.
@see @ref TranslationTransformation2D, @ref BasicTranslationTransformation3D
*/
@ -195,7 +195,7 @@ typedef BasicTranslationTransformation2D<Float> TranslationTransformation2D;
/**
@brief Base transformation for three-dimensional scenes supporting translation
Convenience alternative to `TranslationTransformation<3, T, TranslationType>`.
Convenience alternative to @cpp TranslationTransformation<3, T, TranslationType> @ce.
See @ref TranslationTransformation for more information.
@see @ref TranslationTransformation3D, @ref BasicTranslationTransformation2D
*/

Loading…
Cancel
Save