Skip to content

Commit

Permalink
Revert "Bevy 0.14" (#30)
Browse files Browse the repository at this point in the history
Reverts #26
  • Loading branch information
aevyrie authored Jul 5, 2024
1 parent be690d9 commit 6fa7d31
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 158 deletions.
35 changes: 17 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "big_space"
version = "0.7.0-rc.0"
version = "0.6.0"
edition = "2021"
description = "A floating origin plugin for bevy"
license = "MIT OR Apache-2.0"
Expand All @@ -9,23 +9,22 @@ repository = "https://github.com/aevyrie/big_space"
documentation = "https://docs.rs/crate/big_space/latest"

[dependencies]
bevy_app = { version = "0.14.0-rc.4", default_features = false }
bevy_ecs = { version = "0.14.0-rc.4", default_features = false }
bevy_hierarchy = { version = "0.14.0-rc.4", default_features = false }
bevy_log = { version = "0.14.0-rc.4", default_features = false }
bevy_math = { version = "0.14.0-rc.4", default_features = false }
bevy_reflect = { version = "0.14.0-rc.4", default_features = false }
bevy_transform = { version = "0.14.0-rc.4", default_features = false }
bevy_utils = { version = "0.14.0-rc.4", default_features = false }
bevy_app = { version = "0.13", default_features = false }
bevy_ecs = { version = "0.13", default_features = false }
bevy_hierarchy = { version = "0.13", default_features = false }
bevy_log = { version = "0.13", default_features = false }
bevy_math = { version = "0.13", default_features = false }
bevy_reflect = { version = "0.13", default_features = false }
bevy_transform = { version = "0.13", default_features = false }
bevy_utils = { version = "0.13", default_features = false }
# Optional
bevy_color = { version = "0.14.0-rc.4", default_features = false, optional = true }
bevy_gizmos = { version = "0.14.0-rc.4", default_features = false, optional = true }
bevy_render = { version = "0.14.0-rc.4", default_features = false, optional = true }
bevy_input = { version = "0.14.0-rc.4", default_features = false, optional = true }
bevy_time = { version = "0.14.0-rc.4", default_features = false, optional = true }
bevy_gizmos = { version = "0.13", default_features = false, optional = true }
bevy_render = { version = "0.13", default_features = false, optional = true }
bevy_input = { version = "0.13", default_features = false, optional = true }
bevy_time = { version = "0.13", default_features = false, optional = true }

[dev-dependencies]
bevy = { version = "0.14.0-rc.4", default-features = false, features = [
bevy = { version = "0.13", default-features = false, features = [
"bevy_scene",
"bevy_gltf",
"bevy_winit",
Expand All @@ -35,14 +34,14 @@ bevy = { version = "0.14.0-rc.4", default-features = false, features = [
"bevy_gizmos",
"x11",
"tonemapping_luts",
"multi_threaded",
"multi-threaded",
] }
# bevy-inspector-egui = "0.24"
bevy-inspector-egui = "0.24"
rand = "0.8.5"

[features]
default = ["debug", "camera", "bevy_render"]
debug = ["bevy_gizmos", "bevy_color"]
debug = ["bevy_gizmos", "bevy_render"]
camera = ["bevy_render", "bevy_time", "bevy_input"]

[[example]]
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ From the docs: https://docs.rs/big_space/latest/big_space/precision/trait.GridPr

| bevy | big_space |
| ---- | --------- |
| 0.14 | 0.7 |
| 0.13 | 0.5, 0.6 |
| 0.12 | 0.4 |
| 0.11 | 0.3 |
Expand Down
5 changes: 2 additions & 3 deletions examples/debug.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(clippy::type_complexity)]

use bevy::prelude::*;
use bevy_color::palettes;
use big_space::{commands::BigSpaceCommands, reference_frame::ReferenceFrame, FloatingOrigin};

fn main() {
Expand All @@ -14,7 +13,7 @@ fn main() {
.insert_resource(ClearColor(Color::BLACK))
.add_systems(Startup, setup)
.add_systems(Update, (movement, rotation))
.run();
.run()
}

#[derive(Component)]
Expand Down Expand Up @@ -62,7 +61,7 @@ fn setup(
) {
let mesh_handle = meshes.add(Sphere::new(0.1).mesh().ico(16).unwrap());
let matl_handle = materials.add(StandardMaterial {
base_color: Color::Srgba(palettes::basic::YELLOW),
base_color: Color::YELLOW,
..default()
});

Expand Down
16 changes: 5 additions & 11 deletions examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use bevy::{
transform::TransformSystem,
window::{CursorGrabMode, PrimaryWindow},
};
use bevy_color::palettes;
use big_space::{
camera::{CameraController, CameraInput},
commands::BigSpaceCommands,
Expand All @@ -27,7 +26,7 @@ fn main() {
PostUpdate,
highlight_nearest_sphere.after(TransformSystem::TransformPropagate),
)
.run();
.run()
}

fn setup(
Expand Down Expand Up @@ -55,7 +54,7 @@ fn setup(

let mesh_handle = meshes.add(Sphere::new(0.5).mesh().ico(32).unwrap());
let matl_handle = materials.add(StandardMaterial {
base_color: Color::Srgba(palettes::basic::BLUE),
base_color: Color::BLUE,
perceptual_roughness: 0.8,
reflectance: 1.0,
..default()
Expand All @@ -79,7 +78,7 @@ fn setup(
// light
root.spawn_spatial(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 10_000.0,
illuminance: 100_000.0,
..default()
},
..default()
Expand Down Expand Up @@ -148,13 +147,8 @@ fn highlight_nearest_sphere(
// Ignore rotation due to panicking in gizmos, as of bevy 0.13
let (scale, rotation, translation) = transform.to_scale_rotation_translation();
gizmos
.sphere(
translation,
rotation,
scale.x * 0.505,
Color::Srgba(palettes::basic::RED),
)
.resolution(128);
.sphere(translation, rotation, scale.x * 0.505, Color::RED)
.circle_segments(128);
}

#[allow(clippy::type_complexity)]
Expand Down
2 changes: 1 addition & 1 deletion examples/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() {
))
.add_systems(Startup, (setup_scene, setup_ui))
.add_systems(Update, (rotator_system, toggle_plugin))
.run();
.run()
}

/// You can put things really, really far away from the origin. The distance we use here is actually
Expand Down
27 changes: 13 additions & 14 deletions examples/error_child.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
//! This example demonstrates error accumulating from parent to children in nested reference frames.
use bevy::{math::DVec3, prelude::*};
use bevy_color::palettes;
use big_space::{commands::BigSpaceCommands, reference_frame::ReferenceFrame, FloatingOrigin};

fn main() {
App::new()
.add_plugins((
DefaultPlugins.build().disable::<TransformPlugin>(),
// bevy_inspector_egui::quick::WorldInspectorPlugin::new(),
bevy_inspector_egui::quick::WorldInspectorPlugin::new(),
big_space::BigSpacePlugin::<i64>::default(),
big_space::camera::CameraControllerPlugin::<i64>::default(),
big_space::debug::FloatingOriginDebugPlugin::<i64>::default(),
))
.add_systems(Startup, setup_scene)
.run();
.run()
}

// The nearby object is NEARBY meters away from us. The distance object is DISTANT meters away from
Expand All @@ -29,7 +28,7 @@ fn setup_scene(
) {
let mesh_handle = meshes.add(Sphere::new(SPHERE_RADIUS).mesh());
let matl_handle = materials.add(StandardMaterial {
base_color: Color::srgb(0.8, 0.7, 0.6),
base_color: Color::rgb(0.8, 0.7, 0.6),
..default()
});

Expand All @@ -38,7 +37,7 @@ fn setup_scene(
|root_frame| {
root_frame.spawn_spatial(PbrBundle {
mesh: mesh_handle.clone(),
material: materials.add(Color::from(palettes::css::BLUE)),
material: materials.add(Color::BLUE),
transform: Transform::from_translation(NEARBY),
..default()
});
Expand All @@ -47,8 +46,8 @@ fn setup_scene(
root_frame.with_frame(
ReferenceFrame::new(SPHERE_RADIUS * 100.0, 0.0),
|parent_frame| {
// This function introduces a small amount of error, because it can only work up
// to double precision floats. (f64).
// This function introduces a small amount of error, because it can only work up to
// double precision floats. (f64).
let child = parent_frame
.frame()
.translation_to_grid(-DISTANT + NEARBY.as_dvec3());
Expand All @@ -61,16 +60,16 @@ fn setup_scene(
parent_frame.insert(parent.0);

parent_frame.with_children(|child_builder| {
// A green sphere that is a child of the sphere very far from the origin.
// This child is very far from its parent, and should be located exactly at
// the origin (if there was no floating point error). The distance from the
// green sphere to the red sphere is the error caused by float imprecision.
// Note that the sphere does not have any rendering artifacts, its position
// just has a fixed error.
// A green sphere that is a child of the sphere very far from the origin. This
// child is very far from its parent, and should be located exactly at the
// origin (if there was no floating point error). The distance from the green
// sphere to the red sphere is the error caused by float imprecision. Note that
// the sphere does not have any rendering artifacts, its position just has a
// fixed error.
child_builder.spawn((
PbrBundle {
mesh: mesh_handle,
material: materials.add(Color::from(palettes::css::GREEN)),
material: materials.add(Color::GREEN),
transform: Transform::from_translation(child.1),
..default()
},
Expand Down
15 changes: 7 additions & 8 deletions examples/planets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use bevy::{
render::camera::Exposure,
transform::TransformSystem,
};
use bevy_color::palettes;
use big_space::{
camera::{CameraController, CameraInput},
commands::BigSpaceCommands,
Expand Down Expand Up @@ -52,7 +51,7 @@ fn main() {
)
.register_type::<Sun>()
.register_type::<Rotates>()
.run();
.run()
}

const EARTH_ORBIT_RADIUS_M: f64 = 149.60e9;
Expand Down Expand Up @@ -130,7 +129,7 @@ fn spawn_solar_system(
let earth_mesh_handle = meshes.add(Sphere::new(1.0).mesh().ico(35).unwrap());
let moon_mesh_handle = meshes.add(Sphere::new(MOON_RADIUS_M as f32).mesh().ico(15).unwrap());
let ball_mesh_handle = meshes.add(Sphere::new(5.0).mesh().ico(5).unwrap());
let plane_mesh_handle = meshes.add(Plane3d::new(Vec3::X, Vec2::splat(0.5)));
let plane_mesh_handle = meshes.add(Plane3d::new(Vec3::X));

commands.spawn((
PrimaryLight,
Expand Down Expand Up @@ -161,7 +160,7 @@ fn spawn_solar_system(
mesh: sun_mesh_handle,
material: materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: LinearRgba::rgb(100000., 100000., 100000.),
emissive: Color::rgb_linear(100000000., 100000000., 100000000.),
..default()
}),
..default()
Expand All @@ -178,7 +177,7 @@ fn spawn_solar_system(
PbrBundle {
mesh: earth_mesh_handle,
material: materials.add(StandardMaterial {
base_color: Color::Srgba(palettes::css::BLUE),
base_color: Color::BLUE,
perceptual_roughness: 0.8,
reflectance: 1.0,
..default()
Expand All @@ -198,7 +197,7 @@ fn spawn_solar_system(
PbrBundle {
mesh: moon_mesh_handle,
material: materials.add(StandardMaterial {
base_color: Color::Srgba(palettes::css::GRAY),
base_color: Color::GRAY,
perceptual_roughness: 1.0,
reflectance: 0.0,
..default()
Expand Down Expand Up @@ -227,7 +226,7 @@ fn spawn_solar_system(
children.spawn((PbrBundle {
mesh: plane_mesh_handle,
material: materials.add(StandardMaterial {
base_color: Color::Srgba(palettes::css::DARK_GREEN),
base_color: Color::DARK_GREEN,
perceptual_roughness: 1.0,
reflectance: 0.0,
..default()
Expand Down Expand Up @@ -283,7 +282,7 @@ fn spawn_solar_system(

let star_mat = materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: LinearRgba::rgb(2., 2., 2.),
emissive: Color::rgb_linear(100000., 100000., 100000.),
..default()
});
let star_mesh_handle = meshes.add(Sphere::new(1e10).mesh().ico(5).unwrap());
Expand Down
Loading

0 comments on commit 6fa7d31

Please sign in to comment.