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/crates/bevy_winit/src/winit_windows.rs | crates/bevy_winit/src/winit_windows.rs | use bevy_a11y::AccessibilityRequested;
use bevy_ecs::entity::Entity;
use bevy_ecs::entity::EntityHashMap;
use bevy_platform::collections::HashMap;
use bevy_window::{
CursorGrabMode, CursorOptions, MonitorSelection, VideoModeSelection, Window, WindowMode,
WindowPosition, WindowResolution, WindowWrapper,
};
use ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/crates/bevy_winit/src/system.rs | crates/bevy_winit/src/system.rs | use std::collections::HashMap;
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::{
change_detection::DetectChangesMut,
entity::Entity,
lifecycle::RemovedComponents,
message::MessageWriter,
prelude::{Changed, Component},
system::{Local, NonSendMarker, Query, SystemParamItem},
};
use bevy_input::... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/crates/bevy_winit/src/accessibility.rs | crates/bevy_winit/src/accessibility.rs | //! Helpers for mapping window entities to accessibility types
use alloc::{collections::VecDeque, sync::Arc};
use bevy_input_focus::InputFocus;
use core::cell::RefCell;
use std::sync::Mutex;
use winit::event_loop::ActiveEventLoop;
use accesskit::{
ActionHandler, ActionRequest, ActivationHandler, DeactivationHandl... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/crates/bevy_winit/src/cursor/custom_cursor.rs | crates/bevy_winit/src/cursor/custom_cursor.rs | use bevy_asset::{AssetId, Assets};
use bevy_ecs::resource::Resource;
use bevy_image::{Image, TextureAtlas, TextureAtlasLayout};
use bevy_math::{ops, Rect, URect, UVec2, Vec2};
use bevy_platform::collections::HashMap;
use wgpu_types::TextureFormat;
/// Caches custom cursors. On many platforms, creating custom cursors i... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/crates/bevy_winit/src/cursor/mod.rs | crates/bevy_winit/src/cursor/mod.rs | #[cfg(feature = "custom_cursor")]
mod custom_cursor;
#[cfg(feature = "custom_cursor")]
pub use custom_cursor::*;
use crate::{converters::convert_system_cursor_icon, state::WinitAppRunnerState, WINIT_WINDOWS};
use bevy_app::{App, Last, Plugin};
#[cfg(feature = "custom_cursor")]
use bevy_asset::Assets;
use bevy_ecs::{p... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/hello_world.rs | examples/hello_world.rs | //! A minimal example that outputs "hello world"
use bevy::prelude::*;
fn main() {
App::new().add_systems(Update, hello_world_system).run();
}
fn hello_world_system() {
println!("hello world");
}
| rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/type_data.rs | examples/reflection/type_data.rs | //! The example demonstrates what type data is, how to create it, and how to use it.
use bevy::{
prelude::*,
reflect::{FromType, TypeRegistry},
};
// It's recommended to read this example from top to bottom.
// Comments are provided to explain the code and its purpose as you go along.
fn main() {
trait Da... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/serialization.rs | examples/reflection/serialization.rs | //! Illustrates how "reflection" serialization works in Bevy.
//!
//! Deriving `Reflect` will also register `SerializationData`,
//! which powers reflect (de)serialization.
//! Serializing reflected data *does not* require deriving serde's
//! Serialize and Deserialize implementations.
use bevy::{
prelude::*,
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/reflection.rs | examples/reflection/reflection.rs | //! Illustrates how "reflection" works in Bevy.
//!
//! Reflection provides a way to dynamically interact with Rust types, such as accessing fields
//! by their string name. Reflection is a core part of Bevy and enables a number of interesting
//! features (like scenes).
use bevy::{
prelude::*,
reflect::{
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/reflection_types.rs | examples/reflection/reflection_types.rs | //! This example illustrates how reflection works for simple data structures, like
//! structs, tuples and vectors.
use bevy::{
platform::collections::HashMap,
prelude::*,
reflect::{DynamicList, PartialReflect, ReflectRef},
};
use serde::{Deserialize, Serialize};
fn main() {
App::new()
.add_pl... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/function_reflection.rs | examples/reflection/function_reflection.rs | //! This example demonstrates how functions can be called dynamically using reflection.
//!
//! Function reflection is useful for calling regular Rust functions in a dynamic context,
//! where the types of arguments, return values, and even the function itself aren't known at compile time.
//!
//! This can be used for ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/generic_reflection.rs | examples/reflection/generic_reflection.rs | //! Demonstrates how reflection is used with generic Rust types.
use bevy::prelude::*;
use std::any::TypeId;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// You must manually register each instance of a generic type
.register_type::<MyType<u32>>()
.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/reflection/custom_attributes.rs | examples/reflection/custom_attributes.rs | //! Demonstrates how to register and access custom attributes on reflected types.
use bevy::reflect::{Reflect, TypeInfo, Typed};
use std::{any::TypeId, ops::RangeInclusive};
fn main() {
// Bevy supports statically registering custom attribute data on reflected types,
// which can then be accessed at runtime v... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/dynamic_types.rs | examples/reflection/dynamic_types.rs | //! This example demonstrates the use of dynamic types in Bevy's reflection system.
use bevy::reflect::{
reflect_trait, serde::TypedReflectDeserializer, std_traits::ReflectDefault, DynamicArray,
DynamicEnum, DynamicList, DynamicMap, DynamicSet, DynamicStruct, DynamicTuple,
DynamicTupleStruct, DynamicVarian... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/auto_register_static/src/lib.rs | examples/reflection/auto_register_static/src/lib.rs | //! Demonstrates how to set up automatic reflect types registration for platforms without `inventory` support
use bevy::prelude::*;
// The type that should be automatically registered.
// All types subject to automatic registration must not be defined in the same crate as `load_type_registrations!``.
// Any `#[derive(... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/reflection/auto_register_static/src/bin/main.rs | examples/reflection/auto_register_static/src/bin/main.rs | //! Demonstrates how to set up automatic reflect types registration for platforms without `inventory` support
use auto_register_static::main as lib_main;
use bevy::reflect::load_type_registrations;
fn main() {
// This must be called before our main to collect all type registration functions.
load_type_registra... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/state/computed_states.rs | examples/state/computed_states.rs | //! This example illustrates the use of [`ComputedStates`] for more complex state handling patterns.
//!
//! In this case, we'll be implementing the following pattern:
//! - The game will start in a `Menu` state, which we can return to with `Esc`
//! - From there, we can enter the game - where our bevy symbol moves aro... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/state/sub_states.rs | examples/state/sub_states.rs | //! This example illustrates the use of [`SubStates`] for more complex state handling patterns.
//!
//! [`SubStates`] are [`States`] that only exist while the App is in another [`State`]. They can
//! be used to create more complex patterns while relying on simple enums, or to de-couple certain
//! elements of complex ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/state/custom_transitions.rs | examples/state/custom_transitions.rs | //! This example illustrates how to register custom state transition behavior.
//!
//! In this case we are trying to add `OnReenter` and `OnReexit`
//! which will work much like `OnEnter` and `OnExit`,
//! but additionally trigger if the state changed into itself.
//!
//! While identity transitions exist internally in ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/state/states.rs | examples/state/states.rs | //! This example illustrates how to use [`States`] for high-level app control flow.
//! States are a powerful but intuitive tool for controlling which logic runs when.
//! You can have multiple independent states, and the [`OnEnter`] and [`OnExit`] schedules
//! can be used to great effect to ensure that you handle set... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/tools/gamepad_viewer.rs | examples/tools/gamepad_viewer.rs | //! Shows a visualization of gamepad buttons, sticks, and triggers
use std::f32::consts::PI;
use bevy::{
input::gamepad::{GamepadAxisChangedEvent, GamepadButtonChangedEvent, GamepadConnectionEvent},
prelude::*,
sprite::Anchor,
};
const BUTTON_RADIUS: f32 = 25.;
const BUTTON_CLUSTER_RADIUS: f32 = 50.;
con... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/tools/scene_viewer/scene_viewer_plugin.rs | examples/tools/scene_viewer/scene_viewer_plugin.rs | //! A glTF scene viewer plugin. Provides controls for directional lighting, and switching between scene cameras.
//! To use in your own application:
//! - Copy the code for the `SceneViewerPlugin` and add the plugin to your App.
//! - Insert an initialized `SceneHandle` resource into your App's `AssetServer`.
use bev... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/tools/scene_viewer/morph_viewer_plugin.rs | examples/tools/scene_viewer/morph_viewer_plugin.rs | //! Enable controls for morph targets detected in a loaded scene.
//!
//! Collect morph targets and assign keys to them,
//! shows on screen additional controls for morph targets.
//!
//! Illustrates how to access and modify individual morph target weights.
//! See the [`update_morphs`] system for details.
//!
//! Also... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/tools/scene_viewer/main.rs | examples/tools/scene_viewer/main.rs | //! A simple glTF scene viewer made with Bevy.
//!
//! Just run `cargo run --release --example scene_viewer /path/to/model.gltf`,
//! replacing the path as appropriate.
//! In case of multiple scenes, you can select which to display by adapting the file path: `/path/to/model.gltf#Scene1`.
//! With no arguments it will ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/tools/scene_viewer/animation_plugin.rs | examples/tools/scene_viewer/animation_plugin.rs | //! Control animations of entities in the loaded scene.
use std::collections::HashMap;
use bevy::{animation::AnimationTargetId, ecs::entity::EntityHashMap, gltf::Gltf, prelude::*};
use crate::scene_viewer_plugin::SceneHandle;
/// Controls animation clips for a unique entity.
#[derive(Component)]
struct Clips {
n... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_gradients.rs | examples/stress_tests/many_gradients.rs | //! Stress test demonstrating gradient performance improvements.
//!
//! This example creates many UI nodes with gradients to measure the performance
//! impact of pre-converting colors to the target color space on the CPU.
use argh::FromArgs;
use bevy::{
color::palettes::css::*,
diagnostic::{FrameTimeDiagnost... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_gizmos.rs | examples/stress_tests/many_gizmos.rs | //! Test rendering of many gizmos.
use std::f32::consts::TAU;
use bevy::{
diagnostic::{Diagnostic, DiagnosticsStore, FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
window::{PresentMode, WindowResolution},
winit::WinitSettings,
};
const SYSTEM_COUNT: u32 = 10;
fn main() {
let mut ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/transform_hierarchy.rs | examples/stress_tests/transform_hierarchy.rs | //! Hierarchy and transform propagation stress test.
//!
//! Running this example:
//!
//! ```
//! cargo r --release --example transform_hierarchy <configuration name>
//! ```
//!
//! | Configuration | Description |
//! | -------------------- | --------------... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_animated_sprites.rs | examples/stress_tests/many_animated_sprites.rs | //! Renders a lot of animated sprites to allow performance testing.
//!
//! This example sets up many animated sprites in different sizes, rotations, and scales in the world.
//! It also moves the camera over them to see how well frustum culling works.
use std::time::Duration;
use bevy::{
diagnostic::{FrameTimeDi... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_materials.rs | examples/stress_tests/many_materials.rs | //! Benchmark to test rendering many animated materials
use argh::FromArgs;
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
window::{PresentMode, WindowResolution},
winit::{UpdateMode, WinitSettings},
};
use std::f32::consts::PI;
#[derive(FromArgs, Resource)]
///... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_cameras_lights.rs | examples/stress_tests/many_cameras_lights.rs | //! Test rendering of many cameras and lights
use std::f32::consts::PI;
use bevy::{
camera::Viewport,
math::ops::{cos, sin},
prelude::*,
window::{PresentMode, WindowResolution},
winit::WinitSettings,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_text2d.rs | examples/stress_tests/many_text2d.rs | //! Renders a lot of `Text2d`s
use std::ops::RangeInclusive;
use bevy::{
camera::visibility::NoFrustumCulling,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
text::FontAtlasSet,
window::{PresentMode, WindowResolution},
winit::WinitSettings,
};
use argh::FromArgs;
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_buttons.rs | examples/stress_tests/many_buttons.rs | //! General UI benchmark that stress tests layouting, text, interaction and rendering
use argh::FromArgs;
use bevy::{
color::palettes::css::ORANGE_RED,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
text::TextColor,
window::{PresentMode, WindowResolution},
winit::Wi... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/text_pipeline.rs | examples/stress_tests/text_pipeline.rs | //! Text pipeline benchmark.
//!
//! Continuously recomputes a large block of text with 100 text spans.
use bevy::{
color::palettes::basic::{BLUE, YELLOW},
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
text::{LineBreak, TextBounds},
window::{PresentMode, WindowResoluti... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_sprites.rs | examples/stress_tests/many_sprites.rs | //! Renders a lot of sprites to allow performance testing.
//! See <https://github.com/bevyengine/bevy/pull/1492>
//!
//! This example sets up many sprites in different sizes, rotations, and scales in the world.
//! It also moves the camera over them to see how well frustum culling works.
//!
//! Add the `--colored` ar... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_components.rs | examples/stress_tests/many_components.rs | //! Stress test for large ECS worlds.
//!
//! Running this example:
//!
//! ```
//! cargo run --profile stress-test --example many_components [<num_entities>] [<num_components>] [<num_systems>]
//! ```
//!
//! `num_entities`: The number of entities in the world (must be nonnegative)
//! `num_components`: the number of ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/bevymark.rs | examples/stress_tests/bevymark.rs | //! This example provides a 2D benchmark.
//!
//! Usage: spawn more entities by clicking on the screen.
use core::time::Duration;
use std::str::FromStr;
use argh::FromArgs;
use bevy::{
asset::RenderAssetUsages,
color::palettes::basic::*,
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin, LogDiagno... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/bevymark_3d.rs | examples/stress_tests/bevymark_3d.rs | //! This example provides a 3D benchmark.
//!
//! Usage: spawn more entities by clicking with the left mouse button.
use core::time::Duration;
use std::str::FromStr;
use argh::FromArgs;
use bevy::{
asset::RenderAssetUsages,
color::palettes::basic::*,
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlug... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_glyphs.rs | examples/stress_tests/many_glyphs.rs | //! Simple text rendering benchmark.
//!
//! Creates a text block with a single span containing `100_000` glyphs,
//! and renders it with the UI in a white color and with Text2d in a red color.
//!
//! To recompute all text each frame run
//! `cargo run --example many_glyphs --release recompute-text`
use argh::FromArgs... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_foxes.rs | examples/stress_tests/many_foxes.rs | //! Loads animations from a skinned glTF, spawns many of them, and plays the
//! animation to stress test skinned meshes.
use std::{f32::consts::PI, time::Duration};
use argh::FromArgs;
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
light::CascadeShadowConfigBuilder,
prelude::... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_cubes.rs | examples/stress_tests/many_cubes.rs | //! Simple benchmark to test per-entity draw overhead.
//!
//! To measure performance realistically, be sure to run this in release mode.
//! `cargo run --example many_cubes --release`
//!
//! By default, this arranges the meshes in a spherical pattern that
//! distributes the meshes evenly.
//!
//! See `cargo run --ex... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/stress_tests/many_lights.rs | examples/stress_tests/many_lights.rs | //! Simple benchmark to test rendering many point lights.
//! Run with `WGPU_SETTINGS_PRIO=webgl2` to restrict to uniform buffers and max 256 lights.
use std::f64::consts::PI;
use bevy::{
camera::ScalingMode,
color::palettes::css::DEEP_PINK,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/log_layers_ecs.rs | examples/app/log_layers_ecs.rs | //! This example illustrates how to transfer log events from the [`Layer`] to Bevy's ECS.
//!
//! The way we will do this is via a [`mpsc`] channel. [`mpsc`] channels allow 2 unrelated
//! parts of the program to communicate (in this case, [`Layer`]s and Bevy's ECS).
//!
//! Inside the `custom_layer` function we will c... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/thread_pool_resources.rs | examples/app/thread_pool_resources.rs | //! This example illustrates how to customize the thread pool used internally (e.g. to only use a
//! certain number of threads).
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(TaskPoolPlugin {
task_pool_options: TaskPoolOptions::with_num_threads(4),
}))
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/empty_defaults.rs | examples/app/empty_defaults.rs | //! An empty application with default plugins.
use bevy::prelude::*;
fn main() {
App::new().add_plugins(DefaultPlugins).run();
}
| rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/custom_loop.rs | examples/app/custom_loop.rs | //! This example demonstrates you can create a custom runner (to update an app manually). It reads
//! lines from stdin and prints them from within the ecs.
use bevy::{app::AppExit, prelude::*};
use std::io;
#[derive(Resource)]
struct Input(String);
fn my_runner(mut app: App) -> AppExit {
// Finalize plugin buil... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/headless_renderer.rs | examples/app/headless_renderer.rs | //! This example illustrates how to make a headless renderer.
//! Derived from: <https://sotrh.github.io/learn-wgpu/showcase/windowless/#a-triangle-without-a-window>
//! It follows these steps:
//!
//! 1. Render from camera to gpu-image render target
//! 2. Copy from gpu image to buffer using `ImageCopyDriver` node in ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/log_layers.rs | examples/app/log_layers.rs | //! This example illustrates how to add custom log layers in bevy.
use bevy::{
log::{
tracing::{self, Subscriber},
tracing_subscriber::{field::MakeExt, Layer},
BoxedFmtLayer, BoxedLayer,
},
prelude::*,
};
struct CustomLayer;
impl<S: Subscriber> Layer<S> for CustomLayer {
fn on... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/plugin_group.rs | examples/app/plugin_group.rs | //! Demonstrates the creation and registration of a custom plugin group.
//! [`PluginGroup`]s are a way to group sets of plugins that should be registered together.
use bevy::{app::PluginGroupBuilder, prelude::*};
fn main() {
App::new()
.add_plugins((
// Two PluginGroups that are included with... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/empty.rs | examples/app/empty.rs | //! An empty application (does nothing)
use bevy::prelude::*;
fn main() {
App::new().run();
}
| rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/headless.rs | examples/app/headless.rs | //! This example shows how to configure the `ScheduleRunnerPlugin` to run your
//! application without windowing. You can completely remove rendering / windowing
//! Plugin code from bevy by making your import look like this in your Cargo.toml.
//!
//! ```toml
//! [dependencies]
//! bevy = { version = "*", default-feat... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/without_winit.rs | examples/app/without_winit.rs | //! Create an application without winit (runs single time, no event loop).
use bevy::{prelude::*, winit::WinitPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins.build().disable::<WinitPlugin>())
.add_systems(Update, setup_system)
.run();
}
fn setup_system(mut commands: Commands) ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/drag_and_drop.rs | examples/app/drag_and_drop.rs | //! An example that shows how to handle drag and drop of files in an app.
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Update, file_drag_and_drop_system)
.run();
}
fn file_drag_and_drop_system(mut drag_and_drop_reader: MessageReader<FileDragAndDro... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/logs.rs | examples/app/logs.rs | //! This example illustrates how to use logs in bevy.
use bevy::{log::once, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(bevy::log::LogPlugin {
// Uncomment this to override the default log settings:
// level: bevy::log::Level::TRACE,
// filter: "... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/no_renderer.rs | examples/app/no_renderer.rs | //! An application that runs with default plugins and displays an empty
//! window, but without an actual renderer.
//! This can be very useful for integration tests or CI.
//!
//! See also the `headless` example which does not display a window.
use bevy::{
prelude::*,
render::{settings::WgpuSettings, RenderPl... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/return_after_run.rs | examples/app/return_after_run.rs | //! Shows how to return to the calling function after a windowed Bevy app has exited.
//!
//! In windowed *Bevy* applications, executing code below a call to `App::run()` is
//! not recommended because:
//! - `App::run()` will never return on iOS and Web.
//! - It is not possible to recreate a window after the event lo... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/app/plugin.rs | examples/app/plugin.rs | //! Demonstrates the creation and registration of a custom plugin.
//!
//! Plugins are the foundation of Bevy. They are scoped sets of components, resources, and systems
//! that provide a specific piece of functionality (generally the smaller the scope, the better).
//! This example illustrates how to create a simple ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/tonemapping.rs | examples/3d/tonemapping.rs | //! This examples compares Tonemapping options
use bevy::{
asset::UnapprovedPathMode,
core_pipeline::tonemapping::Tonemapping,
light::CascadeShadowConfigBuilder,
platform::collections::HashMap,
prelude::*,
reflect::TypePath,
render::{
render_resource::AsBindGroup,
view::{Col... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/scrolling_fog.rs | examples/3d/scrolling_fog.rs | //! Showcases a `FogVolume`'s density texture being scrolled over time to create
//! the effect of fog moving in the wind.
//!
//! The density texture is a repeating 3d noise texture and the `density_texture_offset`
//! is moved every frame to achieve this.
//!
//! The example also utilizes the jitter option of `Volume... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/visibility_range.rs | examples/3d/visibility_range.rs | //! Demonstrates visibility ranges, also known as HLODs.
use std::f32::consts::PI;
use bevy::{
camera::visibility::VisibilityRange,
core_pipeline::prepass::{DepthPrepass, NormalPrepass},
input::mouse::MouseWheel,
light::{light_consts::lux::FULL_DAYLIGHT, CascadeShadowConfigBuilder},
math::vec3,
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/generate_custom_mesh.rs | examples/3d/generate_custom_mesh.rs | //! This example demonstrates how to create a custom mesh,
//! assign a custom UV mapping for a custom texture,
//! and how to change the UV mapping at run-time.
use bevy::{
asset::RenderAssetUsages,
mesh::{Indices, VertexAttributeValues},
prelude::*,
render::render_resource::PrimitiveTopology,
};
// ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/rotate_environment_map.rs | examples/3d/rotate_environment_map.rs | //! Demonstrates how to rotate the skybox and the environment map simultaneously.
use std::f32::consts::PI;
use bevy::{
color::palettes::css::{GOLD, WHITE},
core_pipeline::{tonemapping::Tonemapping::AcesFitted, Skybox},
image::ImageLoaderSettings,
prelude::*,
render::view::Hdr,
};
/// Entry point... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/transparency_3d.rs | examples/3d/transparency_3d.rs | //! Demonstrates how to use transparency in 3D.
//! Shows the effects of different blend modes.
//! The `fade_transparency` system smoothly changes the transparency over time.
use bevy::{math::ops, 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/3d/volumetric_fog.rs | examples/3d/volumetric_fog.rs | //! Demonstrates volumetric fog and lighting (light shafts or god rays).
//! Note: On Wasm, this example only runs on WebGPU
use bevy::{
color::palettes::css::RED,
core_pipeline::{tonemapping::Tonemapping, Skybox},
light::{FogVolume, VolumetricFog, VolumetricLight},
math::vec3,
post_process::bloom:... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/light_textures.rs | examples/3d/light_textures.rs | //! Demonstrates light textures, which modulate light sources.
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, FRAC_PI_4, PI};
use std::fmt::{self, Formatter};
use bevy::{
camera::primitives::CubemapLayout,
color::palettes::css::{SILVER, YELLOW},
input::mouse::AccumulatedMouseMotion,
light::{DirectionalL... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/mixed_lighting.rs | examples/3d/mixed_lighting.rs | //! Demonstrates how to combine baked and dynamic lighting.
use bevy::{
gltf::GltfMeshName,
pbr::Lightmap,
picking::{backend::HitData, pointer::PointerInteraction},
prelude::*,
scene::SceneInstanceReady,
};
use crate::widgets::{RadioButton, RadioButtonText, WidgetClickEvent, WidgetClickSender};
#... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/animated_material.rs | examples/3d/animated_material.rs | //! Shows how to animate material properties
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, animate_materials)
.run();
}
fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut m... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/deferred_rendering.rs | examples/3d/deferred_rendering.rs | //! This example compares Forward, Forward + Prepass, and Deferred rendering.
use std::f32::consts::*;
use bevy::{
anti_alias::fxaa::Fxaa,
core_pipeline::prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
image::ImageLoaderSettings,
light::{
CascadeShadowConfigBuilde... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/atmospheric_fog.rs | examples/3d/atmospheric_fog.rs | //! This example showcases atmospheric fog
//!
//! ## Controls
//!
//! | Key Binding | Action |
//! |:-------------------|:---------------------------------------|
//! | `Spacebar` | Toggle Atmospheric Fog |
//! | `S` | Toggle Directional Lig... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/mesh_ray_cast.rs | examples/3d/mesh_ray_cast.rs | //! Demonstrates how to use the [`MeshRayCast`] system parameter to chain multiple ray casts
//! and bounce off of surfaces.
use std::f32::consts::{FRAC_PI_2, PI};
use bevy::{
color::palettes::css, core_pipeline::tonemapping::Tonemapping, math::vec3,
picking::backend::ray::RayMap, post_process::bloom::Bloom, ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/meshlet.rs | examples/3d/meshlet.rs | //! Meshlet rendering for dense high-poly scenes (experimental).
// Note: This example showcases the meshlet API, but is not the type of scene that would benefit from using meshlets.
use bevy::{
camera_controller::free_camera::{FreeCamera, FreeCameraPlugin},
light::{CascadeShadowConfigBuilder, DirectionalLigh... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/anisotropy.rs | examples/3d/anisotropy.rs | //! Demonstrates anisotropy with the glTF sample barn lamp model.
use std::fmt::Display;
use bevy::{
color::palettes::{self, css::WHITE},
core_pipeline::Skybox,
math::vec3,
prelude::*,
time::Stopwatch,
};
/// The initial position of the camera.
const CAMERA_INITIAL_POSITION: Vec3 = vec3(-0.4, 0.0... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/texture.rs | examples/3d/texture.rs | //! This example shows various ways to configure texture materials in 3D.
use std::f32::consts::PI;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
/// sets up a scene with textured entities
fn setup(
mut commands: Comm... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/solari.rs | examples/3d/solari.rs | //! Demonstrates realtime dynamic raytraced lighting using Bevy Solari.
use argh::FromArgs;
use bevy::{
camera::CameraMainTextureUsages,
camera_controller::free_camera::{FreeCamera, FreeCameraPlugin},
diagnostic::{Diagnostic, DiagnosticPath, DiagnosticsStore},
gltf::GltfMaterialName,
image::{ImageA... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/pbr.rs | examples/3d/pbr.rs | //! This example shows how to configure Physically Based Rendering (PBR) parameters.
use bevy::camera::ScalingMode;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, environment_map_load_finish)
.run();
}
//... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/mirror.rs | examples/3d/mirror.rs | //! Demonstrates how to create a mirror with a second camera.
use std::f32::consts::FRAC_PI_2;
use crate::widgets::{RadioButton, WidgetClickEvent, WidgetClickSender};
use bevy::camera::RenderTarget;
use bevy::{
asset::RenderAssetUsages,
color::palettes::css::GREEN,
input::mouse::AccumulatedMouseMotion,
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/auto_exposure.rs | examples/3d/auto_exposure.rs | //! This example showcases auto exposure,
//! which automatically (but not instantly) adjusts the brightness of the scene in a way that mimics the function of the human eye.
//! Auto exposure requires compute shader capabilities, so it's not available on WebGL.
//!
//! ## Controls
//!
//! | Key Binding | Action ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/two_passes.rs | examples/3d/two_passes.rs | //! Renders two 3d passes to the same window from different perspectives.
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/blend_modes.rs | examples/3d/blend_modes.rs | //! This example showcases different blend modes.
//!
//! ## Controls
//!
//! | Key Binding | Action |
//! |:-------------------|:------------------------------------|
//! | `Up` / `Down` | Increase / Decrease Alpha |
//! | `Left` / `Right` | Rotate Camera ... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/post_processing.rs | examples/3d/post_processing.rs | //! Demonstrates Bevy's built-in postprocessing features.
//!
//! Currently, this simply consists of chromatic aberration.
use std::f32::consts::PI;
use bevy::{
light::CascadeShadowConfigBuilder, post_process::effect_stack::ChromaticAberration, prelude::*,
render::view::Hdr,
};
/// The number of units per fr... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/shadow_biases.rs | examples/3d/shadow_biases.rs | //! Demonstrates how shadow biases affect shadows in a 3d scene.
use bevy::{
camera_controller::free_camera::{FreeCamera, FreeCameraPlugin},
light::ShadowFilteringMethod,
prelude::*,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(FreeCameraPlugin)
.add_syst... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/decal.rs | examples/3d/decal.rs | //! Decal rendering.
//! Note: On Wasm, this example only runs on WebGPU
use bevy::{
anti_alias::fxaa::Fxaa,
camera_controller::free_camera::{FreeCamera, FreeCameraPlugin},
core_pipeline::prepass::DepthPrepass,
pbr::decal::{ForwardDecal, ForwardDecalMaterial, ForwardDecalMaterialExt},
prelude::*,
}... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/spherical_area_lights.rs | examples/3d/spherical_area_lights.rs | //! Demonstrates how lighting is affected by different radius of point lights.
use bevy::prelude::*;
fn main() {
App::new()
.insert_resource(GlobalAmbientLight {
brightness: 60.0,
..default()
})
.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/pcss.rs | examples/3d/pcss.rs | //! Demonstrates percentage-closer soft shadows (PCSS).
use std::f32::consts::PI;
use bevy::{
anti_alias::taa::TemporalAntiAliasing,
camera::{
primitives::{CubemapFrusta, Frustum},
visibility::{CubemapVisibleEntities, VisibleMeshEntities},
},
core_pipeline::{
prepass::{DepthPre... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/vertex_colors.rs | examples/3d/vertex_colors.rs | //! Illustrates the use of vertex colors.
use bevy::{mesh::VertexAttributeValues, 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/anti_aliasing.rs | examples/3d/anti_aliasing.rs | //! Compares different anti-aliasing techniques supported by Bevy.
use std::{f32::consts::PI, fmt::Write};
use bevy::{
anti_alias::{
contrast_adaptive_sharpening::ContrastAdaptiveSharpening,
fxaa::{Fxaa, Sensitivity},
smaa::{Smaa, SmaaPreset},
taa::TemporalAntiAliasing,
},
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/spotlight.rs | examples/3d/spotlight.rs | //! Illustrates spot lights.
use std::f32::consts::*;
use bevy::{
color::palettes::basic::{MAROON, RED},
light::NotShadowCaster,
math::ops,
prelude::*,
render::view::Hdr,
};
use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha8Rng;
const INSTRUCTIONS: &str = "\
Controls
--------
Horizontal Movem... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/fog_volumes.rs | examples/3d/fog_volumes.rs | //! Demonstrates fog volumes with voxel density textures.
//!
//! We render the Stanford bunny as a fog volume. Parts of the bunny become
//! lighter and darker as the camera rotates. This is physically-accurate
//! behavior that results from the scattering and absorption of the directional
//! light.
use bevy::{
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/ssao.rs | examples/3d/ssao.rs | //! A scene showcasing screen space ambient occlusion.
use bevy::{
anti_alias::taa::TemporalAntiAliasing,
math::ops,
pbr::{ScreenSpaceAmbientOcclusion, ScreenSpaceAmbientOcclusionQualityLevel},
prelude::*,
render::{camera::TemporalJitter, view::Hdr},
};
use std::f32::consts::PI;
fn main() {
Ap... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/parallax_mapping.rs | examples/3d/parallax_mapping.rs | //! A simple 3D scene with a spinning cube with a normal map and depth map to demonstrate parallax mapping.
//! Press left mouse button to cycle through different views.
use std::fmt;
use bevy::{image::ImageLoaderSettings, math::ops, prelude::*};
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/3d/order_independent_transparency.rs | examples/3d/order_independent_transparency.rs | //! A simple 3D scene showing how alpha blending can break and how order independent transparency (OIT) can fix it.
//!
//! See [`OrderIndependentTransparencyPlugin`] for the trade-offs of using OIT.
//!
//! [`OrderIndependentTransparencyPlugin`]: bevy::core_pipeline::oit::OrderIndependentTransparencyPlugin
use bevy::{... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/camera_sub_view.rs | examples/3d/camera_sub_view.rs | //! Demonstrates different sub view effects.
//!
//! A sub view is essentially a smaller section of a larger viewport. Some use
//! cases include:
//! - Split one image across multiple cameras, for use in a multimonitor setups
//! - Magnify a section of the image, by rendering a small sub view in another
//! camera
/... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/bloom_3d.rs | examples/3d/bloom_3d.rs | //! Illustrates bloom post-processing using HDR and emissive materials.
use bevy::{
core_pipeline::tonemapping::Tonemapping,
math::ops,
post_process::bloom::{Bloom, BloomCompositeMode},
prelude::*,
};
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
fn main() {
App... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/lighting.rs | examples/3d/lighting.rs | //! Illustrates different lights of various types and colors, some static, some moving over
//! a simple scene.
use std::f32::consts::PI;
use bevy::{
camera::{Exposure, PhysicalCameraParameters},
color::palettes::css::*,
light::CascadeShadowConfigBuilder,
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/3d/clearcoat.rs | examples/3d/clearcoat.rs | //! Demonstrates the clearcoat PBR feature.
//!
//! Clearcoat is a separate material layer that represents a thin translucent
//! layer over a material. Examples include (from the Filament spec [1]) car paint,
//! soda cans, and lacquered wood.
//!
//! In glTF, clearcoat is supported via the `KHR_materials_clearcoat` [... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/clustered_decal_maps.rs | examples/3d/clustered_decal_maps.rs | //! Demonstrates the normal map, metallic-roughness map, and emissive features
//! of clustered decals.
use std::{f32::consts::PI, time::Duration};
use bevy::{
asset::io::web::WebAssetPlugin,
color::palettes::css::{CRIMSON, GOLD},
image::ImageLoaderSettings,
light::ClusteredDecal,
prelude::*,
... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/lightmaps.rs | examples/3d/lightmaps.rs | //! Rendering a scene with baked lightmaps.
use argh::FromArgs;
use bevy::{
core_pipeline::prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass},
gltf::GltfMeshName,
pbr::{DefaultOpaqueRendererMethod, Lightmap},
prelude::*,
};
/// Demonstrates lightmaps
#[derive(FromArgs, Resource)]
struct Arg... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/parenting.rs | examples/3d/parenting.rs | //! Illustrates how to create parent-child relationships between entities and how parent transforms
//! are propagated to their descendants.
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, rotator_system)
.... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/render_to_texture.rs | examples/3d/render_to_texture.rs | //! Shows how to render to a texture. Useful for mirrors, UI, or exporting images.
use std::f32::consts::PI;
use bevy::camera::RenderTarget;
use bevy::{camera::visibility::RenderLayers, prelude::*, render::render_resource::TextureFormat};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_s... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
bevyengine/bevy | https://github.com/bevyengine/bevy/blob/51a6fedb06a022ab5d39e099413caa882e1b022d/examples/3d/orthographic.rs | examples/3d/orthographic.rs | //! Shows how to create a 3D orthographic view (for isometric-look games or CAD applications).
use bevy::{camera::ScalingMode, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
/// set up a simple 3D scene
fn setup(
mut commands: C... | rust | Apache-2.0 | 51a6fedb06a022ab5d39e099413caa882e1b022d | 2026-01-04T15:31:59.438636Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.