OrthographicProjection class Scene graph
A parallel projection: objects keep their size at any distance, for isometric, top-down, pixel-art, CAD, and 2.5D views.
The view volume is a box along the camera's forward axis from near to far, sized by size and divided by zoom. Unlike a perspective projection, near may be negative, which puts the volume's front behind the eye so an isometric camera does not clip what sits close to it.
final camera = OrthographicCamera(
position: Vector3(10, 10, 10),
target: Vector3.zero(),
projection: OrthographicProjection(size: OrthographicSize.height(12)),
);
- Inheritance
-
- Object
- CameraProjection
- OrthographicProjection
Constructors
- OrthographicProjection({OrthographicSize size = const OrthographicSize.height(10.0), double zoom = 1.0, Vector2? offset, double near = 0.0, double far = 1000.0})
-
Creates an OrthographicProjection showing
sizeworld units, divided byzoomand shifted byoffset, betweennearandfar. - OrthographicProjection.bounds({required double left, required double right, required double bottom, required double top, double near = 0.0, double far = 1000.0})
-
An explicit view volume in view-space world units, independent of the
render target's aspect ratio (it stretches to fit).
factory
- OrthographicProjection.matchingPerspective({required double fovRadiansY, required double distance, double near = 0.0, double far = 1000.0})
-
The orthographic projection that frames the plane
distancein front of the camera the same way a perspective projection withfovRadiansYdoes, for switching projections without the view jumping.factory
Properties
- far ↔ double
-
Signed distance along the view direction to the far clipping plane. Must
be greater than near.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- near ↔ double
-
Signed distance along the view direction to the near clipping plane.
Negative values extend the volume behind the eye.
getter/setter pair
- offset ↔ Vector2
-
Shifts the view volume across the view plane, in world units along the
camera's right (x) and up (y) axes, without moving the camera.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size ↔ OrthographicSize
-
How the view volume is sized against the render target's aspect ratio.
getter/setter pair
- zoom ↔ double
-
Magnification. The visible extent is size divided by this, so 2 shows
half as much, twice as large.
getter/setter pair
Methods
-
getProjectionMatrix(
double aspectRatio, {Vector2? jitter}) → Matrix4 -
Resolves size against a unit-height view of
aspectRatio. An OrthographicSize.pixelsPerUnit size needs the view's real size, which the engine supplies through getProjectionMatrixForViewport.override -
getProjectionMatrixForViewport(
Size viewportSize, {Vector2? jitter}) → Matrix4 -
Returns the projection matrix for a view
viewportSizein logical pixels.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
visibleSize(
Size viewportSize) → Vector2 -
The visible (width, height) in world units for a view of
viewportSizelogical pixels, after zoom.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited