veloren_voxygen_anim/object/
beam.rs

1use super::{
2    super::{Animation, vek::*},
3    ObjectSkeleton, SkeletonAttr,
4};
5use common::{
6    comp::{item::ToolKind, object::Body},
7    states::utils::StageSection,
8};
9pub struct BeamAnimation;
10
11type BeamAnimationDependency = (
12    Option<ToolKind>,
13    Option<ToolKind>,
14    Option<StageSection>,
15    Body,
16);
17impl Animation for BeamAnimation {
18    type Dependency<'a> = BeamAnimationDependency;
19    type Skeleton = ObjectSkeleton;
20
21    #[cfg(feature = "use-dyn-lib")]
22    const UPDATE_FN: &'static [u8] = b"object_beam\0";
23
24    #[cfg_attr(feature = "be-dyn-lib", export_name = "object_beam")]
25    fn update_skeleton_inner(
26        skeleton: &Self::Skeleton,
27        (_active_tool_kind, _second_tool_kind, _stage_section, _body): Self::Dependency<'_>,
28        _anim_time: f32,
29        rate: &mut f32,
30        s_a: &SkeletonAttr,
31    ) -> Self::Skeleton {
32        *rate = 1.0;
33
34        let mut next = (*skeleton).clone();
35
36        next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
37        next.bone0.orientation = Quaternion::rotation_z(0.0);
38
39        next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
40        next.bone1.orientation = Quaternion::rotation_z(0.0);
41
42        next
43    }
44}