Crates.io | bevy_lit |
lib.rs | bevy_lit |
version | |
source | src |
created_at | 2024-07-23 15:23:26.7348 |
updated_at | 2025-02-06 20:10:09.873655 |
description | A lighting 2d library for Bevy |
homepage | |
repository | https://github.com/malbernaz/bevy_lit |
max_upload_size | |
id | 1312920 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
bevy_lit
A simple 2D lighting library designed for Bevy. It provides basic lighting features through the types:
Lighting2dSettings
: Controls lighting parameters such as shadow softness.AmbientLight2d
: Provides a general light source that illuminates the entire scene uniformly.PointLight2d
: Emits light from a specific point, simulating light sources like lamps or torches.LightOccluder2d
: Creates shadows and blocks light from PointLight2d
along side any Mesh2d
.Install it using the CLI:
cargo add bevy_lit
Or add bevy_lit
to your Cargo.lock
:
[dependencies]
bevy_lit = "*"
Below is a basic example demonstrating how to set up and use bevy_lit
in your project:
use bevy::prelude::*;
use bevy_lit::prelude::*;
fn main() {
App::new()
.add_plugins((DefaultPlugins, Lighting2dPlugin))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
commands.spawn((
Camera2d,
Lighting2dSettings::default(),
));
commands.spawn(PointLight2d {
color: Color::WHITE,
intensity: 3.0,
radius: 200.0,
falloff: 2.0,
..default(),
});
commands.spawn((
Mesh2d(meshes.add(Circle::new(50.0))),
LightOccluder2d::default()),
Transform::from_xyz(0.0, 200.0, 0.0)
));
}
bevy |
bevy_lit |
---|---|
0.15 |
0.4..0.6 |
0.14 |
0.3 |
This library took great inspiration from the following crates:
Contributions are welcome! Please open an issue or submit a pull request.
bevy_lit
is licensed under the MIT License. See LICENSE for more details.