repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/shadow_caster_receiver.rs
examples/3d/shadow_caster_receiver.rs
//! Demonstrates how to prevent meshes from casting/receiving shadows in a 3d scene. use std::f32::consts::PI; use bevy::{ color::palettes::basic::{BLUE, LIME, RED}, light::{CascadeShadowConfigBuilder, NotShadowCaster, NotShadowReceiver}, prelude::*, }; fn main() { println!( "Controls: C ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/lines.rs
examples/3d/lines.rs
//! Create a custom material to draw basic lines in 3D use bevy::{ asset::RenderAssetUsages, mesh::{MeshVertexBufferLayoutRef, PrimitiveTopology}, pbr::{MaterialPipeline, MaterialPipelineKey}, prelude::*, reflect::TypePath, render::render_resource::{ AsBindGroup, PolygonMode, RenderPipe...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/clustered_decals.rs
examples/3d/clustered_decals.rs
//! Demonstrates clustered decals, which affix decals to surfaces. use std::f32::consts::{FRAC_PI_3, PI}; use std::fmt::{self, Formatter}; use bevy::{ color::palettes::css::{LIME, ORANGE_RED, SILVER}, input::mouse::AccumulatedMouseMotion, light::ClusteredDecal, pbr::{decal, ExtendedMaterial, MaterialE...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/depth_of_field.rs
examples/3d/depth_of_field.rs
//! Demonstrates depth of field (DOF). //! //! The depth of field effect simulates the blur that a real camera produces on //! objects that are out of focus. //! //! The test scene is inspired by [a blog post on depth of field in Unity]. //! However, the technique used in Bevy has little to do with that blog post, //! ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/specular_tint.rs
examples/3d/specular_tint.rs
//! Demonstrates specular tints and maps. use std::f32::consts::PI; use bevy::{color::palettes::css::WHITE, core_pipeline::Skybox, prelude::*, render::view::Hdr}; /// The camera rotation speed in radians per frame. const ROTATION_SPEED: f32 = 0.005; /// The rate at which the specular tint hue changes in degrees per ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/skybox.rs
examples/3d/skybox.rs
//! Load a cubemap texture onto a cube like a skybox and cycle through different compressed texture formats #[cfg(not(target_arch = "wasm32"))] use bevy::anti_alias::taa::TemporalAntiAliasing; use bevy::{ camera_controller::free_camera::{FreeCamera, FreeCameraPlugin}, core_pipeline::Skybox, image::Compres...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/atmosphere.rs
examples/3d/atmosphere.rs
//! This example showcases pbr atmospheric scattering #[cfg(feature = "free_camera")] use bevy::camera_controller::free_camera::{FreeCamera, FreeCameraPlugin}; use std::f32::consts::PI; use bevy::{ anti_alias::fxaa::Fxaa, camera::Exposure, color::palettes::css::BLACK, core_pipeline::tonemapping::Tonema...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/split_screen.rs
examples/3d/split_screen.rs
//! Renders four cameras to the same window to accomplish "split screen". use std::f32::consts::PI; use bevy::{ camera::Viewport, light::CascadeShadowConfigBuilder, prelude::*, window::WindowResized, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) ....
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/3d_scene.rs
examples/3d/3d_scene.rs
//! A simple 3D scene with light shining over a cube sitting on a plane. use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } /// set up a simple 3D scene fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/fog.rs
examples/3d/fog.rs
//! Distance-based fog visual effects are used in many games to give a soft falloff of visibility to the player for performance and/or visual design reasons. The further away something in a 3D world is from the camera, the more it's mixed or completely overwritten by a given color. //! //! In Bevy we can add the [`Dist...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/ssr.rs
examples/3d/ssr.rs
//! Demonstrates screen space reflections in deferred rendering. use std::ops::Range; use bevy::{ anti_alias::fxaa::Fxaa, color::palettes::css::{BLACK, WHITE}, core_pipeline::Skybox, image::{ ImageAddressMode, ImageFilterMode, ImageLoaderSettings, ImageSampler, ImageSamplerDescriptor, ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/occlusion_culling.rs
examples/3d/occlusion_culling.rs
//! Demonstrates occlusion culling. //! //! This demo rotates many small cubes around a rotating large cube at the //! origin. At all times, the large cube will be occluding several of the small //! cubes. The demo displays the number of cubes that were actually rendered, so //! the effects of occlusion culling can be ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/irradiance_volumes.rs
examples/3d/irradiance_volumes.rs
//! This example shows how irradiance volumes affect the indirect lighting of //! objects in a scene. //! //! The controls are as follows: //! //! * Space toggles the irradiance volume on and off. //! //! * Enter toggles the camera rotation on and off. //! //! * Tab switches the object between a plain sphere and a runn...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/reflection_probes.rs
examples/3d/reflection_probes.rs
//! This example shows how to place reflection probes in the scene. //! //! Press Space to cycle through the reflection modes: //! //! 1. A pre-generated [`EnvironmentMapLight`] acting as a reflection probe, with both the skybox and cubes //! 2. A runtime-generated [`GeneratedEnvironmentMapLight`] acting as a reflectio...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/motion_blur.rs
examples/3d/motion_blur.rs
//! Demonstrates how to enable per-object motion blur. This rendering feature can be configured per //! camera using the [`MotionBlur`] component.z use bevy::{ image::{ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor}, math::ops, post_process::motion_blur::MotionBlur, prelude::*,...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/color_grading.rs
examples/3d/color_grading.rs
//! Demonstrates color grading with an interactive adjustment UI. use std::{ f32::consts::PI, fmt::{self, Formatter}, }; use bevy::{ light::CascadeShadowConfigBuilder, prelude::*, render::view::{ColorGrading, ColorGradingGlobal, ColorGradingSection, Hdr}, }; use std::fmt::Display; static FONT_PAT...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/wireframe.rs
examples/3d/wireframe.rs
//! Showcases wireframe rendering. //! //! Wireframes currently do not work when using webgl or webgpu. //! Supported platforms: //! - DX12 //! - Vulkan //! - Metal //! //! This is a native only feature. use bevy::{ color::palettes::css::*, pbr::wireframe::{NoWireframe, Wireframe, WireframeColor, WireframeConf...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/3d_viewport_to_world.rs
examples/3d/3d_viewport_to_world.rs
//! This example demonstrates how to use the `Camera::viewport_to_world` method. use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, draw_cursor) .run(); } fn draw_cursor( camera_query: Single<(&Camera, &G...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/transmission.rs
examples/3d/transmission.rs
//! This example showcases light transmission //! //! ## Controls //! //! | Key Binding | Action | //! |:-------------------|:-----------------------------------------------------| //! | `J`/`K`/`L`/`;` | Change Screen Space Transmission Quality | //! ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/3d_shapes.rs
examples/3d/3d_shapes.rs
//! Here we use shape primitives to generate meshes for 3d objects as well as attaching a runtime-generated patterned texture to each 3d object. //! //! "Shape primitives" here are just the mathematical definition of certain shapes, they're not meshes on their own! A sphere with radius `1.0` can be defined with [`Spher...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gizmos/axes.rs
examples/gizmos/axes.rs
//! This example demonstrates the implementation and behavior of the axes gizmo. use bevy::{camera::primitives::Aabb, prelude::*}; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha8Rng; use std::f32::consts::PI; const TRANSITION_DURATION: f32 = 2.0; fn main() { App::new() .add_plugins(DefaultPlugins)...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gizmos/3d_gizmos.rs
examples/gizmos/3d_gizmos.rs
//! This example demonstrates Bevy's immediate mode drawing API intended for visual debugging. use bevy::{ camera_controller::free_camera::{FreeCamera, FreeCameraPlugin}, color::palettes::css::*, prelude::*, }; use std::f32::consts::PI; fn main() { App::new() .add_plugins((DefaultPlugins, Free...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gizmos/2d_gizmos.rs
examples/gizmos/2d_gizmos.rs
//! This example demonstrates Bevy's immediate mode drawing API intended for visual debugging. use std::f32::consts::{FRAC_PI_2, PI, TAU}; use bevy::{color::palettes::css::*, math::Isometry2d, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .init_gizmo_group::<MyRoundGizmos>() ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gizmos/light_gizmos.rs
examples/gizmos/light_gizmos.rs
//! This example demonstrates how to visualize lights properties through the gizmo API. use std::f32::consts::{FRAC_PI_2, PI}; use bevy::{ color::palettes::css::{DARK_CYAN, GOLD, GRAY, PURPLE}, prelude::*, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup)...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/remote/client.rs
examples/remote/client.rs
//! A simple command line client that allows issuing queries to a remote Bevy //! app via the BRP. //! This example requires the `bevy_remote` feature to be enabled. //! You can run it with the following command: //! ```text //! cargo run --example client --features="bevy_remote" //! ``` //! This example assumes that t...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/remote/server.rs
examples/remote/server.rs
//! A Bevy app that you can connect to with the BRP and edit. //! Run this example with the `remote` feature enabled: //! ```bash //! cargo run --example server --features="bevy_remote" //! ``` use bevy::math::ops::cos; use bevy::{ input::common_conditions::input_just_pressed, prelude::*, remote::{http::Re...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/window_resizing.rs
examples/window/window_resizing.rs
//! This example illustrates how to resize windows, and how to respond to a window being resized. use bevy::{prelude::*, window::WindowResized}; fn main() { App::new() .insert_resource(ResolutionSettings { large: Vec2::new(1920.0, 1080.0), medium: Vec2::new(800.0, 600.0), ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/window_settings.rs
examples/window/window_settings.rs
//! Illustrates how to change window settings and shows how to affect //! the mouse pointer in various ways. #[cfg(feature = "custom_cursor")] use bevy::window::{CustomCursor, CustomCursorImage}; use bevy::{ diagnostic::{FrameCount, FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, window::{ ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/multi_window_text.rs
examples/window/multi_window_text.rs
//! Renders text to multiple windows with different scale factors using both Text and Text2d. use bevy::{ camera::{visibility::RenderLayers, RenderTarget}, color::palettes::css::{LIGHT_CYAN, YELLOW}, prelude::*, sprite::Text2dShadow, window::{WindowRef, WindowResolution}, }; fn main() { App::ne...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/scale_factor_override.rs
examples/window/scale_factor_override.rs
//! This example illustrates how to override the window scale factor imposed by the //! operating system. use bevy::{prelude::*, window::WindowResolution}; #[derive(Component)] struct CustomText; fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/screenshot.rs
examples/window/screenshot.rs
//! An example showing how to save screenshots to disk use bevy::{ prelude::*, render::view::screenshot::{save_to_disk, Capturing, Screenshot}, window::{CursorIcon, SystemCursorIcon}, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_syste...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/low_power.rs
examples/window/low_power.rs
//! This example illustrates how to run a winit window in a reactive, low power mode. //! //! This is useful for making desktop applications, or any other program that doesn't need to be //! running the event loop non-stop. use bevy::{ prelude::*, window::{PresentMode, RequestRedraw, WindowPlugin}, winit::...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/multiple_windows.rs
examples/window/multiple_windows.rs
//! Uses two windows to visualize a 3D model from different angles. use bevy::{camera::RenderTarget, prelude::*, window::WindowRef}; fn main() { App::new() // By default, a primary window gets spawned by `WindowPlugin`, contained in `DefaultPlugins` .add_plugins(DefaultPlugins) .add_system...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/monitor_info.rs
examples/window/monitor_info.rs
//! Displays information about available monitors (displays). use bevy::{ camera::RenderTarget, prelude::*, window::{ExitCondition, Monitor, WindowMode, WindowRef}, }; fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: None, exit_condi...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/custom_cursor_image.rs
examples/window/custom_cursor_image.rs
//! Illustrates how to use a custom cursor image with a texture atlas and //! animation. use std::time::Duration; use bevy::{ prelude::*, window::{CursorIcon, CustomCursor, CustomCursorImage}, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems( Startup, ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/transparent_window.rs
examples/window/transparent_window.rs
//! Shows how to display a window in transparent mode. //! //! This feature works as expected depending on the platform. Please check the //! [documentation](https://docs.rs/bevy/latest/bevy/prelude/struct.Window.html#structfield.transparent) //! for more details. use bevy::prelude::*; #[cfg(any(target_os = "macos", t...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/window_drag_move.rs
examples/window/window_drag_move.rs
//! This example illustrates drag move and drag resize without window //! decorations. //! //! When window decorations are not present, the user cannot drag a window by //! its titlebar to change its position. The `start_drag_move()` function //! permits a user to drag a window by left clicking anywhere in the window; ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/window/clear_color.rs
examples/window/clear_color.rs
//! Shows how to set the solid color that is used to paint the window before the frame gets drawn. //! //! Acts as background color, since pixels that are not drawn in a frame remain unchanged. use bevy::{color::palettes::css::PURPLE, prelude::*}; fn main() { App::new() .insert_resource(ClearColor(Color::...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/helpers/widgets.rs
examples/helpers/widgets.rs
//! Simple widgets for example UI. //! //! Unlike other examples, which demonstrate an application, this demonstrates a plugin library. use bevy::prelude::*; /// An event that's sent whenever the user changes one of the settings by /// clicking a radio button. #[derive(Clone, Message, Deref, DerefMut)] pub struct Wid...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/mobile/src/lib.rs
examples/mobile/src/lib.rs
//! A 3d Scene with a button and playing sound. use bevy::{ color::palettes::basic::*, input::{gestures::RotationGesture, touch::TouchPhase}, log::{Level, LogPlugin}, prelude::*, window::{AppLifecycle, ScreenEdge, WindowMode}, winit::WinitSettings, }; // the `bevy_main` proc_macro generates th...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/mobile/src/main.rs
examples/mobile/src/main.rs
//! The entry point for iOS applications. use bevy_mobile_example::main;
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/bounding_2d.rs
examples/math/bounding_2d.rs
//! This example demonstrates bounding volume intersections. use bevy::{ color::palettes::css::*, math::{bounding::*, ops, Isometry2d}, prelude::*, }; fn main() { App::new() .add_plugins(DefaultPlugins) .init_state::<Test>() .add_systems(Startup, setup) .add_systems( ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/sampling_primitives.rs
examples/math/sampling_primitives.rs
//! This example shows how to sample random points from primitive shapes. use std::f32::consts::PI; use bevy::{ core_pipeline::tonemapping::Tonemapping, input::mouse::{AccumulatedMouseMotion, AccumulatedMouseScroll, MouseButtonInput}, math::prelude::*, post_process::bloom::Bloom, prelude::*, }; us...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/render_primitives.rs
examples/math/render_primitives.rs
//! This example demonstrates how each of Bevy's math primitives look like in 2D and 3D with meshes //! and with gizmos use bevy::{input::common_conditions::input_just_pressed, math::Isometry2d, prelude::*}; const LEFT_RIGHT_OFFSET_2D: f32 = 200.0; const LEFT_RIGHT_OFFSET_3D: f32 = 2.0; fn main() { let mut app =...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/custom_primitives.rs
examples/math/custom_primitives.rs
//! This example demonstrates how you can add your own custom primitives to bevy highlighting //! traits you may want to implement for your primitives to achieve different functionalities. use std::f32::consts::{PI, SQRT_2}; #[cfg(not(target_family = "wasm"))] use bevy::pbr::wireframe::{WireframeConfig, WireframePlug...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/cubic_splines.rs
examples/math/cubic_splines.rs
//! This example exhibits different available modes of constructing cubic Bezier curves. use bevy::{ app::{App, Startup, Update}, color::*, ecs::system::Commands, gizmos::gizmos::Gizmos, input::{mouse::MouseButtonInput, ButtonState}, math::{cubic_splines::*, vec2}, prelude::*, }; fn main()...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/math/random_sampling.rs
examples/math/random_sampling.rs
//! This example shows how to sample random points from primitive shapes. use bevy::{ input::mouse::{AccumulatedMouseMotion, MouseButtonInput}, math::prelude::*, mesh::SphereKind, prelude::*, }; use rand::{distr::Distribution, SeedableRng}; use rand_chacha::ChaCha8Rng; fn main() { App::new() ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/transforms/translation.rs
examples/transforms/translation.rs
//! Illustrates how to move an object along an axis. use bevy::prelude::*; // Define a struct to keep some information about our entity. // Here it's an arbitrary movement speed, the spawn location, and a maximum distance from it. #[derive(Component)] struct Movable { spawn: Vec3, max_distance: f32, speed...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/transforms/transform.rs
examples/transforms/transform.rs
//! Shows multiple transformations of objects. use std::f32::consts::PI; use bevy::{color::palettes::basic::YELLOW, prelude::*}; // A struct for additional data of for a moving cube. #[derive(Component)] struct CubeState { start_pos: Vec3, move_speed: f32, turn_speed: f32, } // A struct adding informati...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/transforms/3d_rotation.rs
examples/transforms/3d_rotation.rs
//! Illustrates how to rotate an object around an axis. use bevy::prelude::*; use std::f32::consts::TAU; // Define a component to designate a rotation speed to an entity. #[derive(Component)] struct Rotatable { speed: f32, } fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(St...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/transforms/scale.rs
examples/transforms/scale.rs
//! Illustrates how to scale an object in each direction. use std::f32::consts::PI; use bevy::prelude::*; // Define a component to keep information for the scaled object. #[derive(Component)] struct Scaling { scale_direction: Vec3, scale_speed: f32, max_element_size: f32, min_element_size: f32, } //...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/transforms/align.rs
examples/transforms/align.rs
//! This example shows how to align the orientations of objects in 3D space along two axes using the `Transform::align` API. use bevy::{ color::palettes::basic::{GRAY, RED, WHITE}, input::mouse::{AccumulatedMouseMotion, MouseButtonInput}, math::StableInterpolate, prelude::*, }; use rand::{Rng, Seedable...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material_2d.rs
examples/shader/shader_material_2d.rs
//! A shader and a material that uses it. use bevy::{ prelude::*, reflect::TypePath, render::render_resource::AsBindGroup, shader::ShaderRef, sprite_render::{AlphaMode2d, Material2d, Material2dPlugin}, }; /// This example uses a shader source file from the assets subdirectory const SHADER_ASSET_PA...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/compute_shader_game_of_life.rs
examples/shader/compute_shader_game_of_life.rs
//! A compute shader that simulates Conway's Game of Life. //! //! Compute shaders use the GPU for computing arbitrary information, that may be independent of what //! is rendered to the screen. use bevy::{ asset::RenderAssetUsages, prelude::*, render::{ extract_resource::{ExtractResource, ExtractR...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/fallback_image.rs
examples/shader/fallback_image.rs
//! This example tests that all texture dimensions are supported by //! `FallbackImage`. //! //! When running this example, you should expect to see a window that only draws //! the clear color. The test material does not shade any geometry; this example //! only tests that the images are initialized and bound so that ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material.rs
examples/shader/shader_material.rs
//! A shader and a material that uses it. use bevy::{ prelude::*, reflect::TypePath, render::render_resource::AsBindGroup, shader::ShaderRef, }; /// This example uses a shader source file from the assets subdirectory const SHADER_ASSET_PATH: &str = "shaders/custom_material.wgsl"; fn main() { App::new() ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/animate_shader.rs
examples/shader/animate_shader.rs
//! A shader that uses dynamic data like the time since startup. //! The time data is in the globals binding which is part of the `mesh_view_bindings` shader import. use bevy::{ prelude::*, reflect::TypePath, render::render_resource::AsBindGroup, shader::ShaderRef, }; /// This example uses a shader source file fr...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/storage_buffer.rs
examples/shader/storage_buffer.rs
//! This example demonstrates how to use a storage buffer with `AsBindGroup` in a custom material. use bevy::{ mesh::MeshTag, prelude::*, reflect::TypePath, render::{render_resource::AsBindGroup, storage::ShaderStorageBuffer}, shader::ShaderRef, }; const SHADER_ASSET_PATH: &str = "shaders/storage_b...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_prepass.rs
examples/shader/shader_prepass.rs
//! Bevy has an optional prepass that is controlled per-material. A prepass is a rendering pass that runs before the main pass. //! It will optionally generate various view textures. Currently it supports depth, normal, and motion vector textures. //! The textures are not generated for any material using alpha blending...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material_screenspace_texture.rs
examples/shader/shader_material_screenspace_texture.rs
//! A shader that samples a texture with view-independent UV coordinates. use bevy::{ prelude::*, reflect::TypePath, render::render_resource::AsBindGroup, shader::ShaderRef, }; /// This example uses a shader source file from the assets subdirectory const SHADER_ASSET_PATH: &str = "shaders/custom_material_screensp...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/gpu_readback.rs
examples/shader/gpu_readback.rs
//! Simple example demonstrating the use of the [`Readback`] component to read back data from the GPU //! using both a storage buffer and texture. use bevy::{ asset::RenderAssetUsages, prelude::*, render::{ extract_resource::{ExtractResource, ExtractResourcePlugin}, gpu_readback::{Readback,...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/extended_material.rs
examples/shader/extended_material.rs
//! Demonstrates using a custom extension to the `StandardMaterial` to modify the results of the builtin pbr shader. use bevy::{ color::palettes::basic::RED, pbr::{ExtendedMaterial, MaterialExtension, OpaqueRendererMethod}, prelude::*, render::render_resource::*, shader::ShaderRef, }; /// This exa...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/extended_material_bindless.rs
examples/shader/extended_material_bindless.rs
//! Demonstrates bindless `ExtendedMaterial`. use std::f32::consts::FRAC_PI_2; use bevy::{ color::palettes::{css::RED, tailwind::GRAY_600}, mesh::{SphereKind, SphereMeshBuilder}, pbr::{ExtendedMaterial, MaterialExtension, MeshMaterial3d}, prelude::*, render::render_resource::{AsBindGroup, ShaderTy...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material_glsl.rs
examples/shader/shader_material_glsl.rs
//! A shader that uses the GLSL shading language. use bevy::{ prelude::*, reflect::TypePath, render::render_resource::AsBindGroup, shader::ShaderRef, }; /// This example uses shader source files from the assets subdirectory const VERTEX_SHADER_ASSET_PATH: &str = "shaders/custom_material.vert"; const FRAGMENT_SHAD...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/array_texture.rs
examples/shader/array_texture.rs
//! This example illustrates how to create a texture for use with a //! `texture_2d_array<f32>` shader uniform variable and then how to sample from //! that texture in the shader by using a `MeshTag` component on the mesh //! entity. use bevy::{ image::{ImageArrayLayout, ImageLoaderSettings}, mesh::MeshTag, ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_defs.rs
examples/shader/shader_defs.rs
//! A shader that uses "shaders defs", which selectively toggle parts of a shader. use bevy::{ mesh::MeshVertexBufferLayoutRef, pbr::{MaterialPipeline, MaterialPipelineKey}, prelude::*, reflect::TypePath, render::render_resource::{ AsBindGroup, RenderPipelineDescriptor, SpecializedMeshPipel...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material_bindless.rs
examples/shader/shader_material_bindless.rs
//! A material that uses bindless textures. use bevy::prelude::*; use bevy::render::render_resource::{AsBindGroup, ShaderType}; use bevy::shader::ShaderRef; const SHADER_ASSET_PATH: &str = "shaders/bindless_material.wgsl"; // `#[bindless(limit(4))]` indicates that we want Bevy to group materials into // bind groups ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/automatic_instancing.rs
examples/shader/automatic_instancing.rs
//! Shows that multiple instances of a cube are automatically instanced in one draw call //! Try running this example in a graphics profiler and all the cubes should be only a single draw call. //! Also demonstrates how to use `MeshTag` to use external data in a custom material. use bevy::{ mesh::MeshTag, prelude:...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/shader/shader_material_wesl.rs
examples/shader/shader_material_wesl.rs
//! A shader that uses the WESL shading language. use bevy::{ mesh::MeshVertexBufferLayoutRef, pbr::{MaterialPipeline, MaterialPipelineKey}, prelude::*, reflect::TypePath, render::render_resource::{ AsBindGroup, RenderPipelineDescriptor, SpecializedMeshPipelineError, }, shader::{Sha...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/update_gltf_scene.rs
examples/gltf/update_gltf_scene.rs
//! Update a scene from a glTF file, either by spawning the scene as a child of another entity, //! or by accessing the entities of the scene. use bevy::{light::DirectionalLightShadowMap, prelude::*}; fn main() { App::new() .insert_resource(DirectionalLightShadowMap { size: 4096 }) .add_plugins(De...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/custom_gltf_vertex_attribute.rs
examples/gltf/custom_gltf_vertex_attribute.rs
//! Renders a glTF mesh in 2D with a custom vertex attribute. use bevy::{ gltf::GltfPlugin, mesh::{MeshVertexAttribute, MeshVertexBufferLayoutRef}, prelude::*, reflect::TypePath, render::render_resource::*, shader::ShaderRef, sprite_render::{Material2d, Material2dKey, Material2dPlugin}, }; ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/load_gltf_extras.rs
examples/gltf/load_gltf_extras.rs
//! Loads and renders a glTF file as a scene, and list all the different `gltf_extras`. use bevy::{ gltf::{GltfExtras, GltfMaterialExtras, GltfMeshExtras, GltfSceneExtras}, prelude::*, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/gltf_extension_animation_graph.rs
examples/gltf/gltf_extension_animation_graph.rs
//! Uses glTF extension processing to play an animation on a skinned glTF model of a fox. use std::f32::consts::PI; use bevy::{ asset::LoadContext, ecs::entity::EntityHashSet, gltf::extensions::{GltfExtensionHandler, GltfExtensionHandlers}, light::CascadeShadowConfigBuilder, platform::collections:...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/gltf_extension_mesh_2d.rs
examples/gltf/gltf_extension_mesh_2d.rs
//! Uses glTF extension processing to convert incoming 3d Meshes to 2d Meshes use bevy::{ asset::LoadContext, gltf::extensions::{GltfExtensionHandler, GltfExtensionHandlers}, gltf::GltfPlugin, mesh::{MeshVertexAttribute, MeshVertexBufferLayoutRef}, prelude::*, reflect::TypePath, render::ren...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/edit_material_on_gltf.rs
examples/gltf/edit_material_on_gltf.rs
//! Showcases how to change the material of a `Scene` spawned from a Gltf use bevy::{ audio::AudioPlugin, color::palettes, gltf::GltfMaterialName, prelude::*, scene::SceneInstanceReady, }; fn main() { App::new() .add_plugins(DefaultPlugins.build().disable::<AudioPlugin>()) .add_systems(Sta...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/load_gltf.rs
examples/gltf/load_gltf.rs
//! Loads and renders a glTF file as a scene. use bevy::{ light::{CascadeShadowConfigBuilder, DirectionalLightShadowMap}, prelude::*, }; use std::f32::consts::*; fn main() { App::new() .insert_resource(DirectionalLightShadowMap { size: 4096 }) .add_plugins(DefaultPlugins) .add_syst...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/gltf_skinned_mesh.rs
examples/gltf/gltf_skinned_mesh.rs
//! Skinned mesh example with mesh and joints data loaded from a glTF file. //! Example taken from <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_019_SimpleSkin.md> use std::f32::consts::*; use bevy::{math::ops, mesh::skinning::SkinnedMesh, prelude::*}; fn main() { App::new...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/gltf/query_gltf_primitives.rs
examples/gltf/query_gltf_primitives.rs
//! This example demonstrates how to query a [`StandardMaterial`] within a glTF scene. //! It is particularly useful for glTF scenes with a mesh that consists of multiple primitives. use std::f32::consts::PI; use bevy::{gltf::GltfMaterialName, mesh::VertexAttributeValues, prelude::*}; fn main() { App::new() ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/movement/smooth_follow.rs
examples/movement/smooth_follow.rs
//! This example demonstrates how to use interpolation to make one entity smoothly follow another. use bevy::{ math::{prelude::*, vec3, NormedVectorSpace}, prelude::*, }; use rand::SeedableRng; use rand_chacha::ChaCha8Rng; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(St...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/movement/physics_in_fixed_timestep.rs
examples/movement/physics_in_fixed_timestep.rs
//! This example shows how to properly handle player input, //! advance a physics simulation in a fixed timestep, and display the results. //! //! The classic source for how and why this is done is Glenn Fiedler's article //! [Fix Your Timestep!](https://gafferongames.com/post/fix_your_timestep/). //! For a more Bevy-c...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/projection_zoom.rs
examples/camera/projection_zoom.rs
//! Shows how to zoom orthographic and perspective projection cameras. use std::{f32::consts::PI, ops::Range}; use bevy::{camera::ScalingMode, input::mouse::AccumulatedMouseScroll, prelude::*}; #[derive(Debug, Resource)] struct CameraSettings { /// The height of the viewport in world units when the orthographic ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/free_camera_controller.rs
examples/camera/free_camera_controller.rs
//! This example showcases the default `FreeCamera` camera controller. //! //! The default `FreeCamera` controller is useful for exploring large scenes, debugging and editing purposes. To use it, //! simply add the [`FreeCameraPlugin`] to your [`App`] and attach the [`FreeCamera`] component to the camera entity you //!...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/custom_projection.rs
examples/camera/custom_projection.rs
//! Demonstrates how to define and use custom camera projections. use bevy::camera::CameraProjection; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } /// Like a perspective projection, but the vanishing point is not centered...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/2d_top_down_camera.rs
examples/camera/2d_top_down_camera.rs
//! This example showcases a 2D top-down camera with smooth player tracking. //! //! ## Controls //! //! | Key Binding | Action | //! |:---------------------|:--------------| //! | `W` | Move up | //! | `S` | Move down | //! | `A` | Move left ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/2d_screen_shake.rs
examples/camera/2d_screen_shake.rs
//! This example showcases how to implement 2D screen shake. //! It follows the GDC talk ["Math for Game Programmers: Juicing Your Cameras With Math"](https://www.youtube.com/watch?v=tu-Qe66AvtY) by Squirrel Eiserloh //! //! The key features are: //! - Camera shake is dependent on a "trauma" value between 0.0 and 1.0. ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/2d_on_ui.rs
examples/camera/2d_on_ui.rs
//! This example shows how to render 2D objects on top of Bevy UI, by using a second camera with a higher `order` than the UI camera. use bevy::{camera::visibility::RenderLayers, color::palettes::tailwind, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/camera_orbit.rs
examples/camera/camera_orbit.rs
//! Shows how to orbit camera around a static scene using pitch, yaw, and roll. //! //! See also: `first_person_view_model` example, which does something similar but as a first-person //! camera view. use std::{f32::consts::FRAC_PI_2, ops::Range}; use bevy::{input::mouse::AccumulatedMouseMotion, prelude::*}; #[deriv...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/first_person_view_model.rs
examples/camera/first_person_view_model.rs
//! This example showcases a 3D first-person camera. //! //! The setup presented here is a very common way of organizing a first-person game //! where the player can see their own arms. We use two industry terms to differentiate //! the kinds of models we have: //! //! - The *view model* is the model that represents th...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/camera/pan_camera_controller.rs
examples/camera/pan_camera_controller.rs
//! Example for `PanCamera`, demonstrating basic camera controls such as panning and zooming. //! //! This example shows how to use the `PanCamera` controller on a 2D camera in Bevy. The camera //! can be panned with keyboard inputs (arrow keys or WASD) and zoomed in/out using the mouse //! wheel or the +/- keys. The c...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/no_std/library/src/lib.rs
examples/no_std/library/src/lib.rs
//! Example `no_std` compatible Bevy library. // The first step to a `no_std` library is to add this annotation: #![no_std] // This does 2 things to your crate: // 1. It prevents automatically linking the `std` crate with yours. // 2. It switches to `core::prelude` instead of `std::prelude` for what is implicitly ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/time/time.rs
examples/time/time.rs
//! An example that illustrates how Time is handled in ECS. use bevy::{app::AppExit, prelude::*}; use std::{ io::{self, BufRead}, time::Duration, }; fn banner() { println!("This example is meant to intuitively demonstrate how Time works in Bevy."); println!(); println!("Time will be printed in th...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/time/virtual_time.rs
examples/time/virtual_time.rs
//! Shows how `Time<Virtual>` can be used to pause, resume, slow down //! and speed up a game. use std::time::Duration; use bevy::{ color::palettes::css::*, input::common_conditions::input_just_pressed, prelude::*, time::common_conditions::on_real_timer, }; fn main() { App::new() .add_plugins(Def...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/time/timers.rs
examples/time/timers.rs
//! Illustrates how `Timer`s can be used both as resources and components. use bevy::{log::info, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .init_resource::<Countdown>() .add_systems(Startup, setup) .add_systems(Update, (countdown, print_when_completed)) ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/scene/scene.rs
examples/scene/scene.rs
//! This example demonstrates how to load scene data from files and then dynamically //! apply that data to entities in your Bevy `World`. This includes spawning new //! entities and applying updates to existing ones. Scenes in Bevy encapsulate //! serialized and deserialized `Components` or `Resources` so that you can...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/bloom_2d.rs
examples/2d/bloom_2d.rs
//! Illustrates bloom post-processing in 2d. use bevy::{ core_pipeline::tonemapping::{DebandDither, Tonemapping}, post_process::bloom::{Bloom, BloomCompositeMode}, prelude::*, }; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Updat...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/2d_shapes.rs
examples/2d/2d_shapes.rs
//! Here we use shape primitives to build meshes in a 2D rendering context, making each mesh a certain color by giving that mesh's entity a material based off a [`Color`]. //! //! Meshes are better known for their use in 3D rendering, but we can use them in a 2D context too. Without a third dimension, the meshes we're ...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/pixel_grid_snap.rs
examples/2d/pixel_grid_snap.rs
//! Shows how to create graphics that snap to the pixel grid by rendering to a texture in 2D use bevy::{ camera::visibility::RenderLayers, camera::RenderTarget, color::palettes::css::GRAY, prelude::*, render::render_resource::{ Extent3d, TextureDescriptor, TextureDimension, TextureFormat, T...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/sprite_flipping.rs
examples/2d/sprite_flipping.rs
//! Displays a single [`Sprite`], created from an image, but flipped on one axis. use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); } fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { commands.spawn(Camera2d...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/2d_viewport_to_world.rs
examples/2d/2d_viewport_to_world.rs
//! This example demonstrates how to use the `Camera::viewport_to_world_2d` method with a dynamic viewport and camera. use bevy::{ camera::Viewport, color::palettes::{ basic::WHITE, css::{GREEN, RED}, }, math::ops::powf, prelude::*, }; fn main() { App::new() .add_plugin...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false
bevyengine/bevy
https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/2d/sprite_sheet.rs
examples/2d/sprite_sheet.rs
//! Renders an animated sprite by loading all animation frames from a single image (a sprite sheet) //! into a texture atlas, and changing the displayed image periodically. use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest())) // prevents blurry spri...
rust
Apache-2.0
51a6fedb06a022ab5d39e099413caa882e1b022d
2026-01-04T15:31:59.438636Z
false