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 Uses @ref Corrade::Containers::LinkedList for accessing holder object and
sibling features. sibling features.
## Subclassing @section SceneGraph-AbstractFeature-subclassing Subclassing
Feature is templated on dimension count and underlying transformation type, so Feature is templated on dimension count and underlying transformation type, so
it can be used only on object having transformation with the same dimension it can be used only on object having transformation with the same dimension
count and type. 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 Features can cache absolute transformation of the object instead of computing
it from scratch every time to achieve better performance. See 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 In order to have caching, you must enable it first, because by default the
caching is disabled. You can enable it using @ref setCachedTransformations() 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: @ref cleanInverted() or both. Example:
@code
@code{.cpp}
class CachingFeature: public SceneGraph::AbstractFeature3D { class CachingFeature: public SceneGraph::AbstractFeature3D {
public: public:
explicit CachingFeature(SceneGraph::AbstractObject3D& object): SceneGraph::AbstractFeature3D{object} { explicit CachingFeature(SceneGraph::AbstractObject3D& object): SceneGraph::AbstractFeature3D{object} {
@ -117,15 +118,16 @@ class CachingFeature: public SceneGraph::AbstractFeature3D {
@endcode @endcode
Before using the cached value explicitly request object cleaning by calling 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 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 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 it is possible to gain access to transformation interface in the
constructor: constructor:
@code
@code{.cpp}
class TransformingFeature: public SceneGraph::AbstractFeature3D { class TransformingFeature: public SceneGraph::AbstractFeature3D {
public: public:
template<class T> explicit TransformingFeature(SceneGraph::Object<T>& object): 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. 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 The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" type) 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 @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. @ref AbstractFeature for more information.
@see @ref AbstractFeature2D, @ref AbstractBasicFeature3D @see @ref AbstractFeature2D, @ref AbstractBasicFeature3D
*/ */
@ -304,7 +306,7 @@ typedef AbstractBasicFeature2D<Float> AbstractFeature2D;
/** /**
@brief Base feature for three-dimensional scenes @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. @ref AbstractFeature for more information.
@see @ref AbstractFeature3D, @ref AbstractBasicFeature2D @see @ref AbstractFeature3D, @ref AbstractBasicFeature2D
*/ */

15
src/Magnum/SceneGraph/AbstractGroupedFeature.h

@ -41,11 +41,12 @@ namespace Magnum { namespace SceneGraph {
Used together with @ref FeatureGroup. 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) 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.: and typedef'ing @ref FeatureGroup to accept only given type, e.g.:
@code
@code{.cpp}
class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> { class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> {
// ... // ...
}; };
@ -53,7 +54,7 @@ class Drawable: public SceneGraph::AbstractGroupedFeature3D<Drawable> {
typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup; typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup;
@endcode @endcode
## Explicit template specializations @section SceneGraph-AbstractGroupedFeature-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" type) 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 @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. @ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature2D, @ref AbstractBasicGroupedFeature3D @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 @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 AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature3D @see @ref AbstractGroupedFeature3D
*/ */
@ -132,7 +133,7 @@ template<class Derived> using AbstractGroupedFeature2D = AbstractBasicGroupedFea
/** /**
@brief Base grouped feature for three-dimensional scenes @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. @ref AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature3D, @ref AbstractBasicGroupedFeature2D @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 @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 AbstractGroupedFeature for more information.
@see @ref AbstractGroupedFeature2D @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. Uses @ref Corrade::Containers::LinkedList for efficient feature management.
Traversing through the feature list can be done using range-based for: Traversing through the feature list can be done using range-based for:
@code
@code{.cpp}
AbstractObject3D object; AbstractObject3D object;
for(AbstractFeature3D& feature: object.features()) { 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 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() possible to go in reverse order using @ref Corrade::Containers::LinkedList::last()
and @ref AbstractFeature::previousFeature(). and @ref AbstractFeature::previousFeature().
@code
@code{.cpp}
for(AbstractFeature3D* feature = object.features().first(); feature; feature = feature->nextFeature()) { for(AbstractFeature3D* feature = object.features().first(); feature; feature = feature->nextFeature()) {
// ... // ...
} }
@endcode @endcode
@anchor SceneGraph-AbstractObject-explicit-specializations @section SceneGraph-AbstractObject-explicit-specializations Explicit template specializations
## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" library. For other specializations (e.g. using @ref Magnum::Double "Double"
@ -159,7 +160,8 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/** /**
* @brief Scene * @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(); } AbstractObject<dimensions, T>* scene() { return doScene(); }
@ -230,9 +232,9 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/** /**
* @brief Whether absolute transformation is dirty * @brief Whether absolute transformation is dirty
* *
* Returns `true` if transformation of the object or any parent has * Returns @cpp true @ce if transformation of the object or any parent
* changed since last call to @ref setClean(), `false` otherwise. All * has changed since last call to @ref setClean(), @cpp false @ce
* objects are dirty by default. * otherwise. All objects are dirty by default.
* @see @ref scenegraph-features-caching * @see @ref scenegraph-features-caching
*/ */
bool isDirty() const { return doIsDirty(); } bool isDirty() const { return doIsDirty(); }
@ -293,7 +295,7 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/** /**
@brief Base object for two-dimensional scenes @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. @ref AbstractObject for more information.
@see @ref AbstractObject2D, @ref AbstractBasicObject3D @see @ref AbstractObject2D, @ref AbstractBasicObject3D
*/ */
@ -311,7 +313,7 @@ typedef AbstractBasicObject2D<Float> AbstractObject2D;
/** /**
@brief Base object for three-dimensional scenes @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. @ref AbstractObject for more information.
@see @ref AbstractObject3D, @ref AbstractBasicObject2D @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 Provides transformation implementation for @ref Object instances. See
@ref scenegraph-features-transformation for more information. @ref scenegraph-features-transformation for more information.
@anchor SceneGraph-AbstractTransformation-explicit-specializations @section SceneGraph-AbstractTransformation-explicit-specializations Explicit template specializations
## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" 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 @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. @ref AbstractTransformation for more information.
@see @ref AbstractTransformation2D, @ref AbstractBasicTransformation3D @see @ref AbstractTransformation2D, @ref AbstractBasicTransformation3D
*/ */
@ -125,7 +124,7 @@ typedef AbstractBasicTransformation2D<Float> AbstractTransformation2D;
/** /**
@brief Base transformation for three-dimensional scenes @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. @ref AbstractTransformation for more information.
@see @ref AbstractTransformation3D, @ref AbstractBasicTransformation2D @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 @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 AbstractTranslation for more information.
@see @ref AbstractTranslation2D, @ref AbstractBasicTranslation3D @see @ref AbstractTranslation2D, @ref AbstractBasicTranslation3D
*/ */
@ -152,7 +152,7 @@ typedef AbstractBasicTranslation2D<Float> AbstractTranslation2D;
/** /**
@brief Base transformation for three-dimensional scenes supporting translation @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 AbstractTranslation for more information.
@see @ref AbstractTranslation3D, @ref AbstractBasicTranslation2D @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) * @return Reference to self (for method chaining)
* *
* In some implementations faster than calling * 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. * information.
* @see @ref rotateXLocal() * @see @ref rotateXLocal()
*/ */
@ -115,8 +115,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* *
* Similar to the above, except that the transformation is applied * Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling * before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::xAxis())`, see subclasses for more * @cpp rotateLocal(angle, Vector3::xAxis()) @ce, see subclasses for
* information. * more information.
*/ */
AbstractBasicTranslationRotation3D<T>& rotateXLocal(Math::Rad<T> angle) { AbstractBasicTranslationRotation3D<T>& rotateXLocal(Math::Rad<T> angle) {
doRotateXLocal(angle); doRotateXLocal(angle);
@ -151,7 +151,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* In some implementations faster than calling * 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. * information.
* @see @ref rotateYLocal() * @see @ref rotateYLocal()
*/ */
@ -165,8 +165,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* *
* Similar to the above, except that the transformation is applied * Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling * before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::yAxis())`, see subclasses for more * @cpp rotateLocal(angle, Vector3::yAxis()) @ce, see subclasses for
* information. * more information.
*/ */
AbstractBasicTranslationRotation3D<T>& rotateYLocal(Math::Rad<T> angle) { AbstractBasicTranslationRotation3D<T>& rotateYLocal(Math::Rad<T> angle) {
doRotateY(angle); doRotateY(angle);
@ -201,7 +201,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* In some implementations faster than calling * 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. * information.
* @see @ref rotateZLocal() * @see @ref rotateZLocal()
*/ */
@ -215,8 +215,8 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
* *
* Similar to the above, except that the transformation is applied * Similar to the above, except that the transformation is applied
* before all others. In some implementations faster than calling * before all others. In some implementations faster than calling
* `rotateLocal(angle, Vector3::zAxis())`, see subclasses for more * @cpp rotateLocal(angle, Vector3::zAxis()) @ce, see subclasses for
* information. * more information.
*/ */
AbstractBasicTranslationRotation3D<T>& rotateZLocal(Math::Rad<T> angle) { AbstractBasicTranslationRotation3D<T>& rotateZLocal(Math::Rad<T> angle) {
doRotateZLocal(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 Adds animation feature to object. Each Animable is part of some
@ref AnimableGroup, which takes care of running the animations. @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 First thing is to add @ref Animable feature to some object and implement
@ref animationStep(). You can do it conveniently using multiple inheritance @ref animationStep(). You can do it conveniently using multiple inheritance
(see @ref scenegraph-features for introduction). Override @ref animationStep() (see @ref scenegraph-features for introduction). Override @ref animationStep()
to implement your animation, the function provides both absolute animation to implement your animation, the function provides both absolute animation
time and time delta. Example: time and time delta. Example:
@code
@code{.cpp}
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D; typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D; 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 The animation is initially in stopped state and without repeat, see
@ref setState(), @ref setRepeated() and @ref setRepeatCount() for more @ref setState(), @ref setRepeated() and @ref setRepeatCount() for more
information. information.
@code
@code{.cpp}
Scene3D scene; Scene3D scene;
SceneGraph::AnimableGroup3D animables; 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 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 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. use @ref Timeline for that, see its documentation for more information.
@code
@code{.cpp}
Timeline timeline; Timeline timeline;
timeline.start(); timeline.start();
@ -123,15 +126,15 @@ void MyApplication::drawEvent() {
} }
@endcode @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 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 @ref AnimationState::Running again. If you put animations which are not
pernamently running into separate group, they will not be traversed every time pernamently running into separate group, they will not be traversed every time
the @ref AnimableGroup::step() gets called, saving precious frame 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 The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" 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 * @brief Enable/disable repeated animation
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `false`. * Default is @cpp false @ce.
* @see @ref setRepeatCount() * @see @ref setRepeatCount()
*/ */
Animable<dimensions, T>& setRepeated(bool repeated) { Animable<dimensions, T>& setRepeated(bool repeated) {
@ -211,8 +214,8 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
* @brief Set repeat count * @brief Set repeat count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if repeated animation is enabled. `0` means * Has effect only if repeated animation is enabled. @cpp 0 @ce means
* infinitely repeated animation. Default is `0`. * infinitely repeated animation. Default is @cpp 0 @ce.
* @see @ref setRepeated() * @see @ref setRepeated()
*/ */
Animable<dimensions, T>& setRepeatCount(UnsignedShort count) { Animable<dimensions, T>& setRepeatCount(UnsignedShort count) {
@ -223,7 +226,7 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
/** /**
* @brief Group containing this animable * @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(); AnimableGroup<dimensions, T>* animables();
const AnimableGroup<dimensions, T>* animables() const; /**< @overload */ const AnimableGroup<dimensions, T>* animables() const; /**< @overload */
@ -233,8 +236,8 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
* @brief Set animation duration * @brief Set animation duration
* @return Reference 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 * Sets duration of the animation cycle in seconds. Set to @cpp 0.0f @ce
* infinite non-repeating animation. Default is `0.0f`. * for infinite non-repeating animation. Default is @cpp 0.0f @ce.
*/ */
/* Protected so only animation implementer can change it */ /* Protected so only animation implementer can change it */
Animable<dimensions, T>& setDuration(Float duration) { 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 @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. information.
@see @ref Animable2D, @ref BasicAnimable3D @see @ref Animable2D, @ref BasicAnimable3D
*/ */
@ -344,7 +347,7 @@ typedef BasicAnimable2D<Float> Animable2D;
/** /**
@brief Animable for three-dimensional scenes @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. information.
@see @ref Animable3D, @ref BasicAnimable2D @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 @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. more information.
@see @ref AnimableGroup2D, @ref BasicAnimableGroup3D @see @ref AnimableGroup2D, @ref BasicAnimableGroup3D
*/ */
@ -93,7 +93,7 @@ typedef BasicAnimableGroup2D<Float> AnimableGroup2D;
/** /**
@brief Animable group for three-dimensional scenes @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. more information.
@see @ref AnimableGroup3D, @ref BasicAnimableGroup2D @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. ratio correction.
Common setup example for 2D scenes: Common setup example for 2D scenes:
@code
@code{.cpp}
SceneGraph::Camera2D camera{&cameraObject}; SceneGraph::Camera2D camera{&cameraObject};
camera.setProjectionMatrix(Matrix3::projection({4.0f/3.0f, 1.0f})) camera.setProjectionMatrix(Matrix3::projection({4.0f/3.0f, 1.0f}))
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode @endcode
Common setup example for 3D scenes: Common setup example for 3D scenes:
@code
@code{.cpp}
SceneGraph::Camera3D camera{&cameraObject}; SceneGraph::Camera3D camera{&cameraObject};
camera.setProjectionMatrix(Matrix3::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f)) camera.setProjectionMatrix(Matrix3::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f))
.setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend); .setAspectRatioPolicy(SceneGraph::AspectRatioPolicy::Extend);
@endcode @endcode
@anchor SceneGraph-Camera-explicit-specializations @section SceneGraph-Camera-explicit-specializations Explicit template specializations
## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" 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") * @ref Platform::Sdl2Application::MouseEvent "Platform::*Application::MouseEvent")
* to floating-point coordinates on near XY plane with origin at camera * to floating-point coordinates on near XY plane with origin at camera
* position and Y up can be done using the following snippet: * 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(); * Vector2 position = (Vector2{event.position()}/defaultFramebuffer.viewport().size() - Vector2{0.5f})*Vector2::yScale(-1.0f)*camera.projectionSize();
* @endcode * @endcode
*
* This is position relative to camera transformation, getting absolute * This is position relative to camera transformation, getting absolute
* transformation in 2D scene can be done for example using * transformation in 2D scene can be done for example using
* @ref SceneGraph::Object::absoluteTransformation(): * @ref SceneGraph::Object::absoluteTransformation():
* @code *
* @code{.cpp}
* Vector2 absolutePosition = cameraObject->absoluteTransformation().transformPoint(position); * Vector2 absolutePosition = cameraObject->absoluteTransformation().transformPoint(position);
* @endcode * @endcode
* *
@ -258,7 +262,7 @@ template<UnsignedInt dimensions, class T> class Camera: public AbstractFeature<d
/** /**
@brief Camera for two-dimensional scenes @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. information.
@see @ref Camera2D, @ref BasicCamera3D @see @ref Camera2D, @ref BasicCamera3D
*/ */
@ -276,7 +280,7 @@ typedef BasicCamera2D<Float> Camera2D;
/** /**
@brief Camera for three-dimensional scenes @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. information.
@see @ref Camera3D, @ref BasicCamera2D @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 @ref DrawableGroup and the whole group can be drawn with particular camera
using @ref Camera::draw(). using @ref Camera::draw().
## Usage @section SceneGraph-Drawable-usage Usage
First thing is to add @ref Drawable feature to some object and implement First thing is to add @ref Drawable feature to some object and implement
@ref draw() function. You can do it conveniently using multiple inheritance @ref draw() function. You can do it conveniently using multiple inheritance
(see @ref scenegraph-features for introduction). Example drawable object that (see @ref scenegraph-features for introduction). Example drawable object that
draws blue sphere: draws blue sphere:
@code
@code{.cpp}
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D; typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D; 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 that case you need to combine the two matrices manually like in the following
code. Some shaders have additional requirements for various transformation code. Some shaders have additional requirements for various transformation
matrices, see their respective documentation for details. matrices, see their respective documentation for details.
@code
@code{.cpp}
Shaders::Flat3D shader; Shaders::Flat3D shader;
shader.setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix); shader.setTransformationProjectionMatrix(camera.projectionMatrix()*transformationMatrix);
@endcode @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 some drawable group and add the drawable objects to both the scene and the
group. You can also use @ref DrawableGroup::add() and group. You can also use @ref DrawableGroup::add() and
@ref DrawableGroup::remove() instead of passing the group in the constructor. @ref DrawableGroup::remove() instead of passing the group in the constructor.
@code
@code{.cpp}
Scene3D scene; Scene3D scene;
SceneGraph::DrawableGroup3D drawables; 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()" drawing in your @ref Platform::Sdl2Application::drawEvent() "drawEvent()"
implementation. See @ref Camera2D and @ref Camera3D documentation for more implementation. See @ref Camera2D and @ref Camera3D documentation for more
information. information.
@code
@code{.cpp}
auto cameraObject = new Object3D(&scene); auto cameraObject = new Object3D(&scene);
cameraObject->translate(Vector3::zAxis(5.0f)); cameraObject->translate(Vector3::zAxis(5.0f));
auto camera = new SceneGraph::Camera3D(&cameraObject); auto camera = new SceneGraph::Camera3D(&cameraObject);
@ -123,14 +127,15 @@ void MyApplication::drawEvent() {
} }
@endcode @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 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 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 parameters once for whole group instead of setting them again in each
@ref draw() implementation. Example: @ref draw() implementation. Example:
@code
@code{.cpp}
Shaders::PhongShader shader; Shaders::PhongShader shader;
SceneGraph::DrawableGroup3D phongObjects, transparentObjects; SceneGraph::DrawableGroup3D phongObjects, transparentObjects;
@ -155,7 +160,7 @@ void MyApplication::drawEvent() {
} }
@endcode @endcode
## Explicit template specializations @section SceneGraph-Drawable-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" 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 @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. information.
@see @ref Drawable2D, @ref BasicDrawable3D @see @ref Drawable2D, @ref BasicDrawable3D
*/ */
@ -226,7 +231,7 @@ typedef BasicDrawable2D<Float> Drawable2D;
/** /**
@brief Drawable for three-dimensional scenes @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. information.
@see @ref Drawable3D, @ref BasicDrawable3D @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 @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. more information.
@see @ref DrawableGroup2D, @ref BasicDrawableGroup3D @see @ref DrawableGroup2D, @ref BasicDrawableGroup3D
*/ */
@ -273,7 +278,7 @@ typedef BasicDrawableGroup2D<Float> DrawableGroup2D;
/** /**
@brief Group of drawables for three-dimensional scenes @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. more information.
@see @ref DrawableGroup3D, @ref BasicDrawableGroup2D @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 @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. @ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup2D, @ref BasicFeatureGroup3D @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 @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. @ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup3D @see @ref FeatureGroup3D
*/ */
@ -138,7 +138,7 @@ template<class Feature> using FeatureGroup2D = BasicFeatureGroup2D<Feature, Floa
/** /**
@brief Base feature group for three-dimensional scenes @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. @ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup3D, @ref BasicFeatureGroup2D @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 @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. @ref AbstractGroupedFeature for more information.
@see @ref FeatureGroup2D @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 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.: unnecessary typing later, along with @ref Scene and possibly other types, e.g.:
@code
@code{.cpp}
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D; typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D; typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
@endcode @endcode
Uses @ref Corrade::Containers::LinkedList for efficient hierarchy management. Uses @ref Corrade::Containers::LinkedList for efficient hierarchy management.
Traversing through the list of child objects can be done using range-based for: Traversing through the list of child objects can be done using range-based for:
@code
@code{.cpp}
Object3D o; Object3D o;
for(Object3D& child: o.children()) { 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 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() possible to go in reverse order using @ref Corrade::Containers::LinkedList::last()
and @ref previousSibling(). and @ref previousSibling().
@code
@code{.cpp}
for(Object3D* child = o->children().first(); child; child = child->nextSibling()) { for(Object3D* child = o->children().first(); child; child = child->nextSibling()) {
// ... // ...
} }
@endcode @endcode
@anchor SceneGraph-Object-explicit-specializations @section SceneGraph-Object-explicit-specializations Explicit template specializations
## Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Magnum::Double "Double" 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 @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 TranslationTransformation for more information.
@see @ref TranslationTransformation2D, @ref BasicTranslationTransformation3D @see @ref TranslationTransformation2D, @ref BasicTranslationTransformation3D
*/ */
@ -195,7 +195,7 @@ typedef BasicTranslationTransformation2D<Float> TranslationTransformation2D;
/** /**
@brief Base transformation for three-dimensional scenes supporting translation @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 TranslationTransformation for more information.
@see @ref TranslationTransformation3D, @ref BasicTranslationTransformation2D @see @ref TranslationTransformation3D, @ref BasicTranslationTransformation2D
*/ */

Loading…
Cancel
Save