Merge branch 'main' into construct_lighting_input
This commit is contained in:
commit
c6d9cd488b
@ -18,28 +18,17 @@ bevy_reflect = [
|
||||
"dep:bevy_reflect",
|
||||
"bevy_app/bevy_reflect",
|
||||
"bevy_ecs/bevy_reflect",
|
||||
"bevy_input_focus/bevy_reflect",
|
||||
]
|
||||
|
||||
## Adds serialization support through `serde`.
|
||||
serialize = [
|
||||
"dep:serde",
|
||||
"bevy_ecs/serialize",
|
||||
"bevy_input_focus/serialize",
|
||||
"accesskit/serde",
|
||||
]
|
||||
serialize = ["dep:serde", "bevy_ecs/serialize", "accesskit/serde"]
|
||||
|
||||
# Platform Compatibility
|
||||
|
||||
## Allows access to the `std` crate. Enabling this feature will prevent compilation
|
||||
## on `no_std` targets, but provides access to certain additional features on
|
||||
## supported platforms.
|
||||
std = [
|
||||
"bevy_app/std",
|
||||
"bevy_ecs/std",
|
||||
"bevy_reflect/std",
|
||||
"bevy_input_focus/std",
|
||||
]
|
||||
std = ["bevy_app/std", "bevy_ecs/std", "bevy_reflect/std"]
|
||||
|
||||
## `critical-section` provides the building blocks for synchronization primitives
|
||||
## on all platforms, including `no_std`.
|
||||
@ -47,19 +36,14 @@ critical-section = [
|
||||
"bevy_app/critical-section",
|
||||
"bevy_ecs/critical-section",
|
||||
"bevy_reflect?/critical-section",
|
||||
"bevy_input_focus/critical-section",
|
||||
]
|
||||
|
||||
## Uses the `libm` maths library instead of the one provided in `std` and `core`.
|
||||
libm = ["bevy_input_focus/libm"]
|
||||
|
||||
[dependencies]
|
||||
# bevy
|
||||
bevy_app = { path = "../bevy_app", version = "0.16.0-dev", default-features = false }
|
||||
bevy_derive = { path = "../bevy_derive", version = "0.16.0-dev" }
|
||||
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev", default-features = false }
|
||||
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", default-features = false, optional = true }
|
||||
bevy_input_focus = { path = "../bevy_input_focus", version = "0.16.0-dev", default-features = false }
|
||||
|
||||
# other
|
||||
accesskit = { version = "0.17", default-features = false }
|
||||
|
@ -12,7 +12,7 @@ keywords = ["bevy"]
|
||||
trace = []
|
||||
webgl = []
|
||||
webgpu = []
|
||||
dds = ["bevy_render/dds", "bevy_image/dds"]
|
||||
dds = ["bevy_render/dds", "bevy_image/dds", "bevy_core_pipeline/dds"]
|
||||
smaa_luts = ["bevy_render/ktx2", "bevy_image/ktx2", "bevy_image/zstd"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -942,7 +942,7 @@ impl Archetypes {
|
||||
let archetypes = &mut self.archetypes;
|
||||
let archetype_component_count = &mut self.archetype_component_count;
|
||||
let component_index = &mut self.by_component;
|
||||
let archetype_id = *self
|
||||
*self
|
||||
.by_components
|
||||
.entry(archetype_identity)
|
||||
.or_insert_with_key(move |identity| {
|
||||
@ -975,8 +975,7 @@ impl Archetypes {
|
||||
.zip(sparse_set_archetype_components),
|
||||
));
|
||||
id
|
||||
});
|
||||
archetype_id
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the number of components that are stored in archetypes.
|
||||
|
@ -1585,7 +1585,7 @@ impl Bundles {
|
||||
storages: &mut Storages,
|
||||
) -> BundleId {
|
||||
let bundle_infos = &mut self.bundle_infos;
|
||||
let id = *self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
|
||||
*self.bundle_ids.entry(TypeId::of::<T>()).or_insert_with(|| {
|
||||
let mut component_ids= Vec::new();
|
||||
T::component_ids(components, &mut |id| component_ids.push(id));
|
||||
let id = BundleId(bundle_infos.len());
|
||||
@ -1597,8 +1597,7 @@ impl Bundles {
|
||||
unsafe { BundleInfo::new(core::any::type_name::<T>(), storages, components, component_ids, id) };
|
||||
bundle_infos.push(bundle_info);
|
||||
id
|
||||
});
|
||||
id
|
||||
})
|
||||
}
|
||||
|
||||
/// Registers a new [`BundleInfo`], which contains both explicit and required components for a statically known type.
|
||||
|
@ -931,13 +931,9 @@ impl Image {
|
||||
#[cfg(all(debug_assertions, feature = "dds"))] name: String,
|
||||
buffer: &[u8],
|
||||
image_type: ImageType,
|
||||
#[expect(
|
||||
clippy::allow_attributes,
|
||||
reason = "`unused_variables` may not always lint"
|
||||
)]
|
||||
#[allow(
|
||||
unused_variables,
|
||||
reason = "`supported_compressed_formats` is needed where the image format is `Basis`, `Dds`, or `Ktx2`; if these are disabled, then `supported_compressed_formats` is unused."
|
||||
#[cfg_attr(
|
||||
not(any(feature = "basis-universal", feature = "dds", feature = "ktx2")),
|
||||
expect(unused_variables, reason = "only used with certain features")
|
||||
)]
|
||||
supported_compressed_formats: CompressedImageFormats,
|
||||
is_srgb: bool,
|
||||
|
@ -329,7 +329,6 @@ critical-section = [
|
||||
|
||||
# Uses the `libm` maths library instead of the one provided in `std` and `core`.
|
||||
libm = [
|
||||
"bevy_a11y?/libm",
|
||||
"bevy_color?/libm",
|
||||
"bevy_input/libm",
|
||||
"bevy_input_focus?/libm",
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Provides `Barrier` and `BarrierWaitResult`
|
||||
|
||||
pub use barrier::{Barrier, BarrierWaitResult};
|
||||
pub use implementation::{Barrier, BarrierWaitResult};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as barrier;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod barrier {
|
||||
mod implementation {
|
||||
use core::fmt;
|
||||
|
||||
/// Fallback implementation of `Barrier` from the standard library.
|
||||
|
@ -1,11 +1,11 @@
|
||||
//! Provides `LazyLock`
|
||||
|
||||
pub use lazy_lock::LazyLock;
|
||||
pub use implementation::LazyLock;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as lazy_lock;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod lazy_lock {
|
||||
mod implementation {
|
||||
pub use spin::Lazy as LazyLock;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Provides `Mutex` and `MutexGuard`
|
||||
|
||||
pub use mutex::{Mutex, MutexGuard};
|
||||
pub use implementation::{Mutex, MutexGuard};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as mutex;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod mutex {
|
||||
mod implementation {
|
||||
use crate::sync::{LockResult, TryLockError, TryLockResult};
|
||||
use core::fmt;
|
||||
|
||||
@ -81,7 +81,7 @@ mod mutex {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized + Default> Default for Mutex<T> {
|
||||
impl<T: Default> Default for Mutex<T> {
|
||||
fn default() -> Mutex<T> {
|
||||
Mutex::new(Default::default())
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Provides `Once`, `OnceState`, `OnceLock`
|
||||
|
||||
pub use once::{Once, OnceLock, OnceState};
|
||||
pub use implementation::{Once, OnceLock, OnceState};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as once;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod once {
|
||||
mod implementation {
|
||||
use core::{
|
||||
fmt,
|
||||
panic::{RefUnwindSafe, UnwindSafe},
|
||||
@ -145,6 +145,7 @@ mod once {
|
||||
/// Creates a new `Once` value.
|
||||
///
|
||||
/// See the standard library for further details.
|
||||
#[expect(clippy::new_without_default, reason = "matching std::sync::Once")]
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
inner: OnceLock::new(),
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Provides `LockResult`, `PoisonError`, `TryLockError`, `TryLockResult`
|
||||
|
||||
pub use poison::{LockResult, PoisonError, TryLockError, TryLockResult};
|
||||
pub use implementation::{LockResult, PoisonError, TryLockError, TryLockResult};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as poison;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod poison {
|
||||
mod implementation {
|
||||
use core::{error::Error, fmt};
|
||||
|
||||
/// Fallback implementation of `PoisonError` from the standard library.
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! TODO: Implement `RwLock`, `RwLockReadGuard`, `RwLockWriteGuard`
|
||||
//! Provides `RwLock`, `RwLockReadGuard`, `RwLockWriteGuard`
|
||||
|
||||
pub use rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
pub use implementation::{RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync as rwlock;
|
||||
use std::sync as implementation;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod rwlock {
|
||||
mod implementation {
|
||||
use crate::sync::{LockResult, TryLockError, TryLockResult};
|
||||
use core::fmt;
|
||||
|
||||
|
@ -36,7 +36,7 @@ impl Instant {
|
||||
let getter = ELAPSED_GETTER.load(Ordering::Acquire);
|
||||
|
||||
// SAFETY: Function pointer is always valid
|
||||
let getter = unsafe { core::mem::transmute::<_, fn() -> Duration>(getter) };
|
||||
let getter = unsafe { core::mem::transmute::<*mut (), fn() -> Duration>(getter) };
|
||||
|
||||
Self((getter)())
|
||||
}
|
||||
@ -149,28 +149,29 @@ impl fmt::Debug for Instant {
|
||||
}
|
||||
|
||||
fn unset_getter() -> Duration {
|
||||
let _nanos: u64;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
unsafe {
|
||||
_nanos = core::arch::x86::_rdtsc();
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_arch = "x86")] {
|
||||
// SAFETY: standard technique for getting a nanosecond counter on x86
|
||||
let nanos = unsafe {
|
||||
core::arch::x86::_rdtsc()
|
||||
};
|
||||
Duration::from_nanos(nanos)
|
||||
} else if #[cfg(target_arch = "x86_64")] {
|
||||
// SAFETY: standard technique for getting a nanosecond counter on x86_64
|
||||
let nanos = unsafe {
|
||||
core::arch::x86_64::_rdtsc()
|
||||
};
|
||||
Duration::from_nanos(nanos)
|
||||
} else if #[cfg(target_arch = "aarch64")] {
|
||||
// SAFETY: standard technique for getting a nanosecond counter of aarch64
|
||||
let nanos = unsafe {
|
||||
let mut ticks: u64;
|
||||
core::arch::asm!("mrs {}, cntvct_el0", out(reg) ticks);
|
||||
ticks
|
||||
};
|
||||
Duration::from_nanos(nanos)
|
||||
} else {
|
||||
panic!("An elapsed time getter has not been provided to `Instant`. Please use `Instant::set_elapsed(...)` before calling `Instant::now()`")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
unsafe {
|
||||
_nanos = core::arch::x86_64::_rdtsc();
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
unsafe {
|
||||
let mut ticks: u64;
|
||||
core::arch::asm!("mrs {}, cntvct_el0", out(reg) ticks);
|
||||
_nanos = ticks;
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))]
|
||||
panic!("An elapsed time getter has not been provided to `Instant`. Please use `Instant::set_elapsed(...)` before calling `Instant::now()`");
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))]
|
||||
return Duration::from_nanos(_nanos);
|
||||
}
|
||||
|
@ -19,19 +19,18 @@ use bevy_reflect::{
|
||||
serde::{ReflectSerializer, TypedReflectDeserializer},
|
||||
GetPath, PartialReflect, TypeRegistration, TypeRegistry,
|
||||
};
|
||||
use bevy_utils::default;
|
||||
use serde::{de::DeserializeSeed as _, Deserialize, Serialize};
|
||||
use serde_json::{Map, Value};
|
||||
|
||||
use crate::{
|
||||
error_codes,
|
||||
schemas::{
|
||||
json_schema::JsonSchemaBevyType,
|
||||
open_rpc::{OpenRpcDocument, ServerObject},
|
||||
},
|
||||
schemas::{json_schema::JsonSchemaBevyType, open_rpc::OpenRpcDocument},
|
||||
BrpError, BrpResult,
|
||||
};
|
||||
|
||||
#[cfg(feature = "http")]
|
||||
use {crate::schemas::open_rpc::ServerObject, bevy_utils::default};
|
||||
|
||||
/// The method path for a `bevy/get` request.
|
||||
pub const BRP_GET_METHOD: &str = "bevy/get";
|
||||
|
||||
@ -821,6 +820,8 @@ pub fn process_remote_list_methods_request(
|
||||
world: &mut World,
|
||||
) -> BrpResult {
|
||||
let remote_methods = world.resource::<crate::RemoteMethods>();
|
||||
|
||||
#[cfg(feature = "http")]
|
||||
let servers = match (
|
||||
world.get_resource::<crate::http::HostAddress>(),
|
||||
world.get_resource::<crate::http::HostPort>(),
|
||||
@ -837,6 +838,10 @@ pub fn process_remote_list_methods_request(
|
||||
}]),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "http"))]
|
||||
let servers = None;
|
||||
|
||||
let doc = OpenRpcDocument {
|
||||
info: Default::default(),
|
||||
methods: remote_methods.into(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{ron, DynamicSceneBuilder, Scene, SceneSpawnError};
|
||||
use crate::{DynamicSceneBuilder, Scene, SceneSpawnError};
|
||||
use bevy_asset::Asset;
|
||||
use bevy_ecs::reflect::{ReflectMapEntities, ReflectResource};
|
||||
use bevy_ecs::{
|
||||
@ -6,15 +6,18 @@ use bevy_ecs::{
|
||||
reflect::{AppTypeRegistry, ReflectComponent},
|
||||
world::World,
|
||||
};
|
||||
use bevy_reflect::{PartialReflect, TypePath, TypeRegistry};
|
||||
use bevy_reflect::{PartialReflect, TypePath};
|
||||
|
||||
use crate::reflect_utils::clone_reflect_value;
|
||||
#[cfg(feature = "serialize")]
|
||||
use crate::serde::SceneSerializer;
|
||||
use bevy_ecs::component::ComponentCloneBehavior;
|
||||
use bevy_ecs::relationship::RelationshipHookMode;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::Serialize;
|
||||
use {
|
||||
crate::{ron, serde::SceneSerializer},
|
||||
bevy_reflect::TypeRegistry,
|
||||
serde::Serialize,
|
||||
};
|
||||
|
||||
/// A collection of serializable resources and dynamic entities.
|
||||
///
|
||||
|
@ -27,7 +27,6 @@ pub mod serde;
|
||||
/// Rusty Object Notation, a crate used to serialize and deserialize bevy scenes.
|
||||
pub use bevy_asset::ron;
|
||||
|
||||
use bevy_ecs::schedule::IntoScheduleConfigs;
|
||||
pub use components::*;
|
||||
pub use dynamic_scene::*;
|
||||
pub use dynamic_scene_builder::*;
|
||||
@ -48,7 +47,9 @@ pub mod prelude {
|
||||
}
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AssetApp;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use {bevy_asset::AssetApp, bevy_ecs::schedule::IntoScheduleConfigs};
|
||||
|
||||
/// Plugin that provides scene functionality to an [`App`].
|
||||
#[derive(Default)]
|
||||
|
@ -1,21 +1,27 @@
|
||||
#[cfg(feature = "serialize")]
|
||||
use crate::serde::SceneDeserializer;
|
||||
use crate::{ron, DynamicScene};
|
||||
use bevy_asset::{io::Reader, AssetLoader, LoadContext};
|
||||
use crate::ron;
|
||||
use bevy_ecs::{
|
||||
reflect::AppTypeRegistry,
|
||||
world::{FromWorld, World},
|
||||
};
|
||||
use bevy_reflect::TypeRegistryArc;
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::de::DeserializeSeed;
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
use {
|
||||
crate::{serde::SceneDeserializer, DynamicScene},
|
||||
bevy_asset::{io::Reader, AssetLoader, LoadContext},
|
||||
serde::de::DeserializeSeed,
|
||||
};
|
||||
|
||||
/// Asset loader for a Bevy dynamic scene (`.scn` / `.scn.ron`).
|
||||
///
|
||||
/// The loader handles assets serialized with [`DynamicScene::serialize`].
|
||||
#[derive(Debug)]
|
||||
pub struct SceneLoader {
|
||||
#[cfg_attr(
|
||||
not(feature = "serialize"),
|
||||
expect(dead_code, reason = "only used with `serialize` feature")
|
||||
)]
|
||||
type_registry: TypeRegistryArc,
|
||||
}
|
||||
|
||||
|
@ -160,12 +160,13 @@ pub fn time_system(
|
||||
None => None,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
let sent_time = None;
|
||||
|
||||
match update_strategy.as_ref() {
|
||||
TimeUpdateStrategy::Automatic => {
|
||||
#[cfg(feature = "std")]
|
||||
real_time.update_with_instant(sent_time.unwrap_or_else(Instant::now));
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
real_time.update_with_instant(Instant::now());
|
||||
}
|
||||
TimeUpdateStrategy::ManualInstant(instant) => real_time.update_with_instant(*instant),
|
||||
TimeUpdateStrategy::ManualDuration(duration) => real_time.update_with_duration(*duration),
|
||||
|
@ -29,8 +29,7 @@ impl<T: Default + Send> Parallel<T> {
|
||||
/// If there is no thread-local value, it will be initialized to its default.
|
||||
pub fn scope<R>(&self, f: impl FnOnce(&mut T) -> R) -> R {
|
||||
let mut cell = self.locals.get_or_default().borrow_mut();
|
||||
let ret = f(cell.deref_mut());
|
||||
ret
|
||||
f(cell.deref_mut())
|
||||
}
|
||||
|
||||
/// Mutably borrows the thread-local value.
|
||||
|
Loading…
Reference in New Issue
Block a user