# Camera

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-media3d/struct-camera/

**struct** · [`ferroui-media3d`](/docs/0.5.0/api/ferroui-media3d/) · v0.5.0

```rust
struct Camera
```

WPF's `Camera`: the base of the cameras, with a `Transform` that places the camera in the
world.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L22)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`get_view_matrix`](#function-get_view_matrix)
- [`get_projection_matrix`](#function-get_projection_matrix)
- [`transform_property`](#function-transform_property)
- [`construct`](#function-construct)
- [`transform`](#function-transform)
- [`set_transform`](#function-set_transform)
- [`changed`](#function-changed)
- [`world_position`](#function-world_position)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L28)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<Camera>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L28)

<a id="function-get_view_matrix"></a>

### get_view_matrix

```rust
fn get_view_matrix(self: &Self) -> Matrix3D
```

The matrix from the world to the coordinates of the camera, its transform included
(WPF's `GetViewMatrix`). Not finite when the transform has no inverse: the camera
then shows nothing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L28)

<a id="function-get_projection_matrix"></a>

### get_projection_matrix

```rust
fn get_projection_matrix(self: &Self, aspect_ratio: f64, near_plane_distance: f64, far_plane_distance: f64) -> Matrix3D
```

The matrix from the coordinates of the camera to the clip space for the aspect ratio
(width over height) and the near and far planes (WPF's `GetProjectionMatrix`, with
the planes given, as the snapshot fits them to the scene). A matrix camera ignores
the planes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L28)

<a id="function-transform_property"></a>

### transform_property

```rust
fn transform_property() -> &'static StyledProperty<Option<Ref<Transform3D>>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L71)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L79)

<a id="function-transform"></a>

### transform

```rust
fn transform(self: &Self) -> Option<Ref<Transform3D>>
```

The transform that places the camera in the world; none is the identity.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L84)

<a id="function-set_transform"></a>

### set_transform

```rust
fn set_transform(self: &Self, value: Option<Ref<Transform3D>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L88)

<a id="function-changed"></a>

### changed

```rust
fn changed(self: &Self, handler: impl Fn(Scene3DChange) -> () + 'static) -> Subscription
```

Calls `handler` on every change of the camera, until the returned guard is dropped.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L93)

<a id="function-world_position"></a>

### world_position

```rust
fn world_position(self: &Self) -> Option<Point3D>
```

The position of the camera in the world: the origin of its coordinates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media3D/camera.rs#L98)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`CameraImplExt`](/docs/0.5.0/api/ferroui-media3d/trait-cameraimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Camera>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`CameraImpl`](/docs/0.5.0/api/ferroui-media3d/trait-cameraimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
