Browse Source

Getting rid of <>, part 7: documentation.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
c3de32e55f
  1. 22
      doc/scenegraph.dox
  2. 17
      src/SceneGraph/AbstractFeature.h
  3. 6
      src/SceneGraph/Animable.h
  4. 2
      src/SceneGraph/Camera2D.h
  5. 2
      src/SceneGraph/Camera3D.h
  6. 4
      src/SceneGraph/Drawable.h
  7. 4
      src/SceneGraph/Object.h
  8. 4
      src/Text/TextRenderer.h

22
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
<tt>%AbstractObject<2></tt> or <tt>%MatrixTransformation3D<></tt> instead of
<tt>%AbstractObject<2, Float></tt> and <tt>%MatrixTransformation3D&lt;Float&gt;</tt>.
@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<SceneGraph::MatrixTransformation3D<>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D<>> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> 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);
}

17
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<class T> TransformingFeature(SceneGraph::Object<T>* 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<MatrixTransformation3D<>>", 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<MatrixTransformation3D>", 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

6
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<SceneGraph::MatrixTransformation3D<>> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D<>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> 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);
// ...
}

2
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

2
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

4
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<SceneGraph::MatrixTransformation3D<>> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D<>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
class DrawableObject: public Object3D, SceneGraph::Drawable3D {
public:

4
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<SceneGraph::MatrixTransformation3D<>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D<>> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
@endcode
Uses Corrade::Containers::LinkedList for parent/children relationship.

4
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();

Loading…
Cancel
Save