28 using namespace ::
ant;
32 phene.present =
false;
33 phene.forewings_model =
nullptr;
34 phene.hindwings_model =
nullptr;
35 phene.forewing_length = 0.0f;
36 phene.forewing_width = 0.0f;
37 phene.forewing_venation = 0.0f;
38 phene.hindwing_length = 0.0f;
39 phene.hindwing_width = 0.0f;
40 phene.hindwing_venation = 0.0f;
43 if (
auto element = phene_element.find(
"present");
element != phene_element.end())
44 phene.present =
element->get<
bool>();
49 if (
auto element = phene_element.find(
"forewings_model");
element != phene_element.end())
53 if (
auto element = phene_element.find(
"hindwings_model");
element != phene_element.end())
57 if (
auto element = phene_element.find(
"forewing_length");
element != phene_element.end())
58 phene.forewing_length =
element->get<
float>();
61 if (
auto element = phene_element.find(
"forewing_width");
element != phene_element.end())
62 phene.forewing_width =
element->get<
float>();
65 if (
auto element = phene_element.find(
"forewing_venation");
element != phene_element.end())
66 phene.forewing_venation =
element->get<
float>();
69 if (
auto element = phene_element.find(
"hindwing_length");
element != phene_element.end())
70 phene.hindwing_length =
element->get<
float>();
73 if (
auto element = phene_element.find(
"hindwing_width");
element != phene_element.end())
74 phene.hindwing_width =
element->get<
float>();
77 if (
auto element = phene_element.find(
"hindwing_venation");
element != phene_element.end())
78 phene.hindwing_venation =
element->get<
float>();
89 auto wings_element = data->find(
"wings");
90 if (wings_element == data->end())
91 throw std::runtime_error(
"Invalid wings gene.");
static T * load(resource_manager *resourceManager, PHYSFS_File *file, const std::filesystem::path &path)
Loads resource data.
T * load(const std::filesystem::path &path)
Loads the requested resource.
nlohmann::json json
JSON data.
polyphenic_gene< phene::wings > wings
Polyphenic wings gene.
void deserialize_gene(monophenic_gene< T > &gene, void(*deserialize_phene)(T &, const json &, resource_manager *), const json &gene_element, resource_manager *resource_manager)
Deserializes a gene.