37 const ::skeleton& mesosoma_skeleton = phenome.
mesosoma->
model->get_skeleton();
38 const ::skeleton& legs_skeleton = phenome.
legs->
model->get_skeleton();
39 const ::skeleton& head_skeleton = phenome.
head->
model->get_skeleton();
40 const ::skeleton& mandibles_skeleton = phenome.
mandibles->
model->get_skeleton();
41 const ::skeleton& antennae_skeleton = phenome.
antennae->
model->get_skeleton();
42 const ::skeleton& waist_skeleton = phenome.
waist->
model->get_skeleton();
43 const ::skeleton& gaster_skeleton = phenome.
gaster->
model->get_skeleton();
44 const ::skeleton* sting_skeleton = (phenome.
sting->
present) ? &phenome.
sting->
model->get_skeleton() :
nullptr;
45 const ::skeleton* wings_skeleton = (phenome.
wings->
present) ? &phenome.
wings->
model->get_skeleton() :
nullptr;
138 const auto procoxa_l_angles =
math::fvec3{0.0f, 40.0f, 0.0f} * math::deg2rad<float>;
139 const auto procoxa_r_angles = procoxa_l_angles *
math::fvec3{1, -1, 1};
140 const auto profemur_l_angles =
math::fvec3{31.0f, 0.0f, 0.0f} * math::deg2rad<float>;
141 const auto profemur_r_angles = profemur_l_angles *
math::fvec3{1, 1, 1};
142 const auto protibia_l_angles =
math::fvec3{-90.0f, 0.0f, 0.0f} * math::deg2rad<float>;
143 const auto protibia_r_angles = protibia_l_angles *
math::fvec3{1, 1, 1};
144 const auto protarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
145 const auto protarsomere1_r_angles = protarsomere1_l_angles *
math::fvec3{1, 1, 1};
177 const auto mesocoxa_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
178 const auto mesocoxa_r_angles = mesocoxa_l_angles *
math::fvec3{1, 1, 1};
179 const auto mesofemur_l_angles =
math::fvec3{38.0f, 0.0f, 0.0f} * math::deg2rad<float>;
180 const auto mesofemur_r_angles = mesofemur_l_angles *
math::fvec3{1, 1, 1};
181 const auto mesotibia_l_angles =
math::fvec3{-100.0f, 0.0f, 0.0f} * math::deg2rad<float>;
182 const auto mesotibia_r_angles = mesotibia_l_angles *
math::fvec3{1, 1, 1};
183 const auto mesotarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
184 const auto mesotarsomere1_r_angles = mesotarsomere1_l_angles *
math::fvec3{1, 1, 1};
216 const auto metacoxa_l_angles =
math::fvec3{0.0f, -34.0f, 0.0f} * math::deg2rad<float>;
217 const auto metacoxa_r_angles = metacoxa_l_angles *
math::fvec3{1, -1, 1};
218 const auto metafemur_l_angles =
math::fvec3{48.0f, 0.0f, 0.0f} * math::deg2rad<float>;
219 const auto metafemur_r_angles = metafemur_l_angles *
math::fvec3{1, 1, 1};
220 const auto metatibia_l_angles =
math::fvec3{-100.0f, 0.0f, 0.0f} * math::deg2rad<float>;
221 const auto metatibia_r_angles = metatibia_l_angles *
math::fvec3{1, 1, 1};
222 const auto metatarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
223 const auto metatarsomere1_r_angles = metatarsomere1_l_angles *
math::fvec3{1, 1, 1};
269 const auto procoxa_l_angles =
math::fvec3{0.0f, 50.0f, 0.0f} * math::deg2rad<float>;
270 const auto procoxa_r_angles = procoxa_l_angles *
math::fvec3{1, -1, 1};
271 const auto profemur_l_angles =
math::fvec3{34.0f, 0.0f, 0.0f} * math::deg2rad<float>;
272 const auto profemur_r_angles = profemur_l_angles *
math::fvec3{1, 1, 1};
273 const auto protibia_l_angles =
math::fvec3{-118.0f, 0.0f, 0.0f} * math::deg2rad<float>;
274 const auto protibia_r_angles = protibia_l_angles *
math::fvec3{1, 1, 1};
275 const auto protarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
276 const auto protarsomere1_r_angles = protarsomere1_l_angles *
math::fvec3{1, 1, 1};
308 const auto mesocoxa_l_angles =
math::fvec3{0.0f, 30.0f, 0.0f} * math::deg2rad<float>;
309 const auto mesocoxa_r_angles = mesocoxa_l_angles *
math::fvec3{1, -1, 1};
310 const auto mesofemur_l_angles =
math::fvec3{36.0f, 0.0f, 0.0f} * math::deg2rad<float>;
311 const auto mesofemur_r_angles = mesofemur_l_angles *
math::fvec3{1, 1, 1};
312 const auto mesotibia_l_angles =
math::fvec3{-110.0f, 0.0f, 0.0f} * math::deg2rad<float>;
313 const auto mesotibia_r_angles = mesotibia_l_angles *
math::fvec3{1, 1, 1};
314 const auto mesotarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
315 const auto mesotarsomere1_r_angles = mesotarsomere1_l_angles *
math::fvec3{1, 1, 1};
347 const auto metacoxa_l_angles =
math::fvec3{0.0f, -27.5f, 0.0f} * math::deg2rad<float>;
348 const auto metacoxa_r_angles = metacoxa_l_angles *
math::fvec3{1, -1, 1};
349 const auto metafemur_l_angles =
math::fvec3{6.0f, 0.0f, 0.0f} * math::deg2rad<float>;
350 const auto metafemur_r_angles = metafemur_l_angles *
math::fvec3{1, 1, 1};
351 const auto metatibia_l_angles =
math::fvec3{-39.0f, 0.0f, 0.0f} * math::deg2rad<float>;
352 const auto metatibia_r_angles = metatibia_l_angles *
math::fvec3{1, 1, 1};
353 const auto metatarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
354 const auto metatarsomere1_r_angles = metatarsomere1_l_angles *
math::fvec3{1, 1, 1};
400 const auto procoxa_l_angles =
math::fvec3{0.0f, 25.0f, 0.0f} * math::deg2rad<float>;
401 const auto procoxa_r_angles = procoxa_l_angles *
math::fvec3{1, -1, 1};
402 const auto profemur_l_angles =
math::fvec3{10.0f, 0.0f, 0.0f} * math::deg2rad<float>;
403 const auto profemur_r_angles = profemur_l_angles *
math::fvec3{1, 1, 1};
404 const auto protibia_l_angles =
math::fvec3{-60.0f, 0.0f, 0.0f} * math::deg2rad<float>;
405 const auto protibia_r_angles = protibia_l_angles *
math::fvec3{1, 1, 1};
406 const auto protarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
407 const auto protarsomere1_r_angles = protarsomere1_l_angles *
math::fvec3{1, 1, 1};
439 const auto mesocoxa_l_angles =
math::fvec3{0.0f, -22.0f, 0.0f} * math::deg2rad<float>;
440 const auto mesocoxa_r_angles = mesocoxa_l_angles *
math::fvec3{1, -1, 1};
441 const auto mesofemur_l_angles =
math::fvec3{21.0f, 0.0f, 0.0f} * math::deg2rad<float>;
442 const auto mesofemur_r_angles = mesofemur_l_angles *
math::fvec3{1, 1, 1};
443 const auto mesotibia_l_angles =
math::fvec3{-80.0f, 0.0f, 0.0f} * math::deg2rad<float>;
444 const auto mesotibia_r_angles = mesotibia_l_angles *
math::fvec3{1, 1, 1};
445 const auto mesotarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
446 const auto mesotarsomere1_r_angles = mesotarsomere1_l_angles *
math::fvec3{1, 1, 1};
478 const auto metacoxa_l_angles =
math::fvec3{0.0f, -42.0f, 0.0f} * math::deg2rad<float>;
479 const auto metacoxa_r_angles = metacoxa_l_angles *
math::fvec3{1, -1, 1};
480 const auto metafemur_l_angles =
math::fvec3{60.0f, 0.0f, 0.0f} * math::deg2rad<float>;
481 const auto metafemur_r_angles = metafemur_l_angles *
math::fvec3{1, 1, 1};
482 const auto metatibia_l_angles =
math::fvec3{-125.0f, 0.0f, 0.0f} * math::deg2rad<float>;
483 const auto metatibia_r_angles = metatibia_l_angles *
math::fvec3{1, 1, 1};
484 const auto metatarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
485 const auto metatarsomere1_r_angles = metatarsomere1_l_angles *
math::fvec3{1, 1, 1};
531 const auto procoxa_l_angles =
math::fvec3{0.0f, 37.5f, 0.0f} * math::deg2rad<float>;
532 const auto procoxa_r_angles = procoxa_l_angles *
math::fvec3{1, -1, 1};
533 const auto profemur_l_angles =
math::fvec3{60.0f, 0.0f, 0.0f} * math::deg2rad<float>;
534 const auto profemur_r_angles = profemur_l_angles *
math::fvec3{1, 1, 1};
535 const auto protibia_l_angles =
math::fvec3{-100.0f, 0.0f, 0.0f} * math::deg2rad<float>;
536 const auto protibia_r_angles = protibia_l_angles *
math::fvec3{1, 1, 1};
537 const auto protarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
538 const auto protarsomere1_r_angles = protarsomere1_l_angles *
math::fvec3{1, 1, 1};
570 const auto mesocoxa_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
571 const auto mesocoxa_r_angles = mesocoxa_l_angles *
math::fvec3{1, 1, 1};
572 const auto mesofemur_l_angles =
math::fvec3{60.0f, 0.0f, 0.0f} * math::deg2rad<float>;
573 const auto mesofemur_r_angles = mesofemur_l_angles *
math::fvec3{1, 1, 1};
574 const auto mesotibia_l_angles =
math::fvec3{-100.0f, 0.0f, 0.0f} * math::deg2rad<float>;
575 const auto mesotibia_r_angles = mesotibia_l_angles *
math::fvec3{1, 1, 1};
576 const auto mesotarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
577 const auto mesotarsomere1_r_angles = mesotarsomere1_l_angles *
math::fvec3{1, 1, 1};
609 const auto metacoxa_l_angles =
math::fvec3{0.0f, -37.5f, 0.0f} * math::deg2rad<float>;
610 const auto metacoxa_r_angles = metacoxa_l_angles *
math::fvec3{1, -1, 1};
611 const auto metafemur_l_angles =
math::fvec3{60.0f, 0.0f, 0.0f} * math::deg2rad<float>;
612 const auto metafemur_r_angles = metafemur_l_angles *
math::fvec3{1, 1, 1};
613 const auto metatibia_l_angles =
math::fvec3{-100.0f, 0.0f, 0.0f} * math::deg2rad<float>;
614 const auto metatibia_r_angles = metatibia_l_angles *
math::fvec3{1, 1, 1};
615 const auto metatarsomere1_l_angles =
math::fvec3{0.0f, 0.0f, 0.0f} * math::deg2rad<float>;
616 const auto metatarsomere1_r_angles = metatarsomere1_l_angles *
math::fvec3{1, 1, 1};
670 constexpr
float profemur_fold_angle_z =
math::radians(20.0f);
671 constexpr
float profemur_fold_angle_x =
math::radians(80.0f);
683 constexpr
float protarsomere1_fold_angle =
math::radians(20.0f);
701 constexpr
float mesocoxa_fold_angle_z =
math::radians(45.0f);
702 constexpr
float mesocoxa_fold_angle_y =
math::radians(45.0f);
703 constexpr
float mesocoxa_fold_angle_x =
math::radians(10.0f);
715 constexpr
float mesotibia_fold_angle =
math::radians(162.0f);
721 constexpr
float mesotarsomere1_fold_angle =
math::radians(20.0f);
739 constexpr
float metacoxa_fold_angle_z =
math::radians(15.0f);
740 constexpr
float metacoxa_fold_angle_y =
math::radians(10.0f);
741 constexpr
float metacoxa_fold_angle_x =
math::radians(25.0f);
747 constexpr
float metafemur_fold_angle =
math::radians(105.0f);
753 constexpr
float metatibia_fold_angle =
math::radians(165.0f);
759 constexpr
float metatarsomere1_fold_angle =
math::radians(0.0f);
786 constexpr
float antennomere1_fold_angle_y =
math::radians(70.0f);
787 constexpr
float antennomere1_fold_angle_x =
math::radians(45.0f);
793 constexpr
float antennomere2_fold_angle_y =
math::radians(75.0f);
794 constexpr
float antennomere2_fold_angle_x =
math::radians(25.0f);
812 constexpr
float postpetiole_fold_angle =
math::radians(35.0f);
1039 generate_ant_rest_pose(
skeleton, bones, phenome);
1040 generate_ant_midstance_pose(
skeleton, bones);
1041 generate_ant_midswing_pose(
skeleton, bones);
1042 generate_ant_liftoff_pose(
skeleton, bones);
1043 generate_ant_touchdown_pose(
skeleton, bones);
1044 generate_ant_pupa_pose(
skeleton, bones);
void generate_ant_skeleton(skeleton &skeleton, ant_bone_set &bones, const ant_phenome &phenome)
Generates a skeleton for an ant model.
std::uint16_t bone_index_type
Bone index type.
Base class for skeleton poses.
void set_relative_transform(bone_index_type index, const bone_transform_type &transform)
Sets the relative transform describing a bone pose.
void update()
Updates the pose after one or more relative transforms have been changed.
const bone_transform_type & get_relative_transform(bone_index_type index) const
Returns the relative transform describing a bone pose.
Skeletal animation skeleton.
void set_bone_transform(bone_index_type index, const bone_transform_type &transform)
Sets the transform of a bone, relative to its parent bone.
std::optional< bone_index_type > get_bone_index(hash::fnv1a32_t name) const
Finds the index of a bone from the bone's name.
bone_index_type add_bones(std::size_t bone_count)
Add one or more bones to the skeleton.
void update_rest_pose()
Updates the rest pose of the skeleton.
void set_bone_parent(bone_index_type child_index, bone_index_type parent_index)
Sets the parent of a bone.
void set_bone_name(bone_index_type index, hash::fnv1a32_t name)
Sets the name of a bone.
animation_pose & add_pose(hash::fnv1a32_t name)
Adds a pose to the skeleton.
const rest_pose & get_rest_pose() const noexcept
Returns the skeleton's rest pose.
quat< T > euler_xyz_to_quat(const vec3< T > &angles)
Constructs a quaternion from Euler angles.
quaternion< T > angle_axis(T angle, const vec3< T > &axis)
Creates a rotation from an angle and axis.
constexpr T radians(T degrees) noexcept
Converts an angle given in degrees to radians.
@ bone_index
Vertex bone indices (uvec4)
std::shared_ptr< render::model > model
3D model of the antennae.
Set of bone indices for all possible bones in an ant skeleotn.
bone_index_type mandible_r
bone_index_type antennomere2_l
bone_index_type procoxa_r
bone_index_type protarsomere1_l
bone_index_type mesotarsomere1_l
std::optional< bone_index_type > hindwing_l
std::optional< bone_index_type > postpetiole
bone_index_type mesofemur_l
bone_index_type antennomere1_l
bone_index_type protibia_r
bone_index_type profemur_l
bone_index_type profemur_r
bone_index_type metatibia_r
bone_index_type mesotarsomere1_r
bone_index_type mesocoxa_l
std::optional< bone_index_type > forewing_l
bone_index_type mesotibia_r
bone_index_type mandible_l
std::optional< bone_index_type > sting
bone_index_type metafemur_l
std::optional< bone_index_type > forewing_r
bone_index_type mesocoxa_r
bone_index_type protarsomere1_r
bone_index_type mesofemur_r
bone_index_type metatibia_l
std::optional< bone_index_type > petiole
bone_index_type metacoxa_r
bone_index_type metatarsomere1_l
bone_index_type protibia_l
std::optional< bone_index_type > hindwing_r
bone_index_type antennomere2_r
bone_index_type metacoxa_l
bone_index_type procoxa_l
bone_index_type mesotibia_l
bone_index_type antennomere1_r
bone_index_type metafemur_r
bone_index_type metatarsomere1_r
std::shared_ptr< render::model > model
3D model of the gaster.
std::shared_ptr< render::model > model
3D model of the head.
std::shared_ptr< render::model > model
3D model of the legs.
std::shared_ptr< render::model > model
3D model of the mandibles.
std::shared_ptr< render::model > model
3D model of the mesosoma.
Complete set of ant phenes.
const ant_sting_phene * sting
const ant_mandibles_phene * mandibles
const ant_legs_phene * legs
const ant_antennae_phene * antennae
const ant_wings_phene * wings
const ant_waist_phene * waist
const ant_head_phene * head
const ant_gaster_phene * gaster
const ant_mesosoma_phene * mesosoma
bool present
Indicates whether a sting present or not.
std::shared_ptr< render::model > model
3D model of the sting.
bool postpetiole_present
Postpetiole presence.
std::shared_ptr< render::model > model
3D model of the waist.
std::shared_ptr< render::model > model
3D model of the wings.
bool present
Wings presence.
32-bit FNV-1a hash value.