Browse Source

Make some ant bones non-optional

master
C. J. Howard 1 year ago
parent
commit
a6ad08abe0
3 changed files with 257 additions and 257 deletions
  1. +33
    -33
      src/game/ant/ant-bone-set.hpp
  2. +79
    -79
      src/game/ant/ant-morphogenesis.cpp
  3. +145
    -145
      src/game/ant/ant-skeleton.cpp

+ 33
- 33
src/game/ant/ant-bone-set.hpp View File

@ -28,41 +28,41 @@
*/
struct ant_bone_set
{
std::optional<bone_index_type> mesosoma;
std::optional<bone_index_type> procoxa_l;
std::optional<bone_index_type> profemur_l;
std::optional<bone_index_type> protibia_l;
std::optional<bone_index_type> protarsus_l;
std::optional<bone_index_type> procoxa_r;
std::optional<bone_index_type> profemur_r;
std::optional<bone_index_type> protibia_r;
std::optional<bone_index_type> protarsus_r;
std::optional<bone_index_type> mesocoxa_l;
std::optional<bone_index_type> mesofemur_l;
std::optional<bone_index_type> mesotibia_l;
std::optional<bone_index_type> mesotarsus_l;
std::optional<bone_index_type> mesocoxa_r;
std::optional<bone_index_type> mesofemur_r;
std::optional<bone_index_type> mesotibia_r;
std::optional<bone_index_type> mesotarsus_r;
std::optional<bone_index_type> metacoxa_l;
std::optional<bone_index_type> metafemur_l;
std::optional<bone_index_type> metatibia_l;
std::optional<bone_index_type> metatarsus_l;
std::optional<bone_index_type> metacoxa_r;
std::optional<bone_index_type> metafemur_r;
std::optional<bone_index_type> metatibia_r;
std::optional<bone_index_type> metatarsus_r;
std::optional<bone_index_type> head;
std::optional<bone_index_type> mandible_l;
std::optional<bone_index_type> mandible_r;
std::optional<bone_index_type> antennomere1_l;
std::optional<bone_index_type> antennomere2_l;
std::optional<bone_index_type> antennomere1_r;
std::optional<bone_index_type> antennomere2_r;
bone_index_type mesosoma;
bone_index_type procoxa_l;
bone_index_type profemur_l;
bone_index_type protibia_l;
bone_index_type protarsus_l;
bone_index_type procoxa_r;
bone_index_type profemur_r;
bone_index_type protibia_r;
bone_index_type protarsus_r;
bone_index_type mesocoxa_l;
bone_index_type mesofemur_l;
bone_index_type mesotibia_l;
bone_index_type mesotarsus_l;
bone_index_type mesocoxa_r;
bone_index_type mesofemur_r;
bone_index_type mesotibia_r;
bone_index_type mesotarsus_r;
bone_index_type metacoxa_l;
bone_index_type metafemur_l;
bone_index_type metatibia_l;
bone_index_type metatarsus_l;
bone_index_type metacoxa_r;
bone_index_type metafemur_r;
bone_index_type metatibia_r;
bone_index_type metatarsus_r;
bone_index_type head;
bone_index_type mandible_l;
bone_index_type mandible_r;
bone_index_type antennomere1_l;
bone_index_type antennomere2_l;
bone_index_type antennomere1_r;
bone_index_type antennomere2_r;
std::optional<bone_index_type> petiole;
std::optional<bone_index_type> postpetiole;
std::optional<bone_index_type> gaster;
bone_index_type gaster;
std::optional<bone_index_type> sting;
std::optional<bone_index_type> forewing_l;
std::optional<bone_index_type> forewing_r;

+ 79
- 79
src/game/ant/ant-morphogenesis.cpp View File

@ -442,12 +442,12 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
// Calculate transformations from part space to body space
const math::transform<float> legs_to_body = math::transform<float>::identity();
const math::transform<float> head_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "head");
const math::transform<float> mandible_l_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "mandible_l");
const math::transform<float> mandible_r_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "mandible_r");
const math::transform<float> antenna_l_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "antenna_l");
const math::transform<float> antenna_r_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "antenna_r");
const math::transform<float> waist_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "petiole");
const math::transform<float> head_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "head");
const math::transform<float> mandible_l_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "mandible_l");
const math::transform<float> mandible_r_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "mandible_r");
const math::transform<float> antenna_l_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "antenna_l");
const math::transform<float> antenna_r_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "antenna_r");
const math::transform<float> waist_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "petiole");
math::transform<float> gaster_to_body;
if (phenome.waist->postpetiole_present)
@ -460,7 +460,7 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
}
else
{
gaster_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(waist_skeleton, "gaster");
gaster_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(waist_skeleton, "gaster");
}
math::transform<float> sting_to_body;
@ -473,8 +473,8 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
math::transform<float> eye_r_to_body;
if (phenome.eyes->present)
{
eye_l_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "eye_l");
eye_r_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "eye_r");
eye_l_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "eye_l");
eye_r_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "eye_r");
}
math::transform<float> ocellus_l_to_body;
@ -482,12 +482,12 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
math::transform<float> ocellus_m_to_body;
if (phenome.ocelli->lateral_ocelli_present)
{
ocellus_l_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "ocellus_l");
ocellus_r_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "ocellus_r");
ocellus_l_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "ocellus_l");
ocellus_r_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "ocellus_r");
}
if (phenome.ocelli->median_ocellus_present)
{
ocellus_m_to_body = rest_pose.get_absolute_transform(*bones.head) * get_bone_transform(head_skeleton, "ocellus_m");
ocellus_m_to_body = rest_pose.get_absolute_transform(bones.head) * get_bone_transform(head_skeleton, "ocellus_m");
}
math::transform<float> forewing_l_to_body;
@ -496,85 +496,85 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
math::transform<float> hindwing_r_to_body;
if (phenome.wings->present)
{
forewing_l_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "forewing_l");
forewing_r_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "forewing_r");
hindwing_l_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "hindwing_l");
hindwing_r_to_body = rest_pose.get_absolute_transform(*bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "hindwing_r");
forewing_l_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "forewing_l");
forewing_r_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "forewing_r");
hindwing_l_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "hindwing_l");
hindwing_r_to_body = rest_pose.get_absolute_transform(bones.mesosoma) * get_bone_transform(mesosoma_skeleton, "hindwing_r");
}
// Build legs vertex reskin map
const std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> legs_reskin_map
{
{*legs_skeleton.get_bone_index("procoxa_l"), {*bones.procoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("profemur_l"), {*bones.profemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protibia_l"), {*bones.protibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus1_l"), {*bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus2_l"), {*bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus3_l"), {*bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus4_l"), {*bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus5_l"), {*bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("procoxa_r"), {*bones.procoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("profemur_r"), {*bones.profemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protibia_r"), {*bones.protibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus1_r"), {*bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus2_r"), {*bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus3_r"), {*bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus4_r"), {*bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus5_r"), {*bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesocoxa_l"), {*bones.mesocoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesofemur_l"), {*bones.mesofemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotibia_l"), {*bones.mesotibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus1_l"), {*bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus2_l"), {*bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus3_l"), {*bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus4_l"), {*bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus5_l"), {*bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesocoxa_r"), {*bones.mesocoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesofemur_r"), {*bones.mesofemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotibia_r"), {*bones.mesotibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus1_r"), {*bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus2_r"), {*bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus3_r"), {*bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus4_r"), {*bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus5_r"), {*bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metacoxa_l"), {*bones.metacoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metafemur_l"), {*bones.metafemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatibia_l"), {*bones.metatibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus1_l"), {*bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus2_l"), {*bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus3_l"), {*bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus4_l"), {*bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus5_l"), {*bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metacoxa_r"), {*bones.metacoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metafemur_r"), {*bones.metafemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatibia_r"), {*bones.metatibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus1_r"), {*bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus2_r"), {*bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus3_r"), {*bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus4_r"), {*bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus5_r"), {*bones.metatarsus_r, &legs_to_body}}
{*legs_skeleton.get_bone_index("procoxa_l"), {bones.procoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("profemur_l"), {bones.profemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protibia_l"), {bones.protibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus1_l"), {bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus2_l"), {bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus3_l"), {bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus4_l"), {bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus5_l"), {bones.protarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("procoxa_r"), {bones.procoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("profemur_r"), {bones.profemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protibia_r"), {bones.protibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus1_r"), {bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus2_r"), {bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus3_r"), {bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus4_r"), {bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("protarsus5_r"), {bones.protarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesocoxa_l"), {bones.mesocoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesofemur_l"), {bones.mesofemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotibia_l"), {bones.mesotibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus1_l"), {bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus2_l"), {bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus3_l"), {bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus4_l"), {bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus5_l"), {bones.mesotarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesocoxa_r"), {bones.mesocoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesofemur_r"), {bones.mesofemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotibia_r"), {bones.mesotibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus1_r"), {bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus2_r"), {bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus3_r"), {bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus4_r"), {bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("mesotarsus5_r"), {bones.mesotarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metacoxa_l"), {bones.metacoxa_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metafemur_l"), {bones.metafemur_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatibia_l"), {bones.metatibia_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus1_l"), {bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus2_l"), {bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus3_l"), {bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus4_l"), {bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus5_l"), {bones.metatarsus_l, &legs_to_body}},
{*legs_skeleton.get_bone_index("metacoxa_r"), {bones.metacoxa_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metafemur_r"), {bones.metafemur_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatibia_r"), {bones.metatibia_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus1_r"), {bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus2_r"), {bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus3_r"), {bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus4_r"), {bones.metatarsus_r, &legs_to_body}},
{*legs_skeleton.get_bone_index("metatarsus5_r"), {bones.metatarsus_r, &legs_to_body}}
};
// Build head vertex reskin map
const std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> head_reskin_map
{
{*head_skeleton.get_bone_index("head"), {*bones.head, &head_to_body}}
{*head_skeleton.get_bone_index("head"), {bones.head, &head_to_body}}
};
// Build mandibles vertex reskin map
const std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> mandibles_reskin_map
{
{*mandibles_skeleton.get_bone_index("mandible_l"), {*bones.mandible_l, &mandible_l_to_body}},
{*mandibles_skeleton.get_bone_index("mandible_r"), {*bones.mandible_r, &mandible_r_to_body}}
{*mandibles_skeleton.get_bone_index("mandible_l"), {bones.mandible_l, &mandible_l_to_body}},
{*mandibles_skeleton.get_bone_index("mandible_r"), {bones.mandible_r, &mandible_r_to_body}}
};
// Build antennae vertex reskin map
std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> antennae_reskin_map
{
{*antennae_skeleton.get_bone_index("antennomere1_l"), {*bones.antennomere1_l, &antenna_l_to_body}},
{*antennae_skeleton.get_bone_index("antennomere2_l"), {*bones.antennomere2_l, &antenna_l_to_body}},
{*antennae_skeleton.get_bone_index("antennomere1_r"), {*bones.antennomere1_r, &antenna_r_to_body}},
{*antennae_skeleton.get_bone_index("antennomere2_r"), {*bones.antennomere2_r, &antenna_r_to_body}}
{*antennae_skeleton.get_bone_index("antennomere1_l"), {bones.antennomere1_l, &antenna_l_to_body}},
{*antennae_skeleton.get_bone_index("antennomere2_l"), {bones.antennomere2_l, &antenna_l_to_body}},
{*antennae_skeleton.get_bone_index("antennomere1_r"), {bones.antennomere1_r, &antenna_r_to_body}},
{*antennae_skeleton.get_bone_index("antennomere2_r"), {bones.antennomere2_r, &antenna_r_to_body}}
};
for (std::uint8_t i = 3; i <= phenome.antennae->total_antennomere_count; ++i)
{
@ -584,8 +584,8 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
const hash::fnv1a32_t antennomere_l_key = hash::fnv1a32<char>(antennomere_l_name);
const hash::fnv1a32_t antennomere_r_key = hash::fnv1a32<char>(antennomere_r_name);
antennae_reskin_map.emplace(*antennae_skeleton.get_bone_index(antennomere_l_key), std::tuple(*bones.antennomere2_l, &antenna_l_to_body));
antennae_reskin_map.emplace(*antennae_skeleton.get_bone_index(antennomere_r_key), std::tuple(*bones.antennomere2_r, &antenna_r_to_body));
antennae_reskin_map.emplace(*antennae_skeleton.get_bone_index(antennomere_l_key), std::tuple(bones.antennomere2_l, &antenna_l_to_body));
antennae_reskin_map.emplace(*antennae_skeleton.get_bone_index(antennomere_r_key), std::tuple(bones.antennomere2_r, &antenna_r_to_body));
}
// Build waist vertex reskin map
@ -602,7 +602,7 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
// Build gaster vertex reskin map
const std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> gaster_reskin_map
{
{*gaster_skeleton.get_bone_index("gaster"), {*bones.gaster, &gaster_to_body}}
{*gaster_skeleton.get_bone_index("gaster"), {bones.gaster, &gaster_to_body}}
};
// Build sting vertex reskin map
@ -616,23 +616,23 @@ std::unique_ptr ant_morphogenesis(const ant_phenome& phenome)
std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> eyes_reskin_map;
if (phenome.eyes->present)
{
eyes_reskin_map.emplace(*eyes_skeleton->get_bone_index("eye_l"), std::tuple(*bones.head, &eye_l_to_body));
eyes_reskin_map.emplace(*eyes_skeleton->get_bone_index("eye_r"), std::tuple(*bones.head, &eye_r_to_body));
eyes_reskin_map.emplace(*eyes_skeleton->get_bone_index("eye_l"), std::tuple(bones.head, &eye_l_to_body));
eyes_reskin_map.emplace(*eyes_skeleton->get_bone_index("eye_r"), std::tuple(bones.head, &eye_r_to_body));
}
// Build lateral ocelli vertex reskin map
std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> lateral_ocelli_reskin_map;
if (phenome.ocelli->lateral_ocelli_present)
{
lateral_ocelli_reskin_map.emplace(*lateral_ocelli_skeleton->get_bone_index("ocellus_l"), std::tuple(*bones.head, &ocellus_l_to_body));
lateral_ocelli_reskin_map.emplace(*lateral_ocelli_skeleton->get_bone_index("ocellus_r"), std::tuple(*bones.head, &ocellus_r_to_body));
lateral_ocelli_reskin_map.emplace(*lateral_ocelli_skeleton->get_bone_index("ocellus_l"), std::tuple(bones.head, &ocellus_l_to_body));
lateral_ocelli_reskin_map.emplace(*lateral_ocelli_skeleton->get_bone_index("ocellus_r"), std::tuple(bones.head, &ocellus_r_to_body));
}
// Build median ocellus vertex reskin map
std::unordered_map<bone_index_type, std::tuple<bone_index_type, const math::transform<float>*>> median_ocellus_reskin_map;
if (phenome.ocelli->median_ocellus_present)
{
median_ocellus_reskin_map.emplace(*median_ocellus_skeleton->get_bone_index("ocellus_m"), std::tuple(*bones.head, &ocellus_m_to_body));
median_ocellus_reskin_map.emplace(*median_ocellus_skeleton->get_bone_index("ocellus_m"), std::tuple(bones.head, &ocellus_m_to_body));
}
// Build wings vertex reskin maps

+ 145
- 145
src/game/ant/ant-skeleton.cpp View File

@ -57,45 +57,45 @@ void generate_ant_rest_pose(::skeleton& skeleton, const ant_bone_set& bones, con
const auto inverse_mesosoma_transform = math::inverse(mesosoma_transform);
// Build skeleton rest pose
skeleton.set_bone_transform(*bones.mesosoma, mesosoma_transform);
skeleton.set_bone_transform(*bones.procoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "procoxa_l"));
skeleton.set_bone_transform(*bones.profemur_l, get_bone_transform(legs_skeleton, "profemur_l"));
skeleton.set_bone_transform(*bones.protibia_l, get_bone_transform(legs_skeleton, "protibia_l"));
skeleton.set_bone_transform(*bones.protarsus_l, get_bone_transform(legs_skeleton, "protarsus1_l"));
skeleton.set_bone_transform(*bones.procoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "procoxa_r"));
skeleton.set_bone_transform(*bones.profemur_r, get_bone_transform(legs_skeleton, "profemur_r"));
skeleton.set_bone_transform(*bones.protibia_r, get_bone_transform(legs_skeleton, "protibia_r"));
skeleton.set_bone_transform(*bones.protarsus_r, get_bone_transform(legs_skeleton, "protarsus1_r"));
skeleton.set_bone_transform(*bones.mesocoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "mesocoxa_l"));
skeleton.set_bone_transform(*bones.mesofemur_l, get_bone_transform(legs_skeleton, "mesofemur_l"));
skeleton.set_bone_transform(*bones.mesotibia_l, get_bone_transform(legs_skeleton, "mesotibia_l"));
skeleton.set_bone_transform(*bones.mesotarsus_l, get_bone_transform(legs_skeleton, "mesotarsus1_l"));
skeleton.set_bone_transform(*bones.mesocoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "mesocoxa_r"));
skeleton.set_bone_transform(*bones.mesofemur_r, get_bone_transform(legs_skeleton, "mesofemur_r"));
skeleton.set_bone_transform(*bones.mesotibia_r, get_bone_transform(legs_skeleton, "mesotibia_r"));
skeleton.set_bone_transform(*bones.mesotarsus_r, get_bone_transform(legs_skeleton, "mesotarsus1_r"));
skeleton.set_bone_transform(*bones.metacoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "metacoxa_l"));
skeleton.set_bone_transform(*bones.metafemur_l, get_bone_transform(legs_skeleton, "metafemur_l"));
skeleton.set_bone_transform(*bones.metatibia_l, get_bone_transform(legs_skeleton, "metatibia_l"));
skeleton.set_bone_transform(*bones.metatarsus_l, get_bone_transform(legs_skeleton, "metatarsus1_l"));
skeleton.set_bone_transform(*bones.metacoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "metacoxa_r"));
skeleton.set_bone_transform(*bones.metafemur_r, get_bone_transform(legs_skeleton, "metafemur_r"));
skeleton.set_bone_transform(*bones.metatibia_r, get_bone_transform(legs_skeleton, "metatibia_r"));
skeleton.set_bone_transform(*bones.metatarsus_r, get_bone_transform(legs_skeleton, "metatarsus1_r"));
skeleton.set_bone_transform(*bones.head, head_socket_transform * head_transform);
skeleton.set_bone_transform(*bones.mandible_l, get_bone_transform(head_skeleton, "mandible_l") * get_bone_transform(mandibles_skeleton, "mandible_l"));
skeleton.set_bone_transform(*bones.mandible_r, get_bone_transform(head_skeleton, "mandible_r") * get_bone_transform(mandibles_skeleton, "mandible_r"));
skeleton.set_bone_transform(*bones.antennomere1_l, get_bone_transform(head_skeleton, "antenna_l") * get_bone_transform(antennae_skeleton, "antennomere1_l"));
skeleton.set_bone_transform(*bones.antennomere2_l, get_bone_transform(antennae_skeleton, "antennomere2_l"));
skeleton.set_bone_transform(*bones.antennomere1_r, get_bone_transform(head_skeleton, "antenna_r") * get_bone_transform(antennae_skeleton, "antennomere1_r"));
skeleton.set_bone_transform(*bones.antennomere2_r, get_bone_transform(antennae_skeleton, "antennomere2_r"));
skeleton.set_bone_transform(bones.mesosoma, mesosoma_transform);
skeleton.set_bone_transform(bones.procoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "procoxa_l"));
skeleton.set_bone_transform(bones.profemur_l, get_bone_transform(legs_skeleton, "profemur_l"));
skeleton.set_bone_transform(bones.protibia_l, get_bone_transform(legs_skeleton, "protibia_l"));
skeleton.set_bone_transform(bones.protarsus_l, get_bone_transform(legs_skeleton, "protarsus1_l"));
skeleton.set_bone_transform(bones.procoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "procoxa_r"));
skeleton.set_bone_transform(bones.profemur_r, get_bone_transform(legs_skeleton, "profemur_r"));
skeleton.set_bone_transform(bones.protibia_r, get_bone_transform(legs_skeleton, "protibia_r"));
skeleton.set_bone_transform(bones.protarsus_r, get_bone_transform(legs_skeleton, "protarsus1_r"));
skeleton.set_bone_transform(bones.mesocoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "mesocoxa_l"));
skeleton.set_bone_transform(bones.mesofemur_l, get_bone_transform(legs_skeleton, "mesofemur_l"));
skeleton.set_bone_transform(bones.mesotibia_l, get_bone_transform(legs_skeleton, "mesotibia_l"));
skeleton.set_bone_transform(bones.mesotarsus_l, get_bone_transform(legs_skeleton, "mesotarsus1_l"));
skeleton.set_bone_transform(bones.mesocoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "mesocoxa_r"));
skeleton.set_bone_transform(bones.mesofemur_r, get_bone_transform(legs_skeleton, "mesofemur_r"));
skeleton.set_bone_transform(bones.mesotibia_r, get_bone_transform(legs_skeleton, "mesotibia_r"));
skeleton.set_bone_transform(bones.mesotarsus_r, get_bone_transform(legs_skeleton, "mesotarsus1_r"));
skeleton.set_bone_transform(bones.metacoxa_l, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "metacoxa_l"));
skeleton.set_bone_transform(bones.metafemur_l, get_bone_transform(legs_skeleton, "metafemur_l"));
skeleton.set_bone_transform(bones.metatibia_l, get_bone_transform(legs_skeleton, "metatibia_l"));
skeleton.set_bone_transform(bones.metatarsus_l, get_bone_transform(legs_skeleton, "metatarsus1_l"));
skeleton.set_bone_transform(bones.metacoxa_r, inverse_mesosoma_transform * get_bone_transform(legs_skeleton, "metacoxa_r"));
skeleton.set_bone_transform(bones.metafemur_r, get_bone_transform(legs_skeleton, "metafemur_r"));
skeleton.set_bone_transform(bones.metatibia_r, get_bone_transform(legs_skeleton, "metatibia_r"));
skeleton.set_bone_transform(bones.metatarsus_r, get_bone_transform(legs_skeleton, "metatarsus1_r"));
skeleton.set_bone_transform(bones.head, head_socket_transform * head_transform);
skeleton.set_bone_transform(bones.mandible_l, get_bone_transform(head_skeleton, "mandible_l") * get_bone_transform(mandibles_skeleton, "mandible_l"));
skeleton.set_bone_transform(bones.mandible_r, get_bone_transform(head_skeleton, "mandible_r") * get_bone_transform(mandibles_skeleton, "mandible_r"));
skeleton.set_bone_transform(bones.antennomere1_l, get_bone_transform(head_skeleton, "antenna_l") * get_bone_transform(antennae_skeleton, "antennomere1_l"));
skeleton.set_bone_transform(bones.antennomere2_l, get_bone_transform(antennae_skeleton, "antennomere2_l"));
skeleton.set_bone_transform(bones.antennomere1_r, get_bone_transform(head_skeleton, "antenna_r") * get_bone_transform(antennae_skeleton, "antennomere1_r"));
skeleton.set_bone_transform(bones.antennomere2_r, get_bone_transform(antennae_skeleton, "antennomere2_r"));
if (bones.petiole)
{
@ -107,7 +107,7 @@ void generate_ant_rest_pose(::skeleton& skeleton, const ant_bone_set& bones, con
skeleton.set_bone_transform(*bones.postpetiole, get_bone_transform(waist_skeleton, "postpetiole"));
}
skeleton.set_bone_transform(*bones.gaster, get_bone_transform(waist_skeleton, "gaster") * get_bone_transform(gaster_skeleton, "gaster"));
skeleton.set_bone_transform(bones.gaster, get_bone_transform(waist_skeleton, "gaster") * get_bone_transform(gaster_skeleton, "gaster"));
if (bones.sting)
{
@ -165,14 +165,14 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
fold_protarsus_l.rotation = math::angle_axis(-protarsus_fold_angle, float3{1, 0, 0});
fold_protarsus_r.rotation = math::angle_axis(-protarsus_fold_angle, float3{1, 0, 0});
pupa_pose.set_relative_transform(*bones.procoxa_l, rest_pose.get_relative_transform(*bones.procoxa_l) * fold_procoxa_l);
pupa_pose.set_relative_transform(*bones.procoxa_r, rest_pose.get_relative_transform(*bones.procoxa_r) * fold_procoxa_r);
pupa_pose.set_relative_transform(*bones.profemur_l, rest_pose.get_relative_transform(*bones.profemur_l) * fold_profemur_l);
pupa_pose.set_relative_transform(*bones.profemur_r, rest_pose.get_relative_transform(*bones.profemur_r) * fold_profemur_r);
pupa_pose.set_relative_transform(*bones.protibia_l, rest_pose.get_relative_transform(*bones.protibia_l) * fold_protibia_l);
pupa_pose.set_relative_transform(*bones.protibia_r, rest_pose.get_relative_transform(*bones.protibia_r) * fold_protibia_r);
pupa_pose.set_relative_transform(*bones.protarsus_l, rest_pose.get_relative_transform(*bones.protarsus_l) * fold_protarsus_l);
pupa_pose.set_relative_transform(*bones.protarsus_r, rest_pose.get_relative_transform(*bones.protarsus_r) * fold_protarsus_r);
pupa_pose.set_relative_transform(bones.procoxa_l, rest_pose.get_relative_transform(bones.procoxa_l) * fold_procoxa_l);
pupa_pose.set_relative_transform(bones.procoxa_r, rest_pose.get_relative_transform(bones.procoxa_r) * fold_procoxa_r);
pupa_pose.set_relative_transform(bones.profemur_l, rest_pose.get_relative_transform(bones.profemur_l) * fold_profemur_l);
pupa_pose.set_relative_transform(bones.profemur_r, rest_pose.get_relative_transform(bones.profemur_r) * fold_profemur_r);
pupa_pose.set_relative_transform(bones.protibia_l, rest_pose.get_relative_transform(bones.protibia_l) * fold_protibia_l);
pupa_pose.set_relative_transform(bones.protibia_r, rest_pose.get_relative_transform(bones.protibia_r) * fold_protibia_r);
pupa_pose.set_relative_transform(bones.protarsus_l, rest_pose.get_relative_transform(bones.protarsus_l) * fold_protarsus_l);
pupa_pose.set_relative_transform(bones.protarsus_r, rest_pose.get_relative_transform(bones.protarsus_r) * fold_protarsus_r);
}
// Fold midlegs
@ -203,14 +203,14 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
fold_mesotarsus_l.rotation = math::angle_axis(-mesotarsus_fold_angle, float3{1, 0, 0});
fold_mesotarsus_r.rotation = math::angle_axis(-mesotarsus_fold_angle, float3{1, 0, 0});
pupa_pose.set_relative_transform(*bones.mesocoxa_l, rest_pose.get_relative_transform(*bones.mesocoxa_l) * fold_mesocoxa_l);
pupa_pose.set_relative_transform(*bones.mesocoxa_r, rest_pose.get_relative_transform(*bones.mesocoxa_r) * fold_mesocoxa_r);
pupa_pose.set_relative_transform(*bones.mesofemur_l, rest_pose.get_relative_transform(*bones.mesofemur_l) * fold_mesofemur_l);
pupa_pose.set_relative_transform(*bones.mesofemur_r, rest_pose.get_relative_transform(*bones.mesofemur_r) * fold_mesofemur_r);
pupa_pose.set_relative_transform(*bones.mesotibia_l, rest_pose.get_relative_transform(*bones.mesotibia_l) * fold_mesotibia_l);
pupa_pose.set_relative_transform(*bones.mesotibia_r, rest_pose.get_relative_transform(*bones.mesotibia_r) * fold_mesotibia_r);
pupa_pose.set_relative_transform(*bones.mesotarsus_l, rest_pose.get_relative_transform(*bones.mesotarsus_l) * fold_mesotarsus_l);
pupa_pose.set_relative_transform(*bones.mesotarsus_r, rest_pose.get_relative_transform(*bones.mesotarsus_r) * fold_mesotarsus_r);
pupa_pose.set_relative_transform(bones.mesocoxa_l, rest_pose.get_relative_transform(bones.mesocoxa_l) * fold_mesocoxa_l);
pupa_pose.set_relative_transform(bones.mesocoxa_r, rest_pose.get_relative_transform(bones.mesocoxa_r) * fold_mesocoxa_r);
pupa_pose.set_relative_transform(bones.mesofemur_l, rest_pose.get_relative_transform(bones.mesofemur_l) * fold_mesofemur_l);
pupa_pose.set_relative_transform(bones.mesofemur_r, rest_pose.get_relative_transform(bones.mesofemur_r) * fold_mesofemur_r);
pupa_pose.set_relative_transform(bones.mesotibia_l, rest_pose.get_relative_transform(bones.mesotibia_l) * fold_mesotibia_l);
pupa_pose.set_relative_transform(bones.mesotibia_r, rest_pose.get_relative_transform(bones.mesotibia_r) * fold_mesotibia_r);
pupa_pose.set_relative_transform(bones.mesotarsus_l, rest_pose.get_relative_transform(bones.mesotarsus_l) * fold_mesotarsus_l);
pupa_pose.set_relative_transform(bones.mesotarsus_r, rest_pose.get_relative_transform(bones.mesotarsus_r) * fold_mesotarsus_r);
}
// Fold hindlegs
@ -241,14 +241,14 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
fold_metatarsus_l.rotation = math::angle_axis(-metatarsus_fold_angle, float3{1, 0, 0});
fold_metatarsus_r.rotation = math::angle_axis(-metatarsus_fold_angle, float3{1, 0, 0});
pupa_pose.set_relative_transform(*bones.metacoxa_l, rest_pose.get_relative_transform(*bones.metacoxa_l) * fold_metacoxa_l);
pupa_pose.set_relative_transform(*bones.metacoxa_r, rest_pose.get_relative_transform(*bones.metacoxa_r) * fold_metacoxa_r);
pupa_pose.set_relative_transform(*bones.metafemur_l, rest_pose.get_relative_transform(*bones.metafemur_l) * fold_metafemur_l);
pupa_pose.set_relative_transform(*bones.metafemur_r, rest_pose.get_relative_transform(*bones.metafemur_r) * fold_metafemur_r);
pupa_pose.set_relative_transform(*bones.metatibia_l, rest_pose.get_relative_transform(*bones.metatibia_l) * fold_metatibia_l);
pupa_pose.set_relative_transform(*bones.metatibia_r, rest_pose.get_relative_transform(*bones.metatibia_r) * fold_metatibia_r);
pupa_pose.set_relative_transform(*bones.metatarsus_l, rest_pose.get_relative_transform(*bones.metatarsus_l) * fold_metatarsus_l);
pupa_pose.set_relative_transform(*bones.metatarsus_r, rest_pose.get_relative_transform(*bones.metatarsus_r) * fold_metatarsus_r);
pupa_pose.set_relative_transform(bones.metacoxa_l, rest_pose.get_relative_transform(bones.metacoxa_l) * fold_metacoxa_l);
pupa_pose.set_relative_transform(bones.metacoxa_r, rest_pose.get_relative_transform(bones.metacoxa_r) * fold_metacoxa_r);
pupa_pose.set_relative_transform(bones.metafemur_l, rest_pose.get_relative_transform(bones.metafemur_l) * fold_metafemur_l);
pupa_pose.set_relative_transform(bones.metafemur_r, rest_pose.get_relative_transform(bones.metafemur_r) * fold_metafemur_r);
pupa_pose.set_relative_transform(bones.metatibia_l, rest_pose.get_relative_transform(bones.metatibia_l) * fold_metatibia_l);
pupa_pose.set_relative_transform(bones.metatibia_r, rest_pose.get_relative_transform(bones.metatibia_r) * fold_metatibia_r);
pupa_pose.set_relative_transform(bones.metatarsus_l, rest_pose.get_relative_transform(bones.metatarsus_l) * fold_metatarsus_l);
pupa_pose.set_relative_transform(bones.metatarsus_r, rest_pose.get_relative_transform(bones.metatarsus_r) * fold_metatarsus_r);
}
// Fold head
@ -257,7 +257,7 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
auto fold_head = math::transform<float>::identity();
fold_head.rotation = math::angle_axis(-head_fold_angle, float3{1, 0, 0});
pupa_pose.set_relative_transform(*bones.head, rest_pose.get_relative_transform(*bones.head) * fold_head);
pupa_pose.set_relative_transform(bones.head, rest_pose.get_relative_transform(bones.head) * fold_head);
}
// Fold antennae
@ -276,10 +276,10 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
fold_antennomere2_l.rotation = math::angle_axis(antennomere2_fold_angle_y, float3{0, 1, 0}) * math::angle_axis(-antennomere2_fold_angle_x, float3{1, 0, 0});
fold_antennomere2_r.rotation = math::angle_axis(-antennomere2_fold_angle_y, float3{0, 1, 0}) * math::angle_axis(-antennomere2_fold_angle_x, float3{1, 0, 0});
pupa_pose.set_relative_transform(*bones.antennomere1_l, rest_pose.get_relative_transform(*bones.antennomere1_l) * fold_antennomere1_l);
pupa_pose.set_relative_transform(*bones.antennomere1_r, rest_pose.get_relative_transform(*bones.antennomere1_r) * fold_antennomere1_r);
pupa_pose.set_relative_transform(*bones.antennomere2_l, rest_pose.get_relative_transform(*bones.antennomere2_l) * fold_antennomere2_l);
pupa_pose.set_relative_transform(*bones.antennomere2_r, rest_pose.get_relative_transform(*bones.antennomere2_r) * fold_antennomere2_r);
pupa_pose.set_relative_transform(bones.antennomere1_l, rest_pose.get_relative_transform(bones.antennomere1_l) * fold_antennomere1_l);
pupa_pose.set_relative_transform(bones.antennomere1_r, rest_pose.get_relative_transform(bones.antennomere1_r) * fold_antennomere1_r);
pupa_pose.set_relative_transform(bones.antennomere2_l, rest_pose.get_relative_transform(bones.antennomere2_l) * fold_antennomere2_l);
pupa_pose.set_relative_transform(bones.antennomere2_r, rest_pose.get_relative_transform(bones.antennomere2_r) * fold_antennomere2_r);
}
// Fold waist + gaster
@ -306,7 +306,7 @@ void generate_ant_pupa_pose(skeleton& skeleton, const ant_bone_set& bones)
pupa_pose.set_relative_transform(*bones.postpetiole, rest_pose.get_relative_transform(*bones.postpetiole) * fold_postpetiole);
}
pupa_pose.set_relative_transform(*bones.gaster, rest_pose.get_relative_transform(*bones.gaster) * fold_gaster);
pupa_pose.set_relative_transform(bones.gaster, rest_pose.get_relative_transform(bones.gaster) * fold_gaster);
}
// Invert mesosoma
@ -390,42 +390,42 @@ void generate_ant_skeleton(skeleton& skeleton, ant_bone_set& bones, const ant_ph
skeleton.add_bones(bone_index + 1);
// Assign bone parents
skeleton.set_bone_parent(*bones.mesosoma, *bones.mesosoma);
skeleton.set_bone_parent(*bones.procoxa_l, *bones.mesosoma);
skeleton.set_bone_parent(*bones.profemur_l, *bones.procoxa_l);
skeleton.set_bone_parent(*bones.protibia_l, *bones.profemur_l);
skeleton.set_bone_parent(*bones.protarsus_l, *bones.protibia_l);
skeleton.set_bone_parent(*bones.procoxa_r, *bones.mesosoma);
skeleton.set_bone_parent(*bones.profemur_r, *bones.procoxa_r);
skeleton.set_bone_parent(*bones.protibia_r, *bones.profemur_r);
skeleton.set_bone_parent(*bones.protarsus_r, *bones.protibia_r);
skeleton.set_bone_parent(*bones.mesocoxa_l, *bones.mesosoma);
skeleton.set_bone_parent(*bones.mesofemur_l, *bones.mesocoxa_l);
skeleton.set_bone_parent(*bones.mesotibia_l, *bones.mesofemur_l);
skeleton.set_bone_parent(*bones.mesotarsus_l, *bones.mesotibia_l);
skeleton.set_bone_parent(*bones.mesocoxa_r, *bones.mesosoma);
skeleton.set_bone_parent(*bones.mesofemur_r, *bones.mesocoxa_r);
skeleton.set_bone_parent(*bones.mesotibia_r, *bones.mesofemur_r);
skeleton.set_bone_parent(*bones.mesotarsus_r, *bones.mesotibia_r);
skeleton.set_bone_parent(*bones.metacoxa_l, *bones.mesosoma);
skeleton.set_bone_parent(*bones.metafemur_l, *bones.metacoxa_l);
skeleton.set_bone_parent(*bones.metatibia_l, *bones.metafemur_l);
skeleton.set_bone_parent(*bones.metatarsus_l, *bones.metatibia_l);
skeleton.set_bone_parent(*bones.metacoxa_r, *bones.mesosoma);
skeleton.set_bone_parent(*bones.metafemur_r, *bones.metacoxa_r);
skeleton.set_bone_parent(*bones.metatibia_r, *bones.metafemur_r);
skeleton.set_bone_parent(*bones.metatarsus_r, *bones.metatibia_r);
skeleton.set_bone_parent(*bones.head, *bones.mesosoma);
skeleton.set_bone_parent(*bones.mandible_l, *bones.head);
skeleton.set_bone_parent(*bones.mandible_r, *bones.head);
skeleton.set_bone_parent(*bones.antennomere1_l, *bones.head);
skeleton.set_bone_parent(*bones.antennomere2_l, *bones.antennomere1_l);
skeleton.set_bone_parent(*bones.antennomere1_r, *bones.head);
skeleton.set_bone_parent(*bones.antennomere2_r, *bones.antennomere1_r);
skeleton.set_bone_parent(bones.mesosoma, bones.mesosoma);
skeleton.set_bone_parent(bones.procoxa_l, bones.mesosoma);
skeleton.set_bone_parent(bones.profemur_l, bones.procoxa_l);
skeleton.set_bone_parent(bones.protibia_l, bones.profemur_l);
skeleton.set_bone_parent(bones.protarsus_l, bones.protibia_l);
skeleton.set_bone_parent(bones.procoxa_r, bones.mesosoma);
skeleton.set_bone_parent(bones.profemur_r, bones.procoxa_r);
skeleton.set_bone_parent(bones.protibia_r, bones.profemur_r);
skeleton.set_bone_parent(bones.protarsus_r, bones.protibia_r);
skeleton.set_bone_parent(bones.mesocoxa_l, bones.mesosoma);
skeleton.set_bone_parent(bones.mesofemur_l, bones.mesocoxa_l);
skeleton.set_bone_parent(bones.mesotibia_l, bones.mesofemur_l);
skeleton.set_bone_parent(bones.mesotarsus_l, bones.mesotibia_l);
skeleton.set_bone_parent(bones.mesocoxa_r, bones.mesosoma);
skeleton.set_bone_parent(bones.mesofemur_r, bones.mesocoxa_r);
skeleton.set_bone_parent(bones.mesotibia_r, bones.mesofemur_r);
skeleton.set_bone_parent(bones.mesotarsus_r, bones.mesotibia_r);
skeleton.set_bone_parent(bones.metacoxa_l, bones.mesosoma);
skeleton.set_bone_parent(bones.metafemur_l, bones.metacoxa_l);
skeleton.set_bone_parent(bones.metatibia_l, bones.metafemur_l);
skeleton.set_bone_parent(bones.metatarsus_l, bones.metatibia_l);
skeleton.set_bone_parent(bones.metacoxa_r, bones.mesosoma);
skeleton.set_bone_parent(bones.metafemur_r, bones.metacoxa_r);
skeleton.set_bone_parent(bones.metatibia_r, bones.metafemur_r);
skeleton.set_bone_parent(bones.metatarsus_r, bones.metatibia_r);
skeleton.set_bone_parent(bones.head, bones.mesosoma);
skeleton.set_bone_parent(bones.mandible_l, bones.head);
skeleton.set_bone_parent(bones.mandible_r, bones.head);
skeleton.set_bone_parent(bones.antennomere1_l, bones.head);
skeleton.set_bone_parent(bones.antennomere2_l, bones.antennomere1_l);
skeleton.set_bone_parent(bones.antennomere1_r, bones.head);
skeleton.set_bone_parent(bones.antennomere2_r, bones.antennomere1_r);
if (bones.petiole)
{
skeleton.set_bone_parent(*bones.petiole, *bones.mesosoma);
skeleton.set_bone_parent(*bones.petiole, bones.mesosoma);
}
if (bones.postpetiole)
{
@ -435,72 +435,72 @@ void generate_ant_skeleton(skeleton& skeleton, ant_bone_set& bones, const ant_ph
}
else
{
skeleton.set_bone_parent(*bones.postpetiole, *bones.mesosoma);
skeleton.set_bone_parent(*bones.postpetiole, bones.mesosoma);
}
}
if (bones.postpetiole)
{
skeleton.set_bone_parent(*bones.gaster, *bones.postpetiole);
skeleton.set_bone_parent(bones.gaster, *bones.postpetiole);
}
else
{
if (bones.petiole)
{
skeleton.set_bone_parent(*bones.gaster, *bones.petiole);
skeleton.set_bone_parent(bones.gaster, *bones.petiole);
}
else
{
skeleton.set_bone_parent(*bones.gaster, *bones.mesosoma);
skeleton.set_bone_parent(bones.gaster, bones.mesosoma);
}
}
if (bones.sting)
{
skeleton.set_bone_parent(*bones.sting, *bones.gaster);
skeleton.set_bone_parent(*bones.sting, bones.gaster);
}
if (bones.forewing_l)
{
skeleton.set_bone_parent(*bones.forewing_l, *bones.mesosoma);
skeleton.set_bone_parent(*bones.forewing_r, *bones.mesosoma);
skeleton.set_bone_parent(*bones.hindwing_l, *bones.mesosoma);
skeleton.set_bone_parent(*bones.hindwing_r, *bones.mesosoma);
skeleton.set_bone_parent(*bones.forewing_l, bones.mesosoma);
skeleton.set_bone_parent(*bones.forewing_r, bones.mesosoma);
skeleton.set_bone_parent(*bones.hindwing_l, bones.mesosoma);
skeleton.set_bone_parent(*bones.hindwing_r, bones.mesosoma);
}
// Assign bone names
skeleton.set_bone_name(*bones.mesosoma, "mesosoma");
skeleton.set_bone_name(*bones.procoxa_l, "procoxa_l");
skeleton.set_bone_name(*bones.profemur_l, "profemur_l");
skeleton.set_bone_name(*bones.protibia_l, "protibia_l");
skeleton.set_bone_name(*bones.protarsus_l, "protarsus_l");
skeleton.set_bone_name(*bones.procoxa_r, "procoxa_r");
skeleton.set_bone_name(*bones.profemur_r, "profemur_r");
skeleton.set_bone_name(*bones.protibia_r, "protibia_r");
skeleton.set_bone_name(*bones.protarsus_r, "protarsus_r");
skeleton.set_bone_name(*bones.mesocoxa_l, "mesocoxa_l");
skeleton.set_bone_name(*bones.mesofemur_l, "mesofemur_l");
skeleton.set_bone_name(*bones.mesotibia_l, "mesotibia_l");
skeleton.set_bone_name(*bones.mesotarsus_l, "mesotarsus_l");
skeleton.set_bone_name(*bones.mesocoxa_r, "mesocoxa_r");
skeleton.set_bone_name(*bones.mesofemur_r, "mesofemur_r");
skeleton.set_bone_name(*bones.mesotibia_r, "mesotibia_r");
skeleton.set_bone_name(*bones.mesotarsus_r, "mesotarsus_r");
skeleton.set_bone_name(*bones.metacoxa_l, "metacoxa_l");
skeleton.set_bone_name(*bones.metafemur_l, "metafemur_l");
skeleton.set_bone_name(*bones.metatibia_l, "metatibia_l");
skeleton.set_bone_name(*bones.metatarsus_l, "metatarsus_l");
skeleton.set_bone_name(*bones.metacoxa_r, "metacoxa_r");
skeleton.set_bone_name(*bones.metafemur_r, "metafemur_r");
skeleton.set_bone_name(*bones.metatibia_r, "metatibia_r");
skeleton.set_bone_name(*bones.metatarsus_r, "metatarsus_r");
skeleton.set_bone_name(*bones.head, "head");
skeleton.set_bone_name(*bones.mandible_l, "mandible_l");
skeleton.set_bone_name(*bones.mandible_r, "mandible_r");
skeleton.set_bone_name(*bones.antennomere1_l, "antennomere1_l");
skeleton.set_bone_name(*bones.antennomere2_l, "antennomere2_l");
skeleton.set_bone_name(*bones.antennomere1_r, "antennomere1_r");
skeleton.set_bone_name(*bones.antennomere2_r, "antennomere2_r");
skeleton.set_bone_name(bones.mesosoma, "mesosoma");
skeleton.set_bone_name(bones.procoxa_l, "procoxa_l");
skeleton.set_bone_name(bones.profemur_l, "profemur_l");
skeleton.set_bone_name(bones.protibia_l, "protibia_l");
skeleton.set_bone_name(bones.protarsus_l, "protarsus_l");
skeleton.set_bone_name(bones.procoxa_r, "procoxa_r");
skeleton.set_bone_name(bones.profemur_r, "profemur_r");
skeleton.set_bone_name(bones.protibia_r, "protibia_r");
skeleton.set_bone_name(bones.protarsus_r, "protarsus_r");
skeleton.set_bone_name(bones.mesocoxa_l, "mesocoxa_l");
skeleton.set_bone_name(bones.mesofemur_l, "mesofemur_l");
skeleton.set_bone_name(bones.mesotibia_l, "mesotibia_l");
skeleton.set_bone_name(bones.mesotarsus_l, "mesotarsus_l");
skeleton.set_bone_name(bones.mesocoxa_r, "mesocoxa_r");
skeleton.set_bone_name(bones.mesofemur_r, "mesofemur_r");
skeleton.set_bone_name(bones.mesotibia_r, "mesotibia_r");
skeleton.set_bone_name(bones.mesotarsus_r, "mesotarsus_r");
skeleton.set_bone_name(bones.metacoxa_l, "metacoxa_l");
skeleton.set_bone_name(bones.metafemur_l, "metafemur_l");
skeleton.set_bone_name(bones.metatibia_l, "metatibia_l");
skeleton.set_bone_name(bones.metatarsus_l, "metatarsus_l");
skeleton.set_bone_name(bones.metacoxa_r, "metacoxa_r");
skeleton.set_bone_name(bones.metafemur_r, "metafemur_r");
skeleton.set_bone_name(bones.metatibia_r, "metatibia_r");
skeleton.set_bone_name(bones.metatarsus_r, "metatarsus_r");
skeleton.set_bone_name(bones.head, "head");
skeleton.set_bone_name(bones.mandible_l, "mandible_l");
skeleton.set_bone_name(bones.mandible_r, "mandible_r");
skeleton.set_bone_name(bones.antennomere1_l, "antennomere1_l");
skeleton.set_bone_name(bones.antennomere2_l, "antennomere2_l");
skeleton.set_bone_name(bones.antennomere1_r, "antennomere1_r");
skeleton.set_bone_name(bones.antennomere2_r, "antennomere2_r");
if (bones.petiole)
{
skeleton.set_bone_name(*bones.petiole, "petiole");
@ -509,7 +509,7 @@ void generate_ant_skeleton(skeleton& skeleton, ant_bone_set& bones, const ant_ph
{
skeleton.set_bone_name(*bones.postpetiole, "postpetiole");
}
skeleton.set_bone_name(*bones.gaster, "gaster");
skeleton.set_bone_name(bones.gaster, "gaster");
if (bones.sting)
{
skeleton.set_bone_name(*bones.sting, "sting");

Loading…
Cancel
Save