diff --git a/studio/src/anim.rs b/studio/src/anim.rs new file mode 100644 index 0000000..64ab974 --- /dev/null +++ b/studio/src/anim.rs @@ -0,0 +1,16 @@ +use bevy::{math::Affine3A, prelude::*}; + +#[derive(Component)] +pub struct SkeletalJoint(pub Color); + +#[derive(Component)] +pub struct Skeleton; + +#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] +pub struct BindPoseLocal(pub Transform); + +#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] +pub struct BindPoseGlobal(pub Affine3A); + +#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] +pub struct InvBindPose(pub Affine3A); diff --git a/studio/src/bvh/mod.rs b/studio/src/bvh/mod.rs index 3feec75..1cecb20 100644 --- a/studio/src/bvh/mod.rs +++ b/studio/src/bvh/mod.rs @@ -13,8 +13,9 @@ mod error; mod loader; use crate::{ + anim::{BindPoseGlobal, InvBindPose, SkeletalJoint}, math::{Lerp, MatrixExtras}, - scene::{BindPoseGlobal, InvBindPose, SceneState, SkeletalJoint}, + scene::SceneState, }; use self::loader::BvhLoader; diff --git a/studio/src/debug.rs b/studio/src/debug.rs index cad2735..f5616c6 100644 --- a/studio/src/debug.rs +++ b/studio/src/debug.rs @@ -5,11 +5,10 @@ use bevy_inspector_egui::quick::WorldInspectorPlugin; use bevy_mod_picking::debug::DebugPickingMode; use crate::{ + anim::SkeletalJoint, camera_controller::{CameraController, CameraMotionSystem}, input::{Action, InputAction, Lifecycle}, - is_editor, - scene::SkeletalJoint, - MainCamera, + is_editor, MainCamera, }; #[derive(Resource, Deref, DerefMut)] diff --git a/studio/src/lib.rs b/studio/src/lib.rs index 8c30128..8261dc2 100644 --- a/studio/src/lib.rs +++ b/studio/src/lib.rs @@ -9,6 +9,7 @@ use space_editor::prelude::space_undo::UndoPlugin; use wasm_bindgen::prelude::*; mod algo; +mod anim; mod bvh; mod camera_controller; mod debug; diff --git a/studio/src/mixamo/mod.rs b/studio/src/mixamo/mod.rs index 7f435a9..669c586 100644 --- a/studio/src/mixamo/mod.rs +++ b/studio/src/mixamo/mod.rs @@ -5,7 +5,7 @@ use bevy::{ utils::{HashMap, HashSet}, }; -use crate::scene::Skeleton; +use crate::anim::Skeleton; pub struct MixamoPlugin; diff --git a/studio/src/scene.rs b/studio/src/scene.rs index d40fa38..dcf6555 100644 --- a/studio/src/scene.rs +++ b/studio/src/scene.rs @@ -6,7 +6,7 @@ use bevy::{ tonemapping::Tonemapping, }, gltf::Gltf, - math::{vec2, vec3, Affine3A}, + math::{vec2, vec3}, pbr::ShadowFilteringMethod, prelude::*, render::{mesh::skinning::SkinnedMesh, primitives::Aabb, view::NoFrustumCulling}, @@ -19,6 +19,7 @@ use wasm_bindgen::prelude::wasm_bindgen; use crate::{ algo, + anim::{BindPoseGlobal, BindPoseLocal, InvBindPose, SkeletalJoint, Skeleton}, bvh::{Bvh, CommandsSpawnBvhExt}, camera_controller::{CameraController, CameraControllerBundle}, debug::DebugPoint, @@ -117,27 +118,12 @@ pub struct LoadSceneEvent(pub String); #[derive(Component)] pub struct SceneElement; -#[derive(Component)] -pub struct SkeletalJoint(pub Color); - -#[derive(Component)] -pub struct Skeleton; - #[derive(Component)] pub struct SceneRoot; #[derive(Resource, Deref, DerefMut)] pub struct TestBvh(pub Handle); // TODO -#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] -pub struct BindPoseLocal(pub Transform); - -#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] -pub struct BindPoseGlobal(pub Affine3A); - -#[derive(Component, Clone, Copy, Debug, Deref, DerefMut)] -pub struct InvBindPose(pub Affine3A); - fn initialize(mut cmd: Commands) { // Camera, graphics settings let focus = Vec3::ZERO;