Rename
This commit is contained in:
parent
5591166b3a
commit
b04db5b2f0
@ -169,7 +169,7 @@ pub struct GltfPlugin {
|
|||||||
/// - glTF models: global -Z.
|
/// - glTF models: global -Z.
|
||||||
///
|
///
|
||||||
/// The default is `false`.
|
/// The default is `false`.
|
||||||
pub favor_model_coordinates: bool,
|
pub use_model_forward_direction: bool,
|
||||||
|
|
||||||
/// Registry for custom vertex attributes.
|
/// Registry for custom vertex attributes.
|
||||||
///
|
///
|
||||||
@ -182,7 +182,7 @@ impl Default for GltfPlugin {
|
|||||||
GltfPlugin {
|
GltfPlugin {
|
||||||
default_sampler: ImageSamplerDescriptor::linear(),
|
default_sampler: ImageSamplerDescriptor::linear(),
|
||||||
custom_vertex_attributes: HashMap::default(),
|
custom_vertex_attributes: HashMap::default(),
|
||||||
favor_model_coordinates: false,
|
use_model_forward_direction: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ impl Plugin for GltfPlugin {
|
|||||||
supported_compressed_formats,
|
supported_compressed_formats,
|
||||||
custom_vertex_attributes: self.custom_vertex_attributes.clone(),
|
custom_vertex_attributes: self.custom_vertex_attributes.clone(),
|
||||||
default_sampler,
|
default_sampler,
|
||||||
default_favor_model_coordinates: self.favor_model_coordinates,
|
default_use_model_forward_direction: self.use_model_forward_direction,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ pub struct GltfLoader {
|
|||||||
/// - glTF models: global -Z.
|
/// - glTF models: global -Z.
|
||||||
///
|
///
|
||||||
/// The default is `false`.
|
/// The default is `false`.
|
||||||
pub default_favor_model_coordinates: bool,
|
pub default_use_model_forward_direction: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies optional settings for processing gltfs at load time. By default, all recognized contents of
|
/// Specifies optional settings for processing gltfs at load time. By default, all recognized contents of
|
||||||
@ -212,8 +212,8 @@ pub struct GltfLoaderSettings {
|
|||||||
/// - glTF cameras and glTF lights: global +Z,
|
/// - glTF cameras and glTF lights: global +Z,
|
||||||
/// - glTF models: global -Z.
|
/// - glTF models: global -Z.
|
||||||
///
|
///
|
||||||
/// If `None`, uses the global default set by [`GltfPlugin::favor_model_coordinates`](crate::GltfPlugin::favor_model_coordinates).
|
/// If `None`, uses the global default set by [`GltfPlugin::use_model_forward_direction`](crate::GltfPlugin::use_model_forward_direction).
|
||||||
pub favor_model_coordinates: Option<bool>,
|
pub use_model_forward_direction: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for GltfLoaderSettings {
|
impl Default for GltfLoaderSettings {
|
||||||
@ -226,7 +226,7 @@ impl Default for GltfLoaderSettings {
|
|||||||
include_source: false,
|
include_source: false,
|
||||||
default_sampler: None,
|
default_sampler: None,
|
||||||
override_sampler: false,
|
override_sampler: false,
|
||||||
favor_model_coordinates: None,
|
use_model_forward_direction: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,9 +286,9 @@ async fn load_gltf<'a, 'b, 'c>(
|
|||||||
paths
|
paths
|
||||||
};
|
};
|
||||||
|
|
||||||
let convert_coordinates = match settings.favor_model_coordinates {
|
let convert_coordinates = match settings.use_model_forward_direction {
|
||||||
Some(convert_coordinates) => convert_coordinates,
|
Some(convert_coordinates) => convert_coordinates,
|
||||||
None => loader.default_favor_model_coordinates,
|
None => loader.default_use_model_forward_direction,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "bevy_animation")]
|
#[cfg(feature = "bevy_animation")]
|
||||||
|
@ -33,12 +33,12 @@ To remedy this, users can now change the import behavior to instead favor correc
|
|||||||
The downside is that glTF cameras and lights that have a global identity transform in glTF will now look to +Z instead of -Z in Bevy.
|
The downside is that glTF cameras and lights that have a global identity transform in glTF will now look to +Z instead of -Z in Bevy.
|
||||||
This should not be a problem in many cases, as the whole scene is rotated so that the end result on your screen will be rendered the exact same way.
|
This should not be a problem in many cases, as the whole scene is rotated so that the end result on your screen will be rendered the exact same way.
|
||||||
|
|
||||||
To globally opt into the behavior that favors glTF models over glTF cameras, you can set `GltfPlugin::favor_model_coordinates`:
|
To globally opt into the behavior that favors glTF models over glTF cameras, you can set `GltfPlugin::use_model_forward_direction`:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins.set(GltfPlugin {
|
.add_plugins(DefaultPlugins.set(GltfPlugin {
|
||||||
favor_model_coordinates: true,
|
use_model_forward_direction: true,
|
||||||
..default()
|
..default()
|
||||||
}))
|
}))
|
||||||
.run();
|
.run();
|
||||||
@ -50,9 +50,9 @@ You can also control this on a per-asset-level:
|
|||||||
let handle = asset_server.load_with_settings(
|
let handle = asset_server.load_with_settings(
|
||||||
"fox.gltf#Scene0",
|
"fox.gltf#Scene0",
|
||||||
|settings: &mut GltfLoaderSettings| {
|
|settings: &mut GltfLoaderSettings| {
|
||||||
settings.favor_model_coordinates = Some(true);
|
settings.use_model_forward_direction = Some(true);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting the above to `None` will fall back to the global setting taken from `GltfPlugin::favor_model_coordinates`.
|
Setting the above to `None` will fall back to the global setting taken from `GltfPlugin::use_model_forward_direction`.
|
||||||
|
Loading…
Reference in New Issue
Block a user