This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

1. Minimal proposal

2. Rationale

Clutter has always used a perspective projection by default on the Stage; a perspective projection has the advantage of easily show the 3D transformations available with Clutter, but it does complicate the life and expectation of users that wish to have a pure 2D UI, with a specific 3D viewport only when needed, or no 3D viewport at all.

Going from a perspective projection to an orthographic one on a per-actor basis is also complicated by the need to unroll part of the matrix stack to avoid nodes in the scene graph to go out of sight.

Clipping is also complicated by the fact that we have to take into consideration a complex transformation scenario, even if most of our user base won't end up into it.

By switching to an orthographic projection as the default for ClutterStage we would have a default behaviour that kept scaling, as well as rotation along the Z axis, which are the two most common transformations used by Clutter developers; perspective transformation could be provided as a simple opt-in for actors to apply to their children, simply by changing the ClutterActor:child-transform matrix to have a perspective component, for instance:

  ClutterMatrix aMatrix = CLUTTER_MATRIX_INIT_IDENTITY;

  float zDistance = 850.f;
  aMatrix.zw = 1.0f / -zDistance;
  clutter_actor_set_child_transform (container, &aMatrix);

3. Implementation/changes

3.1. New API

4. Issues/discussion


2024-10-23 10:58