tweak camera to make example render the cube correctly

This commit is contained in:
VitalyR 2025-06-11 23:15:03 +08:00
parent 3d2ce47690
commit fdb780b50d
3 changed files with 7 additions and 11 deletions

View File

@ -733,12 +733,15 @@ impl AssetLoader for FbxLoader {
default_scene: Some(scene_handle), default_scene: Some(scene_handle),
animations, animations,
named_animations, named_animations,
// FBX_TODO
axis_system: FbxAxisSystem { axis_system: FbxAxisSystem {
up: Vec3::Y, up: Vec3::Y,
front: Vec3::Z, front: Vec3::Z,
handedness: Handedness::Right, handedness: Handedness::Right,
}, },
// FBX_TODO
unit_scale: 1.0, unit_scale: 1.0,
// FBX_TODO
metadata: FbxMeta { metadata: FbxMeta {
creator: None, creator: None,
creation_time: None, creation_time: None,

View File

@ -22,7 +22,8 @@ fn main() {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(( commands.spawn((
Camera3d::default(), Camera3d::default(),
Transform::from_xyz(0.7, 0.7, 1.0).looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y), Transform::from_xyz(0.7, 2.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
// Transform::from_xyz(0.7, 0.7, 1.0).looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
EnvironmentMapLight { EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"), diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"), specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
@ -48,7 +49,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
.build(), .build(),
)); ));
// Load the FBX file and spawn its default scene // Load the FBX file and spawn its first scene
commands.spawn(SceneRoot( commands.spawn(SceneRoot(
asset_server.load(FbxAssetLabel::Scene(0).from_asset("models/cube/cube.fbx")), asset_server.load(FbxAssetLabel::Scene(0).from_asset("models/cube/cube.fbx")),
)); ));

View File

@ -82,7 +82,7 @@ fn setup(
commands.spawn(( commands.spawn((
Mesh3d(cube_handle), Mesh3d(cube_handle),
MeshMaterial3d(material_handle.clone()), MeshMaterial3d(material_handle.clone()),
Transform::from_xyz(0.0, 3.0, 0.0), Transform::from_xyz(0.0, 0.0, 0.0),
)); ));
// sphere // sphere
commands.spawn(( commands.spawn((
@ -90,14 +90,6 @@ fn setup(
MeshMaterial3d(material_handle), MeshMaterial3d(material_handle),
Transform::from_xyz(3.0, 0.0, 0.0), Transform::from_xyz(3.0, 0.0, 0.0),
)); ));
// TODO: don't touch this example
commands.spawn(SceneRoot(
asset_server.load(FbxAssetLabel::Scene(0).from_asset("models/cube/cube.fbx")),
));
// commands.spawn(SceneRoot(
// asset_server.load(GltfAssetLabel::Scene(0).from_asset("models/cube/cube.gltf")),
// ));
// light // light
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 5.0, 4.0))); commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 5.0, 4.0)));
// camera // camera