28 using namespace ::
ant;
32 phene.present =
false;
33 phene.model =
nullptr;
37 phene.ommatidia_count = 0;
40 if (
auto element = phene_element.find(
"present");
element != phene_element.end())
41 phene.present =
element->get<
bool>();
46 if (
auto element = phene_element.find(
"model");
element != phene_element.end())
50 if (
auto element = phene_element.find(
"length");
element != phene_element.end())
51 phene.length =
element->get<
float>();
54 if (
auto element = phene_element.find(
"width");
element != phene_element.end())
55 phene.width =
element->get<
float>();
58 if (
auto element = phene_element.find(
"height");
element != phene_element.end())
59 phene.height =
element->get<
float>();
62 if (
auto element = phene_element.find(
"ommatidia_count");
element != phene_element.end())
63 phene.ommatidia_count =
element->get<
int>();
74 auto eyes_element = data->find(
"eyes");
75 if (eyes_element == data->end())
76 throw std::runtime_error(
"Invalid eyes 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::eyes > eyes
Polyphenic eyes 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.