pub struct Camera {
pub viewport: Option<Viewport>,
pub order: isize,
pub is_active: bool,
pub computed: ComputedCameraValues,
pub output_mode: CameraOutputMode,
pub msaa_writeback: MsaaWriteback,
pub clear_color: ClearColorConfig,
pub invert_culling: bool,
pub sub_camera_view: Option<SubCameraView>,
}Expand description
The defining Component for camera entities,
storing information about how and what to render through this camera.
The Camera component is added to an entity to define the properties of the viewpoint from
which rendering occurs. It defines the position of the view to render, the projection method
to transform the 3D objects into a 2D image, as well as the render target into which that image
is produced.
Note that a Camera needs a CameraRenderGraph to render anything.
This is typically provided by adding a Camera2d or Camera3d component,
but custom render graphs can also be defined. Inserting a Camera with no render
graph will emit an error at runtime.
Fields§
§viewport: Option<Viewport>If set, this camera will render to the given Viewport rectangle within the configured RenderTarget.
order: isizeCameras with a higher order are rendered later, and thus on top of lower order cameras.
is_active: boolIf this is set to true, this camera will be rendered to its specified RenderTarget. If false, this
camera will not be rendered.
computed: ComputedCameraValuesComputed values for this camera, such as the projection matrix and the render target size.
output_mode: CameraOutputModeThe CameraOutputMode for this camera.
msaa_writeback: MsaaWritebackControls when MSAA writeback occurs for this camera.
See MsaaWriteback for available options.
clear_color: ClearColorConfigThe clear color operation to perform on the render target.
invert_culling: boolWhether to switch culling mode so that materials that request backface culling cull front faces, and vice versa.
This is typically used for cameras that mirror the world that they render across a plane, because doing that flips the winding of each polygon.
This setting doesn’t affect materials that disable backface culling.
sub_camera_view: Option<SubCameraView>If set, this camera will be a sub camera of a large view, defined by a SubCameraView.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn to_logical(&self, physical_size: UVec2) -> Option<Vec2>
pub fn to_logical(&self, physical_size: UVec2) -> Option<Vec2>
Converts a physical size in this Camera to a logical size.
Sourcepub fn physical_viewport_rect(&self) -> Option<URect>
pub fn physical_viewport_rect(&self) -> Option<URect>
The rendered physical bounds URect of the camera. If the viewport field is
set to Some, this will be the rect of that custom viewport. Otherwise it will default to
the full physical rect of the current RenderTarget.
Sourcepub fn logical_viewport_rect(&self) -> Option<Rect>
pub fn logical_viewport_rect(&self) -> Option<Rect>
The rendered logical bounds Rect of the camera. If the viewport field is set to
Some, this will be the rect of that custom viewport. Otherwise it will default to the
full logical rect of the current RenderTarget.
Sourcepub fn logical_viewport_size(&self) -> Option<Vec2>
pub fn logical_viewport_size(&self) -> Option<Vec2>
The logical size of this camera’s viewport. If the viewport field is set to Some, this
will be the size of that custom viewport. Otherwise it will default to the full logical size
of the current RenderTarget.
For logic that requires the full logical size of the
RenderTarget, prefer Camera::logical_target_size.
Returns None if either:
- the function is called just after the
Camerais created, beforecamera_systemis executed, - the
RenderTargetisn’t correctly set:- it references the
PrimaryWindowwhen there is none, - it references a
Windowentity that doesn’t exist or doesn’t actually have aWindowcomponent, - it references an
Imagethat doesn’t exist (invalid handle), - it references a
TextureViewthat doesn’t exist (invalid handle).
- it references the
Sourcepub fn physical_viewport_size(&self) -> Option<UVec2>
pub fn physical_viewport_size(&self) -> Option<UVec2>
The physical size of this camera’s viewport (in physical pixels).
If the viewport field is set to Some, this
will be the size of that custom viewport. Otherwise it will default to the full physical size of
the current RenderTarget.
For logic that requires the full physical size of the RenderTarget, prefer Camera::physical_target_size.
Sourcepub fn logical_target_size(&self) -> Option<Vec2>
pub fn logical_target_size(&self) -> Option<Vec2>
The full logical size of this camera’s RenderTarget, ignoring custom viewport configuration.
Note that if the viewport field is Some, this will not represent the size of the rendered area.
For logic that requires the size of the actually rendered area, prefer Camera::logical_viewport_size.
Sourcepub fn physical_target_size(&self) -> Option<UVec2>
pub fn physical_target_size(&self) -> Option<UVec2>
The full physical size of this camera’s RenderTarget (in physical pixels),
ignoring custom viewport configuration.
Note that if the viewport field is Some, this will not represent the size of the rendered area.
For logic that requires the size of the actually rendered area, prefer Camera::physical_viewport_size.
pub fn target_scaling_factor(&self) -> Option<f32>
Sourcepub fn clip_from_view(&self) -> Mat4
pub fn clip_from_view(&self) -> Mat4
The projection matrix computed using this camera’s Projection.
Sourcepub fn world_to_viewport(
&self,
camera_transform: &GlobalTransform,
world_position: Vec3,
) -> Result<Vec2, ViewportConversionError>
pub fn world_to_viewport( &self, camera_transform: &GlobalTransform, world_position: Vec3, ) -> Result<Vec2, ViewportConversionError>
Given a position in world space, use the camera to compute the viewport-space coordinates.
To get the coordinates in Normalized Device Coordinates, you should use
world_to_ndc.
§Panics
Will panic if glam_assert is enabled and the camera_transform contains NAN
(see world_to_ndc).
Examples found in repository?
22fn draw_cursor(
23 camera_query: Single<(&Camera, &GlobalTransform)>,
24 window: Single<&Window>,
25 mut gizmos: Gizmos,
26) {
27 let (camera, camera_transform) = *camera_query;
28
29 if let Some(cursor_position) = window.cursor_position()
30 // Calculate a world position based on the cursor's position.
31 && let Ok(world_pos) = camera.viewport_to_world_2d(camera_transform, cursor_position)
32 // To test Camera::world_to_viewport, convert result back to viewport space and then back to world space.
33 && let Ok(viewport_check) = camera.world_to_viewport(camera_transform, world_pos.extend(0.0))
34 && let Ok(world_check) = camera.viewport_to_world_2d(camera_transform, viewport_check.xy())
35 {
36 gizmos.circle_2d(world_pos, 10., WHITE);
37 // Should be the same as world_pos
38 gizmos.circle_2d(world_check, 8., RED);
39 }
40}More examples
247fn example_control_system(
248 mut materials: ResMut<Assets<StandardMaterial>>,
249 controllable: Query<(&MeshMaterial3d<StandardMaterial>, &ExampleControls)>,
250 camera: Single<
251 (
252 Entity,
253 &mut Camera,
254 &mut Transform,
255 &GlobalTransform,
256 Has<Hdr>,
257 ),
258 With<Camera3d>,
259 >,
260 mut labels: Query<(&mut Node, &ExampleLabel)>,
261 mut display: Single<&mut Text, With<ExampleDisplay>>,
262 labeled: Query<&GlobalTransform>,
263 mut state: Local<ExampleState>,
264 time: Res<Time>,
265 input: Res<ButtonInput<KeyCode>>,
266 mut commands: Commands,
267) {
268 if input.pressed(KeyCode::ArrowUp) {
269 state.alpha = (state.alpha + time.delta_secs()).min(1.0);
270 } else if input.pressed(KeyCode::ArrowDown) {
271 state.alpha = (state.alpha - time.delta_secs()).max(0.0);
272 }
273
274 if input.just_pressed(KeyCode::Space) {
275 state.unlit = !state.unlit;
276 }
277
278 let randomize_colors = input.just_pressed(KeyCode::KeyC);
279
280 for (material_handle, controls) in &controllable {
281 let mut material = materials.get_mut(material_handle).unwrap();
282
283 if controls.color && randomize_colors {
284 material.base_color = Srgba {
285 red: random(),
286 green: random(),
287 blue: random(),
288 alpha: state.alpha,
289 }
290 .into();
291 } else {
292 material.base_color.set_alpha(state.alpha);
293 }
294
295 if controls.unlit {
296 material.unlit = state.unlit;
297 }
298 }
299
300 let (entity, camera, mut camera_transform, camera_global_transform, hdr) = camera.into_inner();
301
302 if input.just_pressed(KeyCode::KeyH) {
303 if hdr {
304 commands.entity(entity).remove::<Hdr>();
305 } else {
306 commands.entity(entity).insert(Hdr);
307 }
308 }
309
310 let rotation = if input.pressed(KeyCode::ArrowLeft) {
311 time.delta_secs()
312 } else if input.pressed(KeyCode::ArrowRight) {
313 -time.delta_secs()
314 } else {
315 0.0
316 };
317
318 camera_transform.rotate_around(Vec3::ZERO, Quat::from_rotation_y(rotation));
319
320 for (mut node, label) in &mut labels {
321 let world_position = labeled.get(label.entity).unwrap().translation() + Vec3::Y;
322
323 let viewport_position = camera
324 .world_to_viewport(camera_global_transform, world_position)
325 .unwrap();
326
327 node.top = px(viewport_position.y);
328 node.left = px(viewport_position.x);
329 }
330
331 display.0 = format!(
332 " HDR: {}\nAlpha: {:.2}",
333 if hdr { "ON " } else { "OFF" },
334 state.alpha
335 );
336}Sourcepub fn world_to_viewport_with_depth(
&self,
camera_transform: &GlobalTransform,
world_position: Vec3,
) -> Result<Vec3, ViewportConversionError>
pub fn world_to_viewport_with_depth( &self, camera_transform: &GlobalTransform, world_position: Vec3, ) -> Result<Vec3, ViewportConversionError>
Given a position in world space, use the camera to compute the viewport-space coordinates and depth.
To get the coordinates in Normalized Device Coordinates, you should use
world_to_ndc.
§Panics
Will panic if glam_assert is enabled and the camera_transform contains NAN
(see world_to_ndc).
Sourcepub fn viewport_to_world(
&self,
camera_transform: &GlobalTransform,
viewport_position: Vec2,
) -> Result<Ray3d, ViewportConversionError>
pub fn viewport_to_world( &self, camera_transform: &GlobalTransform, viewport_position: Vec2, ) -> Result<Ray3d, ViewportConversionError>
Returns a ray originating from the camera, that passes through everything beyond viewport_position.
The resulting ray starts on the near plane of the camera.
If the camera’s projection is orthographic the direction of the ray is always equal to camera_transform.forward().
To get the world space coordinates with Normalized Device Coordinates, you should use
ndc_to_world.
§Example
fn system(camera_query: Single<(&Camera, &GlobalTransform)>, window: Single<&Window>) {
let (camera, camera_transform) = *camera_query;
if let Some(cursor_position) = window.cursor_position()
// Calculate a ray pointing from the camera into the world based on the cursor's position.
&& let Ok(ray) = camera.viewport_to_world(camera_transform, cursor_position)
{
println!("{ray:?}");
}
}
// Run the system after transform propagation so the camera's global transform is up-to-date.
app.add_systems(PostUpdate, system.after(TransformSystems::Propagate));§Panics
Will panic if the camera’s projection matrix is invalid (has a determinant of 0) and
glam_assert is enabled (see ndc_to_world.
Examples found in repository?
190fn handle_click(
191 mouse_button_input: Res<ButtonInput<MouseButton>>,
192 camera: Single<(&Camera, &GlobalTransform)>,
193 windows: Query<&Window>,
194 mut commands: Commands,
195) {
196 let Ok(windows) = windows.single() else {
197 return;
198 };
199
200 let (camera, camera_transform) = *camera;
201 if let Some(pos) = windows
202 .cursor_position()
203 .and_then(|cursor| camera.viewport_to_world(camera_transform, cursor).ok())
204 .map(|ray| ray.origin.truncate())
205 && mouse_button_input.just_pressed(MouseButton::Left)
206 {
207 commands.trigger(ExplodeMines { pos, radius: 1.0 });
208 }
209}More examples
13fn draw_cursor(
14 camera_query: Single<(&Camera, &GlobalTransform)>,
15 ground: Single<&GlobalTransform, With<Ground>>,
16 window: Single<&Window>,
17 mut gizmos: Gizmos,
18) {
19 let (camera, camera_transform) = *camera_query;
20
21 if let Some(cursor_position) = window.cursor_position()
22 // Calculate a ray pointing from the camera into the world based on the cursor's position.
23 && let Ok(ray) = camera.viewport_to_world(camera_transform, cursor_position)
24 // Calculate if and where the ray is hitting the ground plane.
25 && let Some(point) = ray.plane_intersection_point(ground.translation(), InfinitePlane3d::new(ground.up()))
26 {
27 // Draw a circle just above the ground plane at that position.
28 gizmos.circle(
29 Isometry3d::new(
30 point + ground.up() * 0.01,
31 Quat::from_rotation_arc(Vec3::Z, ground.up().as_vec3()),
32 ),
33 0.2,
34 Color::WHITE,
35 );
36 }
37}452fn handle_mouse_clicks(
453 buttons: Res<ButtonInput<MouseButton>>,
454 windows: Query<&Window, With<PrimaryWindow>>,
455 cameras: Query<(&Camera, &GlobalTransform)>,
456 mut main_objects: Query<&mut Transform, With<MainObject>>,
457) {
458 if !buttons.pressed(MouseButton::Left) {
459 return;
460 }
461 let Some(mouse_position) = windows.iter().next().and_then(Window::cursor_position) else {
462 return;
463 };
464 let Some((camera, camera_transform)) = cameras.iter().next() else {
465 return;
466 };
467
468 // Figure out where the user clicked on the plane.
469 let Ok(ray) = camera.viewport_to_world(camera_transform, mouse_position) else {
470 return;
471 };
472 let Some(plane_intersection) =
473 ray.plane_intersection_point(Vec3::ZERO, InfinitePlane3d::new(Vec3::Y))
474 else {
475 return;
476 };
477 // Move all the main objects.
478 for mut transform in main_objects.iter_mut() {
479 transform.translation = vec3(
480 plane_intersection.x,
481 transform.translation.y,
482 plane_intersection.z,
483 );
484 }
485}443fn move_fox_on_mouse_down(
444 mut scene_roots_query: Query<&mut Transform, With<WorldAssetRoot>>,
445 windows_query: Query<&Window, With<PrimaryWindow>>,
446 cameras_query: Query<(&Camera, &GlobalTransform)>,
447 interactions_query: Query<&Interaction, With<RadioButton>>,
448 buttons: Res<ButtonInput<MouseButton>>,
449 app_status: Res<AppStatus>,
450) {
451 // Only process the mouse motion if the left mouse button is pressed, the
452 // mouse action is set to move the fox, and the pointer isn't over a UI
453 // widget.
454 if app_status.drag_action != DragAction::MoveFox
455 || !buttons.pressed(MouseButton::Left)
456 || interactions_query
457 .iter()
458 .any(|interaction| *interaction != Interaction::None)
459 {
460 return;
461 }
462
463 // Find out where the user clicked the mouse.
464 let Some(mouse_position) = windows_query
465 .iter()
466 .next()
467 .and_then(Window::cursor_position)
468 else {
469 return;
470 };
471
472 // Grab the camera.
473 let Some((camera, camera_transform)) = cameras_query.iter().next() else {
474 return;
475 };
476
477 // Figure out where the user clicked on the plane.
478 let Ok(ray) = camera.viewport_to_world(camera_transform, mouse_position) else {
479 return;
480 };
481 let Some(ray_distance) = ray.intersect_plane(Vec3::ZERO, InfinitePlane3d::new(Vec3::Y)) else {
482 return;
483 };
484 let plane_intersection = ray.origin + ray.direction.normalize() * ray_distance;
485
486 // Move the fox.
487 for mut transform in scene_roots_query.iter_mut() {
488 transform.translation = transform.translation.with_xz(plane_intersection.xz());
489 }
490}Sourcepub fn viewport_to_world_2d(
&self,
camera_transform: &GlobalTransform,
viewport_position: Vec2,
) -> Result<Vec2, ViewportConversionError>
pub fn viewport_to_world_2d( &self, camera_transform: &GlobalTransform, viewport_position: Vec2, ) -> Result<Vec2, ViewportConversionError>
Returns a 2D world position computed from a position on this Camera’s viewport.
Useful for 2D cameras and other cameras with an orthographic projection pointing along the Z axis.
To get the world space coordinates with Normalized Device Coordinates, you should use
ndc_to_world.
§Example
fn system(camera_query: Single<(&Camera, &GlobalTransform)>, window: Single<&Window>) {
let (camera, camera_transform) = *camera_query;
if let Some(cursor_position) = window.cursor_position()
// Calculate a world position based on the cursor's position.
&& let Ok(world_pos) = camera.viewport_to_world_2d(camera_transform, cursor_position)
{
println!("World position: {world_pos:.2}");
}
}
// Run the system after transform propagation so the camera's global transform is up-to-date.
app.add_systems(PostUpdate, system.after(TransformSystems::Propagate));§Panics
Will panic if the camera’s projection matrix is invalid (has a determinant of 0) and
glam_assert is enabled (see ndc_to_world.
Examples found in repository?
205fn get_cursor_world_pos(
206 mut cursor_world_pos: ResMut<CursorWorldPos>,
207 primary_window: Single<&Window, With<PrimaryWindow>>,
208 q_camera: Single<(&Camera, &GlobalTransform)>,
209) {
210 let (main_camera, main_camera_transform) = *q_camera;
211 // Get the cursor position in the world
212 cursor_world_pos.0 = primary_window.cursor_position().and_then(|cursor_pos| {
213 main_camera
214 .viewport_to_world_2d(main_camera_transform, cursor_pos)
215 .ok()
216 });
217}More examples
265fn spawn_box(
266 event: On<Pointer<Press>>,
267 window: Query<(), With<Window>>,
268 camera: Single<(&Camera, &GlobalTransform)>,
269 mut commands: Commands,
270) {
271 if event.button != PointerButton::Primary {
272 return;
273 }
274 if !window.contains(event.entity) {
275 return;
276 }
277
278 let (camera, camera_transform) = camera.into_inner();
279 let Ok(click_point) =
280 camera.viewport_to_world_2d(camera_transform, event.pointer_location.position)
281 else {
282 return;
283 };
284 commands.spawn((
285 Sprite::from_color(tailwind::RED_500, Vec2::new(100.0, 100.0)),
286 Transform::from_translation(click_point.extend(0.0)),
287 Pickable::default(),
288 Box,
289 ));
290}22fn draw_cursor(
23 camera_query: Single<(&Camera, &GlobalTransform)>,
24 window: Single<&Window>,
25 mut gizmos: Gizmos,
26) {
27 let (camera, camera_transform) = *camera_query;
28
29 if let Some(cursor_position) = window.cursor_position()
30 // Calculate a world position based on the cursor's position.
31 && let Ok(world_pos) = camera.viewport_to_world_2d(camera_transform, cursor_position)
32 // To test Camera::world_to_viewport, convert result back to viewport space and then back to world space.
33 && let Ok(viewport_check) = camera.world_to_viewport(camera_transform, world_pos.extend(0.0))
34 && let Ok(world_check) = camera.viewport_to_world_2d(camera_transform, viewport_check.xy())
35 {
36 gizmos.circle_2d(world_pos, 10., WHITE);
37 // Should be the same as world_pos
38 gizmos.circle_2d(world_check, 8., RED);
39 }
40}38fn player_movement_system(
39 mut player: Single<&mut Transform, With<Player>>,
40 camera_query: Single<(&Camera, &GlobalTransform)>,
41 window: Single<&Window>,
42) {
43 let (camera, camera_transform) = *camera_query;
44
45 if let Some(cursor_position) = window.cursor_position()
46 // Calculate a world position based on the cursor's position.
47 && let Ok(cursor_world_pos) = camera.viewport_to_world_2d(camera_transform, cursor_position)
48 {
49 // The angle an entity needs to rotate to face a point is defined
50 // by the vector between the two points (Vec2 - Vec2), which we can then
51 // turn into radians using to_angle.
52 //
53 // FRAC_PI_2 is because our sprite's ship is facing "up" so we rotate it an additional 90 degrees
54 // so that it faces the cursor.
55 player.rotation = Quat::from_rotation_z(
56 (cursor_world_pos - player.translation.xy()).to_angle() - FRAC_PI_2,
57 );
58 }
59}34fn click(
35 click: On<Pointer<Click>>,
36 mut commands: Commands,
37 squares: Query<(Entity, &Transform), With<BlinkySquare>>,
38 cameras: Query<(&Camera, &GlobalTransform)>,
39) {
40 let (camera, camera_transform) = cameras.single().unwrap();
41 let mut delayed = commands.delayed();
42 for (entity, transform) in squares.iter() {
43 // convert the pointer position to world position
44 let mouse_world_pos = camera
45 .viewport_to_world_2d(camera_transform, click.pointer_location.position)
46 .unwrap();
47
48 // delay the blinkiness by distance to cursor
49 let dist = mouse_world_pos.distance(transform.translation.truncate());
50 let delay = dist / 1000.0;
51 delayed
52 .secs(delay)
53 .entity(entity)
54 .insert(Sprite::from_color(Color::WHITE, SQUARE_SIZE));
55 delayed
56 .secs(delay + 0.1)
57 .entity(entity)
58 .insert(Sprite::from_color(Color::BLACK, SQUARE_SIZE));
59 }
60}208fn try_plot(
209 event: On<TryPlot>,
210 sprite: Query<(&Sprite, &Anchor, &GlobalTransform), With<SpriteToSave>>,
211 camera: Single<(&Camera, &GlobalTransform)>,
212 texture_atlases: Res<Assets<TextureAtlasLayout>>,
213 draw_color: Res<DrawColor>,
214 mut images: ResMut<Assets<Image>>,
215) {
216 let Ok((sprite, anchor, sprite_transform)) = sprite.get(event.entity) else {
217 return;
218 };
219 let (camera, camera_transform) = camera.into_inner();
220 let Ok(world_position) = camera.viewport_to_world_2d(camera_transform, event.location.position)
221 else {
222 return;
223 };
224 let relative_to_sprite = sprite_transform
225 .affine()
226 .inverse()
227 .transform_point3(world_position.extend(0.0));
228 let Ok(pixel_space) = sprite.compute_pixel_space_point(
229 relative_to_sprite.xy(),
230 *anchor,
231 &images,
232 &texture_atlases,
233 ) else {
234 return;
235 };
236 let pixel_coordinates = pixel_space.floor().as_uvec2();
237 let mut image = images.get_mut(&sprite.image).unwrap();
238 // For an actual drawing app, you'd at least draw a line from the last point, but this is
239 // simpler.
240 image
241 .set_color_at(pixel_coordinates.x, pixel_coordinates.y, draw_color.0)
242 .unwrap();
243}Sourcepub fn world_to_ndc<V>(
&self,
camera_transform: &GlobalTransform,
world_point: V,
) -> Option<V>
pub fn world_to_ndc<V>( &self, camera_transform: &GlobalTransform, world_point: V, ) -> Option<V>
Given a point in world space, use the camera’s viewport to compute the Normalized Device Coordinates of the point.
When the point is within the viewport the values returned will be between -1.0 (bottom left) and 1.0 (top right)
on the X and Y axes, and between 0.0 (far) and 1.0 (near) on the Z axis.
To get the coordinates in the render target’s viewport dimensions, you should use
world_to_viewport.
Returns None if the camera_transform, the world_position, or the projection matrix defined by
Projection contain NAN.
§Panics
Will panic if the camera_transform contains NAN and the glam_assert feature is enabled.
Sourcepub fn ndc_to_world<V>(
&self,
camera_transform: &GlobalTransform,
ndc_point: V,
) -> Option<V>
pub fn ndc_to_world<V>( &self, camera_transform: &GlobalTransform, ndc_point: V, ) -> Option<V>
Given a position in Normalized Device Coordinates, use the camera’s viewport to compute the world space position.
The input is expected to be in NDC: x and y in the range [-1.0, 1.0], and z in [0.0, 1.0]
(with z = 0.0 at the far plane and z = 1.0 at the near plane).
The returned value is a position in world space (your game’s world units) and is not limited to [-1.0, 1.0].
To convert from a viewport position to world space, you should use
viewport_to_world.
Returns None if the camera_transform, the ndc_point, or the projection matrix defined by
Projection contain NAN.
§Panics
Will panic if the projection matrix is invalid (has a determinant of 0) and glam_assert is enabled.
Sourcepub fn depth_ndc_to_view_z(&self, ndc_depth: f32) -> f32
pub fn depth_ndc_to_view_z(&self, ndc_depth: f32) -> f32
Converts the depth in Normalized Device Coordinates to linear view z for perspective projections.
Note: Depth values in front of the camera will be negative as -z is forward
Sourcepub fn depth_ndc_to_view_z_2d(&self, ndc_depth: f32) -> f32
pub fn depth_ndc_to_view_z_2d(&self, ndc_depth: f32) -> f32
Converts the depth in Normalized Device Coordinates to linear view z for orthographic projections.
Note: Depth values in front of the camera will be negative as -z is forward
Sourcepub fn viewport_to_ndc(
&self,
viewport_position: Vec2,
) -> Result<Vec2, ViewportConversionError>
pub fn viewport_to_ndc( &self, viewport_position: Vec2, ) -> Result<Vec2, ViewportConversionError>
Converts a position in viewport coordinates to NDC.
Trait Implementations§
Source§impl Component for Camera
Required Components: Frustum, CameraMainTextureUsages, VisibleEntities, Transform, Visibility, RenderTarget.
impl Component for Camera
Required Components: Frustum, CameraMainTextureUsages, VisibleEntities, Transform, Visibility, RenderTarget.
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Camera>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Camera>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl FromReflect for Camera
impl FromReflect for Camera
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Camera>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Camera>
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetTypeRegistration for Camera
impl GetTypeRegistration for Camera
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl IntoReturn for Camera
impl IntoReturn for Camera
Source§impl PartialReflect for Camera
impl PartialReflect for Camera
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Camera>) -> ReflectOwned
fn reflect_owned(self: Box<Camera>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Camera>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Camera>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Source§fn into_partial_reflect(self: Box<Camera>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Camera>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn reflect_partial_cmp(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<Ordering>
fn reflect_partial_cmp( &self, value: &(dyn PartialReflect + 'static), ) -> Option<Ordering>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
PartialReflect, combines reflect_clone and
take in a useful fashion, automatically constructing an appropriate
ReflectCloneError if the downcast fails.Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for Camera
impl Reflect for Camera
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any. Read moreSource§fn into_reflect(self: Box<Camera>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Camera>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§impl Struct for Camera
impl Struct for Camera
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name as a &dyn PartialReflect.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name as a
&mut dyn PartialReflect.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index as a
&dyn PartialReflect.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect.Source§fn index_of_name(&self, name: &str) -> Option<usize>
fn index_of_name(&self, name: &str) -> Option<usize>
Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
Source§fn to_dynamic_struct(&self) -> DynamicStruct
fn to_dynamic_struct(&self) -> DynamicStruct
DynamicStruct from this struct.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None if TypeInfo is not available.Source§impl TypePath for Camera
impl TypePath for Camera
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin for Camera
impl UnwindSafe for Camera
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info.Source§impl<T> ErasedBundleTemplate for T
impl<T> ErasedBundleTemplate for T
Source§unsafe fn apply(
&self,
context: &mut TemplateContext<'_, '_>,
) -> Result<(), BevyError>
unsafe fn apply( &self, context: &mut TemplateContext<'_, '_>, ) -> Result<(), BevyError>
entity. Read moreSource§fn clone_template(&self) -> Box<dyn ErasedBundleTemplate>
fn clone_template(&self) -> Box<dyn ErasedBundleTemplate>
Clone.Source§impl<T> ErasedComponentTemplate for T
impl<T> ErasedComponentTemplate for T
Source§unsafe fn apply(
&self,
context: &mut TemplateContext<'_, '_>,
bundle_writer: &mut BundleWriter<'_>,
) -> Result<(), BevyError>
unsafe fn apply( &self, context: &mut TemplateContext<'_, '_>, bundle_writer: &mut BundleWriter<'_>, ) -> Result<(), BevyError>
entity. Read moreSource§fn clone_template(&self) -> Box<dyn ErasedComponentTemplate>
fn clone_template(&self) -> Box<dyn ErasedComponentTemplate>
Clone.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromTemplate for T
impl<T> FromTemplate for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T> HitDataExtra for T
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
Source§fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
func, and turns it into a TemplatePatch.Source§impl<T> PatchTemplate for Twhere
T: Template,
impl<T> PatchTemplate for Twhere
T: Template,
Source§fn patch_template<F>(func: F) -> TemplatePatch<F, T>
fn patch_template<F>(func: F) -> TemplatePatch<F, T>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().impl<T> Reflectable for T
impl<T> Settings for T
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.