19using namespace helios;
21float PlantArchitecture::getParameterValue(
const std::map<std::string, float> &build_parameters,
const std::string ¶meter_name,
float default_value,
float min_value,
float max_value,
const std::string ¶meter_description)
const {
24 auto it = build_parameters.find(parameter_name);
25 if (it == build_parameters.end()) {
30 float value = it->second;
33 if (value < min_value || value > max_value) {
34 helios_runtime_error(
"ERROR (PlantArchitecture::getParameterValue): build parameter '" + parameter_name +
"' (" + parameter_description +
") has value " + std::to_string(value) +
" which is outside the valid range [" +
35 std::to_string(min_value) +
", " + std::to_string(max_value) +
"].");
41void PlantArchitecture::initializePlantModelRegistrations() {
43 registerPlantModel(
"almond", [
this]() { initializeAlmondTreeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAlmondTree(pos); },
"tree");
45 registerPlantModel(
"almond_aldrich", [
this]() { initializeAlmondTreeAldrichShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAlmondTreeAldrich(pos); },
"tree");
47 registerPlantModel(
"almond_wood_colony", [
this]() { initializeAlmondTreeWoodColonyShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAlmondTreeWoodColony(pos); },
"tree");
49 registerPlantModel(
"apple", [
this]() { initializeAppleTreeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAppleTree(pos); },
"tree");
51 registerPlantModel(
"apple_fruitingwall", [
this]() { initializeAppleFruitingWallShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAppleFruitingWall(pos); },
"tree");
53 registerPlantModel(
"asparagus", [
this]() { initializeAsparagusShoots(); }, [
this](
const helios::vec3 &pos) {
return buildAsparagusPlant(pos); });
55 registerPlantModel(
"bindweed", [
this]() { initializeBindweedShoots(); }, [
this](
const helios::vec3 &pos) {
return buildBindweedPlant(pos); },
"weed");
57 registerPlantModel(
"bean", [
this]() { initializeBeanShoots(); }, [
this](
const helios::vec3 &pos) {
return buildBeanPlant(pos); });
59 registerPlantModel(
"bougainvillea", [
this]() { initializeBougainvilleaShoots(); }, [
this](
const helios::vec3 &pos) {
return buildBougainvilleaPlant(pos); });
61 registerPlantModel(
"capsicum", [
this]() { initializeCapsicumShoots(); }, [
this](
const helios::vec3 &pos) {
return buildCapsicumPlant(pos); });
63 registerPlantModel(
"cheeseweed", [
this]() { initializeCheeseweedShoots(); }, [
this](
const helios::vec3 &pos) {
return buildCheeseweedPlant(pos); },
"weed");
65 registerPlantModel(
"cowpea", [
this]() { initializeCowpeaShoots(); }, [
this](
const helios::vec3 &pos) {
return buildCowpeaPlant(pos); });
67 registerPlantModel(
"grapevine_VSP", [
this]() { initializeGrapevineVSPShoots(); }, [
this](
const helios::vec3 &pos) {
return buildGrapevineVSP(pos); });
69 registerPlantModel(
"grapevine_Wye", [
this]() { initializeGrapevineWyeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildGrapevineWye(pos); });
71 registerPlantModel(
"groundcherryweed", [
this]() { initializeGroundCherryWeedShoots(); }, [
this](
const helios::vec3 &pos) {
return buildGroundCherryWeedPlant(pos); },
"weed");
73 registerPlantModel(
"maize", [
this]() { initializeMaizeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildMaizePlant(pos); });
75 registerPlantModel(
"olive", [
this]() { initializeOliveTreeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildOliveTree(pos); },
"tree");
77 registerPlantModel(
"pistachio", [
this]() { initializePistachioTreeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildPistachioTree(pos); },
"tree");
79 registerPlantModel(
"puncturevine", [
this]() { initializePuncturevineShoots(); }, [
this](
const helios::vec3 &pos) {
return buildPuncturevinePlant(pos); },
"weed");
81 registerPlantModel(
"easternredbud", [
this]() { initializeEasternRedbudShoots(); }, [
this](
const helios::vec3 &pos) {
return buildEasternRedbudPlant(pos); },
"tree");
83 registerPlantModel(
"rice", [
this]() { initializeRiceShoots(); }, [
this](
const helios::vec3 &pos) {
return buildRicePlant(pos); });
85 registerPlantModel(
"butterlettuce", [
this]() { initializeButterLettuceShoots(); }, [
this](
const helios::vec3 &pos) {
return buildButterLettucePlant(pos); });
87 registerPlantModel(
"sorghum", [
this]() { initializeSorghumShoots(); }, [
this](
const helios::vec3 &pos) {
return buildSorghumPlant(pos); });
89 registerPlantModel(
"soybean", [
this]() { initializeSoybeanShoots(); }, [
this](
const helios::vec3 &pos) {
return buildSoybeanPlant(pos); });
91 registerPlantModel(
"strawberry", [
this]() { initializeStrawberryShoots(); }, [
this](
const helios::vec3 &pos) {
return buildStrawberryPlant(pos); });
93 registerPlantModel(
"sugarbeet", [
this]() { initializeSugarbeetShoots(); }, [
this](
const helios::vec3 &pos) {
return buildSugarbeetPlant(pos); });
95 registerPlantModel(
"tomato", [
this]() { initializeTomatoShoots(); }, [
this](
const helios::vec3 &pos) {
return buildTomatoPlant(pos); });
97 registerPlantModel(
"cherrytomato", [
this]() { initializeCherryTomatoShoots(); }, [
this](
const helios::vec3 &pos) {
return buildCherryTomatoPlant(pos); });
99 registerPlantModel(
"walnut", [
this]() { initializeWalnutTreeShoots(); }, [
this](
const helios::vec3 &pos) {
return buildWalnutTree(pos); },
"tree");
101 registerPlantModel(
"wheat", [
this]() { initializeWheatShoots(); }, [
this](
const helios::vec3 &pos) {
return buildWheatPlant(pos); });
106 current_plant_model = plant_label;
107 initializeDefaultShoots(plant_label);
111 std::vector<std::string> models;
112 models.reserve(shoot_initializers.size());
113 for (
const auto &pair: shoot_initializers) {
114 models.push_back(pair.first);
121 if (current_plant_model.empty()) {
122 helios_runtime_error(
"ERROR (PlantArchitecture::buildPlantInstanceFromLibrary): current plant model has not been initialized from library. You must call loadPlantModelFromLibrary() first.");
126 auto builder_it = plant_builders.find(current_plant_model);
127 if (builder_it == plant_builders.end()) {
128 helios_runtime_error(
"ERROR (PlantArchitecture::buildPlantInstanceFromLibrary): plant label of " + current_plant_model +
" does not exist in the library.");
132 current_build_parameters = build_parameters;
135 uint plantID = builder_it->second(base_position);
138 current_build_parameters.clear();
140 plant_instances.at(plantID).plant_name = current_plant_model;
146 if (current_plant_model !=
"custom") {
147 std::vector<std::string> material_labels = context_ptr->
listMaterials();
148 std::string old_prefix =
"custom_";
149 for (
const auto &label: material_labels) {
150 if (label.substr(0, old_prefix.size()) == old_prefix) {
151 std::string new_label = current_plant_model +
"_" + label.substr(old_prefix.size());
160 if (output_object_data.at(
"plant_name")) {
162 for (
uint objID: plant_primitives) {
164 context_ptr->
setObjectData(objID,
"plant_name", current_plant_model);
170 if (output_object_data.at(
"plant_type")) {
171 std::string plant_type =
"herbaceous";
172 auto type_it = plant_type_map.find(current_plant_model);
173 if (type_it != plant_type_map.end()) {
174 plant_type = type_it->second;
177 context_ptr->
setObjectData(plant_primitives,
"plant_type", plant_type);
181 if (collision_detection_enabled && collision_detection_ptr !=
nullptr && collision_detection_ptr->
isTreeBasedBVHEnabled()) {
183 if (!plant_primitives.empty()) {
184 collision_detection_ptr->
registerTree(plantID, plant_primitives);
197 if (shoot_types.find(shoot_type_label) == shoot_types.end()) {
198 helios_runtime_error(
"ERROR (PlantArchitecture::getCurrentShootParameters): shoot type label of " + shoot_type_label +
" does not exist in the current shoot parameters.");
201 return shoot_types.at(shoot_type_label);
205 if (shoot_types.empty()) {
207 <<
"WARNING (PlantArchitecture::getCurrentShootParameters): No plant models have been loaded. You need to first load a plant model from the library (see loadPlantModelFromLibrary()) or manually add shoot parameters (see updateCurrentShootParameters())."
214 if (shoot_types.empty()) {
216 <<
"WARNING (PlantArchitecture::getCurrentPhytomerParameters): No plant models have been loaded. You need to first load a plant model from the library (see loadPlantModelFromLibrary()) or manually add shoot parameters (see updateCurrentShootParameters())."
219 std::map<std::string, PhytomerParameters> phytomer_parameters;
220 for (
const auto &type: shoot_types) {
221 phytomer_parameters[type.first] = type.second.phytomer_parameters;
223 return phytomer_parameters;
227 if (shoot_types.empty()) {
229 "ERROR (PlantArchitecture::listShootTypeLabels): No plant model has been loaded. You must call loadPlantModelFromLibrary() first, or use listShootTypeLabels(plant_model_name) to query a specific model, or use listShootTypeLabels(plantID) to query a plant instance.");
232 std::vector<std::string> labels;
233 labels.reserve(shoot_types.size());
235 for (
const auto &pair: shoot_types) {
236 labels.push_back(pair.first);
244 auto init_it = shoot_initializers.find(plant_model_name);
245 if (init_it == shoot_initializers.end()) {
246 helios_runtime_error(
"ERROR (PlantArchitecture::listShootTypeLabels): plant model '" + plant_model_name +
"' does not exist in the library. Use getAvailablePlantModels() to see available plant models.");
250 std::string saved_plant_model = current_plant_model;
251 std::map<std::string, ShootParameters> saved_shoot_types = shoot_types;
255 initializeDefaultShoots(plant_model_name);
258 std::vector<std::string> labels;
259 labels.reserve(shoot_types.size());
260 for (
const auto &pair: shoot_types) {
261 labels.push_back(pair.first);
265 current_plant_model = saved_plant_model;
266 shoot_types = saved_shoot_types;
271 current_plant_model = saved_plant_model;
272 shoot_types = saved_shoot_types;
278 shoot_types[shoot_type_label] = params;
282 shoot_types = params;
285void PlantArchitecture::initializeDefaultShoots(
const std::string &plant_label) {
291 auto init_it = shoot_initializers.find(plant_label);
292 if (init_it == shoot_initializers.end()) {
293 helios_runtime_error(
"ERROR (PlantArchitecture::loadPlantModelFromLibrary): plant label of " + plant_label +
" does not exist in the library.");
300void PlantArchitecture::registerPlantModel(
const std::string &name, std::function<
void()> shoot_init, std::function<
uint(
const helios::vec3 &)> plant_build,
const std::string &plant_type) {
301 shoot_initializers[name] = shoot_init;
302 plant_builders[name] = plant_build;
303 plant_type_map[name] = plant_type;
306void PlantArchitecture::initializeAlmondTreeShoots() {
311 leaf_prototype.leaf_texture_file[0] =
"AlmondLeaf.png";
312 leaf_prototype.leaf_aspect_ratio = 0.33f;
313 leaf_prototype.midrib_fold_fraction = 0.1f;
314 leaf_prototype.longitudinal_curvature = 0.05;
315 leaf_prototype.lateral_curvature = 0.1f;
316 leaf_prototype.subdivisions = 1;
317 leaf_prototype.unique_prototypes = 1;
323 phytomer_parameters_almond.internode.pitch = 3;
324 phytomer_parameters_almond.internode.phyllotactic_angle.uniformDistribution(120, 160);
325 phytomer_parameters_almond.internode.radius_initial = 0.002;
326 phytomer_parameters_almond.internode.length_segments = 1;
327 phytomer_parameters_almond.internode.image_texture =
"AlmondBark.jpg";
328 phytomer_parameters_almond.internode.max_floral_buds_per_petiole = 1;
330 phytomer_parameters_almond.petiole.petioles_per_internode = 1;
331 phytomer_parameters_almond.petiole.pitch.uniformDistribution(-145, -90);
332 phytomer_parameters_almond.petiole.taper = 0.1;
333 phytomer_parameters_almond.petiole.curvature = 0;
334 phytomer_parameters_almond.petiole.length = 0.04;
335 phytomer_parameters_almond.petiole.radius = 0.0005;
336 phytomer_parameters_almond.petiole.length_segments = 1;
337 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
338 phytomer_parameters_almond.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
340 phytomer_parameters_almond.leaf.leaves_per_petiole = 1;
341 phytomer_parameters_almond.leaf.roll.uniformDistribution(-10, 10);
342 phytomer_parameters_almond.leaf.prototype_scale = 0.12;
343 phytomer_parameters_almond.leaf.prototype = leaf_prototype;
345 phytomer_parameters_almond.peduncle.length = 0.002;
346 phytomer_parameters_almond.peduncle.radius = 0.0005;
347 phytomer_parameters_almond.peduncle.pitch = 80;
348 phytomer_parameters_almond.peduncle.roll = 90;
349 phytomer_parameters_almond.peduncle.length_segments = 1;
350 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
352 phytomer_parameters_almond.inflorescence.flowers_per_peduncle = 1;
353 phytomer_parameters_almond.inflorescence.pitch = 0;
354 phytomer_parameters_almond.inflorescence.roll = 0;
355 phytomer_parameters_almond.inflorescence.flower_prototype_scale = 0.04;
356 phytomer_parameters_almond.inflorescence.flower_prototype_function = AlmondFlowerPrototype;
357 phytomer_parameters_almond.inflorescence.fruit_prototype_scale = 0.04;
358 phytomer_parameters_almond.inflorescence.fruit_prototype_function = AlmondFruitPrototype;
364 shoot_parameters_trunk.phytomer_parameters = phytomer_parameters_almond;
365 shoot_parameters_trunk.phytomer_parameters.internode.pitch = 0;
366 shoot_parameters_trunk.phytomer_parameters.internode.phyllotactic_angle = 0;
367 shoot_parameters_trunk.phytomer_parameters.internode.radius_initial = 0.005;
368 shoot_parameters_trunk.phytomer_parameters.internode.radial_subdivisions = 24;
369 shoot_parameters_trunk.max_nodes = 20;
370 shoot_parameters_trunk.girth_area_factor = 10.f;
371 shoot_parameters_trunk.vegetative_bud_break_probability_min = 0;
372 shoot_parameters_trunk.vegetative_bud_break_time = 0;
373 shoot_parameters_trunk.tortuosity = 1;
374 shoot_parameters_trunk.internode_length_max = 0.04;
375 shoot_parameters_trunk.internode_length_decay_rate = 0;
376 shoot_parameters_trunk.defineChildShootTypes({
"scaffold"}, {1});
380 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_almond;
381 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
382 shoot_parameters_proleptic.phytomer_parameters.internode.radial_subdivisions = 5;
383 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = AlmondPhytomerCreationFunction;
384 shoot_parameters_proleptic.phytomer_parameters.phytomer_callback_function = AlmondPhytomerCallbackFunction;
385 shoot_parameters_proleptic.max_nodes = 60;
386 shoot_parameters_proleptic.max_nodes_per_season = 20;
387 shoot_parameters_proleptic.phyllochron_min = 1;
388 shoot_parameters_proleptic.elongation_rate_max = 0.3;
389 shoot_parameters_proleptic.girth_area_factor = 6.f;
390 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
391 shoot_parameters_proleptic.vegetative_bud_break_probability_max = 0.5;
392 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.15;
393 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
394 shoot_parameters_proleptic.gravitropic_curvature = 250;
395 shoot_parameters_proleptic.tortuosity = 3.5;
396 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(25, 30);
397 shoot_parameters_proleptic.insertion_angle_decay_rate = 15;
398 shoot_parameters_proleptic.internode_length_max = 0.03;
399 shoot_parameters_proleptic.internode_length_min = 0.002;
400 shoot_parameters_proleptic.internode_length_decay_rate = 0.002;
401 shoot_parameters_proleptic.fruit_set_probability = 0.4;
402 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
403 shoot_parameters_proleptic.max_terminal_floral_buds = 3;
404 shoot_parameters_proleptic.flowers_require_dormancy =
true;
405 shoot_parameters_proleptic.growth_requires_dormancy =
true;
406 shoot_parameters_proleptic.determinate_shoot_growth =
false;
407 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic",
"sylleptic"}, {1.0, 0.});
410 ShootParameters shoot_parameters_sylleptic = shoot_parameters_proleptic;
427 ShootParameters shoot_parameters_scaffold = shoot_parameters_proleptic;
430 shoot_parameters_scaffold.
max_nodes = 40;
444 if (shoot_types.empty()) {
446 initializeAlmondTreeShoots();
450 auto trunk_height = getParameterValue(current_build_parameters,
"trunk_height", 0.6f, 0.1f, 3.f,
"total trunk height in meters");
451 auto num_scaffolds =
uint(getParameterValue(current_build_parameters,
"num_scaffolds", 4.f, 2.f, 8.f,
"number of scaffold branches"));
452 auto scaffold_angle = getParameterValue(current_build_parameters,
"scaffold_angle", 40.f, 20.f, 70.f,
"scaffold branch angle in degrees");
455 float trunk_internode_length = 0.03f;
456 uint trunk_nodes =
uint(trunk_height / trunk_internode_length);
461 float trunk_radius = 0.015f;
462 float scaffold_radius = 0.007f;
463 float scaffold_length = 0.06f;
469 uint uID_trunk =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), 0.f * M_PI), trunk_radius, trunk_internode_length, 1.f, 1.f, 0,
"trunk");
470 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0.01, 0.01, 1, 1);
472 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
474 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
475 for (
const auto &phytomer: phytomers) {
476 phytomer->removeLeaf();
477 phytomer->setVegetativeBudState(BUD_DEAD);
478 phytomer->setFloralBudState(BUD_DEAD);
482 uint scaffold_nodes_min = 5;
483 uint scaffold_nodes_max = 5;
485 for (
int i = 0; i < num_scaffolds; i++) {
486 float pitch =
deg2rad(scaffold_angle) + context_ptr->
randu(-0.1f, 0.1f);
487 uint scaffold_nodes = context_ptr->
randu(
int(scaffold_nodes_min),
int(scaffold_nodes_max));
488 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, scaffold_nodes, make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(num_scaffolds) * 2 * M_PI, 0), scaffold_radius,
489 scaffold_length, 1.f, 1.f, 0.5,
"scaffold", 0);
495 plant_instances.at(plantID).max_age = 1825;
500void PlantArchitecture::initializeAlmondTreeAldrichShoots() {
505 leaf_prototype.leaf_texture_file[0] =
"AlmondLeaf.png";
506 leaf_prototype.leaf_aspect_ratio = 0.33f;
507 leaf_prototype.midrib_fold_fraction = 0.1f;
508 leaf_prototype.longitudinal_curvature = 0.05;
509 leaf_prototype.lateral_curvature = 0.1f;
510 leaf_prototype.subdivisions = 1;
511 leaf_prototype.unique_prototypes = 1;
517 phytomer_parameters_almond.internode.pitch = 3;
518 phytomer_parameters_almond.internode.phyllotactic_angle.uniformDistribution(120, 160);
519 phytomer_parameters_almond.internode.radius_initial = 0.002;
520 phytomer_parameters_almond.internode.length_segments = 1;
521 phytomer_parameters_almond.internode.image_texture =
"AlmondBark.jpg";
522 phytomer_parameters_almond.internode.max_floral_buds_per_petiole = 1;
524 phytomer_parameters_almond.petiole.petioles_per_internode = 1;
525 phytomer_parameters_almond.petiole.pitch.uniformDistribution(-145, -90);
526 phytomer_parameters_almond.petiole.taper = 0.1;
527 phytomer_parameters_almond.petiole.curvature = 0;
528 phytomer_parameters_almond.petiole.length = 0.04;
529 phytomer_parameters_almond.petiole.radius = 0.0005;
530 phytomer_parameters_almond.petiole.length_segments = 1;
531 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
532 phytomer_parameters_almond.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
534 phytomer_parameters_almond.leaf.leaves_per_petiole = 1;
535 phytomer_parameters_almond.leaf.roll.uniformDistribution(-10, 10);
536 phytomer_parameters_almond.leaf.prototype_scale = 0.12;
537 phytomer_parameters_almond.leaf.prototype = leaf_prototype;
539 phytomer_parameters_almond.peduncle.length = 0.002;
540 phytomer_parameters_almond.peduncle.radius = 0.0005;
541 phytomer_parameters_almond.peduncle.pitch = 80;
542 phytomer_parameters_almond.peduncle.roll = 90;
543 phytomer_parameters_almond.peduncle.length_segments = 1;
544 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
546 phytomer_parameters_almond.inflorescence.flowers_per_peduncle = 1;
547 phytomer_parameters_almond.inflorescence.pitch = 0;
548 phytomer_parameters_almond.inflorescence.roll = 0;
549 phytomer_parameters_almond.inflorescence.flower_prototype_scale = 0.04;
550 phytomer_parameters_almond.inflorescence.flower_prototype_function = AlmondFlowerPrototype;
551 phytomer_parameters_almond.inflorescence.fruit_prototype_scale = 0.04;
552 phytomer_parameters_almond.inflorescence.fruit_prototype_function = AlmondFruitPrototype;
558 shoot_parameters_trunk.phytomer_parameters = phytomer_parameters_almond;
559 shoot_parameters_trunk.phytomer_parameters.internode.pitch = 0;
560 shoot_parameters_trunk.phytomer_parameters.internode.phyllotactic_angle = 0;
561 shoot_parameters_trunk.phytomer_parameters.internode.radius_initial = 0.005;
562 shoot_parameters_trunk.phytomer_parameters.internode.radial_subdivisions = 24;
563 shoot_parameters_trunk.max_nodes = 20;
564 shoot_parameters_trunk.girth_area_factor = 8.f;
565 shoot_parameters_trunk.vegetative_bud_break_probability_min = 0;
566 shoot_parameters_trunk.vegetative_bud_break_time = 0;
567 shoot_parameters_trunk.tortuosity = .5;
568 shoot_parameters_trunk.internode_length_max = 0.05;
569 shoot_parameters_trunk.internode_length_decay_rate = 0;
570 shoot_parameters_trunk.defineChildShootTypes({
"scaffold"}, {1});
574 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_almond;
575 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
576 shoot_parameters_proleptic.phytomer_parameters.internode.radial_subdivisions = 5;
577 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = AlmondPhytomerCreationFunction;
578 shoot_parameters_proleptic.phytomer_parameters.phytomer_callback_function = AlmondPhytomerCallbackFunction;
579 shoot_parameters_proleptic.max_nodes = 25;
580 shoot_parameters_proleptic.max_nodes_per_season = 15;
581 shoot_parameters_proleptic.phyllochron_min = 1;
582 shoot_parameters_proleptic.elongation_rate_max = 0.3;
583 shoot_parameters_proleptic.girth_area_factor = 8.f;
584 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
585 shoot_parameters_proleptic.vegetative_bud_break_probability_max = 0.5;
586 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.15;
587 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
588 shoot_parameters_proleptic.gravitropic_curvature = 450;
589 shoot_parameters_proleptic.tortuosity = 2.5;
590 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(5, 30);
591 shoot_parameters_proleptic.insertion_angle_decay_rate = 5;
592 shoot_parameters_proleptic.internode_length_max = 0.025;
593 shoot_parameters_proleptic.internode_length_min = 0.002;
594 shoot_parameters_proleptic.internode_length_decay_rate = 0.002;
595 shoot_parameters_proleptic.fruit_set_probability = 0.4;
596 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
597 shoot_parameters_proleptic.max_terminal_floral_buds = 3;
598 shoot_parameters_proleptic.flowers_require_dormancy =
true;
599 shoot_parameters_proleptic.growth_requires_dormancy =
true;
600 shoot_parameters_proleptic.determinate_shoot_growth =
false;
601 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic",
"sylleptic"}, {1.0, 0.});
604 ShootParameters shoot_parameters_sylleptic = shoot_parameters_proleptic;
613 shoot_parameters_proleptic.vegetative_bud_break_probability_max = 0.6;
621 ShootParameters shoot_parameters_scaffold = shoot_parameters_proleptic;
624 shoot_parameters_scaffold.
max_nodes = 20;
636uint PlantArchitecture::buildAlmondTreeAldrich(
const helios::vec3 &base_position) {
638 if (shoot_types.empty()) {
640 initializeAlmondTreeShoots();
647 uint uID_trunk =
addBaseStemShoot(plantID, 19, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), 0.f * M_PI), 0.015, 0.03, 1.f, 1.f, 0,
"trunk");
648 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0.01, 0.01, 1, 1);
650 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
652 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
653 for (
const auto &phytomer: phytomers) {
654 phytomer->removeLeaf();
655 phytomer->setVegetativeBudState(BUD_DEAD);
656 phytomer->setFloralBudState(BUD_DEAD);
661 for (
int i = 0; i < Nscaffolds; i++) {
663 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, context_ptr->
randu(7, 9), make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(Nscaffolds) * 2 * M_PI, 0), 0.007, 0.06,
664 1.f, 1.f, 0.5,
"scaffold", 0);
670 plant_instances.at(plantID).max_age = 1825;
676void PlantArchitecture::initializeAlmondTreeWoodColonyShoots() {
681 leaf_prototype.leaf_texture_file[0] =
"AlmondLeaf.png";
682 leaf_prototype.leaf_aspect_ratio = 0.33f;
683 leaf_prototype.midrib_fold_fraction = 0.1f;
684 leaf_prototype.longitudinal_curvature = 0.05;
685 leaf_prototype.lateral_curvature = 0.1f;
686 leaf_prototype.subdivisions = 1;
687 leaf_prototype.unique_prototypes = 1;
693 phytomer_parameters_almond.internode.pitch = 3;
694 phytomer_parameters_almond.internode.phyllotactic_angle.uniformDistribution(120, 160);
695 phytomer_parameters_almond.internode.radius_initial = 0.002;
696 phytomer_parameters_almond.internode.length_segments = 1;
697 phytomer_parameters_almond.internode.image_texture =
"AlmondBark.jpg";
698 phytomer_parameters_almond.internode.max_floral_buds_per_petiole = 1;
700 phytomer_parameters_almond.petiole.petioles_per_internode = 1;
701 phytomer_parameters_almond.petiole.pitch.uniformDistribution(-145, -90);
702 phytomer_parameters_almond.petiole.taper = 0.1;
703 phytomer_parameters_almond.petiole.curvature = 0;
704 phytomer_parameters_almond.petiole.length = 0.04;
705 phytomer_parameters_almond.petiole.radius = 0.0005;
706 phytomer_parameters_almond.petiole.length_segments = 1;
707 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
708 phytomer_parameters_almond.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
710 phytomer_parameters_almond.leaf.leaves_per_petiole = 1;
711 phytomer_parameters_almond.leaf.roll.uniformDistribution(-10, 10);
712 phytomer_parameters_almond.leaf.prototype_scale = 0.12;
713 phytomer_parameters_almond.leaf.prototype = leaf_prototype;
715 phytomer_parameters_almond.peduncle.length = 0.002;
716 phytomer_parameters_almond.peduncle.radius = 0.0005;
717 phytomer_parameters_almond.peduncle.pitch = 80;
718 phytomer_parameters_almond.peduncle.roll = 90;
719 phytomer_parameters_almond.peduncle.length_segments = 1;
720 phytomer_parameters_almond.petiole.radial_subdivisions = 3;
722 phytomer_parameters_almond.inflorescence.flowers_per_peduncle = 1;
723 phytomer_parameters_almond.inflorescence.pitch = 0;
724 phytomer_parameters_almond.inflorescence.roll = 0;
725 phytomer_parameters_almond.inflorescence.flower_prototype_scale = 0.04;
726 phytomer_parameters_almond.inflorescence.flower_prototype_function = AlmondFlowerPrototype;
727 phytomer_parameters_almond.inflorescence.fruit_prototype_scale = 0.04;
728 phytomer_parameters_almond.inflorescence.fruit_prototype_function = AlmondFruitPrototype;
734 shoot_parameters_trunk.phytomer_parameters = phytomer_parameters_almond;
735 shoot_parameters_trunk.phytomer_parameters.internode.pitch = 0;
736 shoot_parameters_trunk.phytomer_parameters.internode.phyllotactic_angle = 0;
737 shoot_parameters_trunk.phytomer_parameters.internode.radius_initial = 0.005;
738 shoot_parameters_trunk.phytomer_parameters.internode.radial_subdivisions = 24;
739 shoot_parameters_trunk.max_nodes = 15;
740 shoot_parameters_trunk.girth_area_factor = 10.f;
741 shoot_parameters_trunk.vegetative_bud_break_probability_min = 0;
742 shoot_parameters_trunk.vegetative_bud_break_time = 0;
743 shoot_parameters_trunk.tortuosity = 1;
744 shoot_parameters_trunk.internode_length_max = 0.0325;
745 shoot_parameters_trunk.internode_length_decay_rate = 0;
746 shoot_parameters_trunk.defineChildShootTypes({
"scaffold"}, {1});
750 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_almond;
751 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
752 shoot_parameters_proleptic.phytomer_parameters.internode.radial_subdivisions = 5;
753 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = AlmondPhytomerCreationFunction;
754 shoot_parameters_proleptic.phytomer_parameters.phytomer_callback_function = AlmondPhytomerCallbackFunction;
755 shoot_parameters_proleptic.max_nodes = 20;
756 shoot_parameters_proleptic.max_nodes_per_season = 15;
757 shoot_parameters_proleptic.phyllochron_min = 1;
758 shoot_parameters_proleptic.elongation_rate_max = 0.3;
759 shoot_parameters_proleptic.girth_area_factor = 8.f;
760 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
761 shoot_parameters_proleptic.vegetative_bud_break_probability_max = 0.5;
762 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.15;
763 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
764 shoot_parameters_proleptic.gravitropic_curvature = 150;
765 shoot_parameters_proleptic.tortuosity = 3;
766 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(30, 75);
767 shoot_parameters_proleptic.insertion_angle_decay_rate = 17.5;
768 shoot_parameters_proleptic.internode_length_max = 0.02;
769 shoot_parameters_proleptic.internode_length_min = 0.002;
770 shoot_parameters_proleptic.internode_length_decay_rate = 0.002;
771 shoot_parameters_proleptic.fruit_set_probability = 0.4;
772 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
773 shoot_parameters_proleptic.max_terminal_floral_buds = 3;
774 shoot_parameters_proleptic.flowers_require_dormancy =
true;
775 shoot_parameters_proleptic.growth_requires_dormancy =
true;
776 shoot_parameters_proleptic.determinate_shoot_growth =
false;
777 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic",
"sylleptic"}, {1.0, 0.});
780 ShootParameters shoot_parameters_sylleptic = shoot_parameters_proleptic;
789 shoot_parameters_proleptic.vegetative_bud_break_probability_max = 0.6;
797 ShootParameters shoot_parameters_scaffold = shoot_parameters_proleptic;
800 shoot_parameters_scaffold.
max_nodes = 15;
812uint PlantArchitecture::buildAlmondTreeWoodColony(
const helios::vec3 &base_position) {
814 if (shoot_types.empty()) {
816 initializeAlmondTreeShoots();
823 uint uID_trunk =
addBaseStemShoot(plantID, 14, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), 0.f * M_PI), 0.015, 0.03, 1.f, 1.f, 0,
"trunk");
824 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0.01, 0.01, 1, 1);
826 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
828 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
829 for (
const auto &phytomer: phytomers) {
830 phytomer->removeLeaf();
831 phytomer->setVegetativeBudState(BUD_DEAD);
832 phytomer->setFloralBudState(BUD_DEAD);
837 for (
int i = 0; i < Nscaffolds; i++) {
839 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, context_ptr->
randu(7, 9), make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(Nscaffolds) * 2 * M_PI, 0), 0.007, 0.06,
840 1.f, 1.f, 0.5,
"scaffold", 0);
846 plant_instances.at(plantID).max_age = 1825;
851void PlantArchitecture::initializeAppleTreeShoots() {
856 leaf_prototype.leaf_texture_file[0] =
"AppleLeaf.png";
857 leaf_prototype.leaf_aspect_ratio = 0.6f;
858 leaf_prototype.midrib_fold_fraction = 0.4f;
859 leaf_prototype.longitudinal_curvature = -0.3f;
860 leaf_prototype.lateral_curvature = 0.1f;
861 leaf_prototype.subdivisions = 3;
862 leaf_prototype.unique_prototypes = 1;
868 phytomer_parameters_apple.internode.pitch = 0;
869 phytomer_parameters_apple.internode.phyllotactic_angle.uniformDistribution(130, 145);
870 phytomer_parameters_apple.internode.radius_initial = 0.004;
871 phytomer_parameters_apple.internode.length_segments = 1;
872 phytomer_parameters_apple.internode.image_texture =
"AppleBark.jpg";
873 phytomer_parameters_apple.internode.max_floral_buds_per_petiole = 1;
875 phytomer_parameters_apple.petiole.petioles_per_internode = 1;
876 phytomer_parameters_apple.petiole.pitch.uniformDistribution(-40, -25);
877 phytomer_parameters_apple.petiole.taper = 0.1;
878 phytomer_parameters_apple.petiole.curvature = 0;
879 phytomer_parameters_apple.petiole.length = 0.04;
880 phytomer_parameters_apple.petiole.radius = 0.00075;
881 phytomer_parameters_apple.petiole.length_segments = 1;
882 phytomer_parameters_apple.petiole.radial_subdivisions = 3;
883 phytomer_parameters_apple.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
885 phytomer_parameters_apple.leaf.leaves_per_petiole = 1;
886 phytomer_parameters_apple.leaf.prototype_scale = 0.12;
887 phytomer_parameters_apple.leaf.prototype = leaf_prototype;
889 phytomer_parameters_apple.peduncle.length = 0.04;
890 phytomer_parameters_apple.peduncle.radius = 0.001;
891 phytomer_parameters_apple.peduncle.pitch = 90;
892 phytomer_parameters_apple.peduncle.roll = 90;
893 phytomer_parameters_apple.peduncle.length_segments = 1;
895 phytomer_parameters_apple.inflorescence.flowers_per_peduncle = 1;
896 phytomer_parameters_apple.inflorescence.pitch = 0;
897 phytomer_parameters_apple.inflorescence.roll = 0;
898 phytomer_parameters_apple.inflorescence.flower_prototype_scale = 0.03;
899 phytomer_parameters_apple.inflorescence.flower_prototype_function = AppleFlowerPrototype;
900 phytomer_parameters_apple.inflorescence.fruit_prototype_scale = 0.1;
901 phytomer_parameters_apple.inflorescence.fruit_prototype_function = AppleFruitPrototype;
902 phytomer_parameters_apple.inflorescence.fruit_gravity_factor_fraction = 0.5;
908 shoot_parameters_trunk.phytomer_parameters = phytomer_parameters_apple;
909 shoot_parameters_trunk.phytomer_parameters.internode.phyllotactic_angle = 0;
910 shoot_parameters_trunk.phytomer_parameters.internode.radius_initial = 0.01;
911 shoot_parameters_trunk.phytomer_parameters.internode.radial_subdivisions = 24;
912 shoot_parameters_trunk.max_nodes = 20;
913 shoot_parameters_trunk.girth_area_factor = 5.f;
914 shoot_parameters_trunk.vegetative_bud_break_probability_min = 0;
915 shoot_parameters_trunk.vegetative_bud_break_time = 0;
916 shoot_parameters_trunk.tortuosity = 1;
917 shoot_parameters_trunk.internode_length_max = 0.05;
918 shoot_parameters_trunk.internode_length_decay_rate = 0;
919 shoot_parameters_trunk.defineChildShootTypes({
"proleptic"}, {1});
923 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_apple;
924 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
925 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = ApplePhytomerCreationFunction;
926 shoot_parameters_proleptic.max_nodes = 40;
927 shoot_parameters_proleptic.max_nodes_per_season = 20;
928 shoot_parameters_proleptic.phyllochron_min = 2.0;
929 shoot_parameters_proleptic.elongation_rate_max = 0.15;
930 shoot_parameters_proleptic.girth_area_factor = 7.f;
931 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
932 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.4;
933 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
934 shoot_parameters_proleptic.gravitropic_curvature.uniformDistribution(450, 500);
935 shoot_parameters_proleptic.tortuosity = 3;
936 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(30, 40);
937 shoot_parameters_proleptic.insertion_angle_decay_rate = 20;
938 shoot_parameters_proleptic.internode_length_max = 0.04;
939 shoot_parameters_proleptic.internode_length_min = 0.01;
940 shoot_parameters_proleptic.internode_length_decay_rate = 0.004;
941 shoot_parameters_proleptic.fruit_set_probability = 0.3;
942 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
943 shoot_parameters_proleptic.max_terminal_floral_buds = 1;
944 shoot_parameters_proleptic.flowers_require_dormancy =
true;
945 shoot_parameters_proleptic.growth_requires_dormancy =
true;
946 shoot_parameters_proleptic.determinate_shoot_growth =
false;
947 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic"}, {1.0});
955 if (shoot_types.empty()) {
957 initializeAppleTreeShoots();
961 auto trunk_height = getParameterValue(current_build_parameters,
"trunk_height", 0.8f, 0.1f, 3.f,
"total trunk height in meters");
962 auto num_scaffolds =
uint(getParameterValue(current_build_parameters,
"num_scaffolds", 4.f, 2.f, 8.f,
"number of scaffold branches"));
963 auto scaffold_angle = getParameterValue(current_build_parameters,
"scaffold_angle", 40.f, 20.f, 70.f,
"scaffold branch angle in degrees");
966 float trunk_internode_length = 0.04f;
967 uint trunk_nodes =
uint(trunk_height / trunk_internode_length);
972 float trunk_radius = 0.015f;
973 float scaffold_radius = 0.005f;
974 float scaffold_length = 0.04f;
978 uint uID_trunk =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), 0.f * M_PI), trunk_radius, trunk_internode_length, 1.f, 1.f, 0,
"trunk");
979 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0, 0.01, 1, 1);
981 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
983 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
984 for (
const auto &phytomer: phytomers) {
985 phytomer->removeLeaf();
986 phytomer->setVegetativeBudState(BUD_DEAD);
987 phytomer->setFloralBudState(BUD_DEAD);
991 uint scaffold_nodes_min = 7;
992 uint scaffold_nodes_max = 9;
994 for (
int i = 0; i < num_scaffolds; i++) {
995 float pitch =
deg2rad(scaffold_angle) + context_ptr->
randu(-0.1f, 0.1f);
996 uint scaffold_nodes = context_ptr->
randu(
int(scaffold_nodes_min),
int(scaffold_nodes_max));
997 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, scaffold_nodes, make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(num_scaffolds) * 2 * M_PI, 0), scaffold_radius,
998 scaffold_length, 1.f, 1.f, 0.5,
"proleptic", 0);
1004 plant_instances.at(plantID).max_age = 1460;
1009void PlantArchitecture::initializeAppleFruitingWallShoots() {
1014 leaf_prototype.leaf_texture_file[0] =
"AppleLeaf.png";
1015 leaf_prototype.leaf_aspect_ratio = 0.6f;
1016 leaf_prototype.midrib_fold_fraction = 0.4f;
1017 leaf_prototype.longitudinal_curvature = -0.3f;
1018 leaf_prototype.lateral_curvature = 0.1f;
1019 leaf_prototype.subdivisions = 3;
1020 leaf_prototype.unique_prototypes = 1;
1026 phytomer_parameters_apple.internode.pitch = 0;
1027 phytomer_parameters_apple.internode.phyllotactic_angle.uniformDistribution(130, 145);
1028 phytomer_parameters_apple.internode.radius_initial = 0.004;
1029 phytomer_parameters_apple.internode.length_segments = 1;
1030 phytomer_parameters_apple.internode.image_texture =
"AppleBark.jpg";
1031 phytomer_parameters_apple.internode.max_floral_buds_per_petiole = 1;
1033 phytomer_parameters_apple.petiole.petioles_per_internode = 1;
1034 phytomer_parameters_apple.petiole.pitch.uniformDistribution(-40, -25);
1035 phytomer_parameters_apple.petiole.taper = 0.1;
1036 phytomer_parameters_apple.petiole.curvature = 0;
1037 phytomer_parameters_apple.petiole.length = 0.04;
1038 phytomer_parameters_apple.petiole.radius = 0.00075;
1039 phytomer_parameters_apple.petiole.length_segments = 1;
1040 phytomer_parameters_apple.petiole.radial_subdivisions = 3;
1041 phytomer_parameters_apple.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
1043 phytomer_parameters_apple.leaf.leaves_per_petiole = 1;
1044 phytomer_parameters_apple.leaf.prototype_scale = 0.12;
1045 phytomer_parameters_apple.leaf.prototype = leaf_prototype;
1047 phytomer_parameters_apple.peduncle.length = 0.04;
1048 phytomer_parameters_apple.peduncle.radius = 0.001;
1049 phytomer_parameters_apple.peduncle.pitch = 90;
1050 phytomer_parameters_apple.peduncle.roll = 90;
1051 phytomer_parameters_apple.peduncle.length_segments = 1;
1053 phytomer_parameters_apple.inflorescence.flowers_per_peduncle = 1;
1054 phytomer_parameters_apple.inflorescence.pitch = 0;
1055 phytomer_parameters_apple.inflorescence.roll = 0;
1056 phytomer_parameters_apple.inflorescence.flower_prototype_scale = 0.03;
1057 phytomer_parameters_apple.inflorescence.flower_prototype_function = AppleFlowerPrototype;
1058 phytomer_parameters_apple.inflorescence.fruit_prototype_scale = 0.1;
1059 phytomer_parameters_apple.inflorescence.fruit_prototype_function = AppleFruitPrototype;
1060 phytomer_parameters_apple.inflorescence.fruit_gravity_factor_fraction = 0.5;
1066 shoot_parameters_trunk.phytomer_parameters = phytomer_parameters_apple;
1067 shoot_parameters_trunk.phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(175, 185);
1068 shoot_parameters_trunk.phytomer_parameters.internode.radius_initial = 0.01;
1069 shoot_parameters_trunk.phytomer_parameters.internode.radial_subdivisions = 24;
1070 shoot_parameters_trunk.max_nodes = 30;
1071 shoot_parameters_trunk.girth_area_factor = 5.f;
1072 shoot_parameters_trunk.vegetative_bud_break_probability_min = 0;
1073 shoot_parameters_trunk.vegetative_bud_break_time = 0;
1074 shoot_parameters_trunk.tortuosity = 0.5;
1075 shoot_parameters_trunk.internode_length_max = 0.05;
1076 shoot_parameters_trunk.internode_length_decay_rate = 0;
1077 shoot_parameters_trunk.defineChildShootTypes({
"lateral"}, {1});
1081 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_apple;
1082 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
1083 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = ApplePhytomerCreationFunction;
1084 shoot_parameters_proleptic.max_nodes = 20;
1085 shoot_parameters_proleptic.max_nodes_per_season = 20;
1086 shoot_parameters_proleptic.phyllochron_min = 2.0;
1087 shoot_parameters_proleptic.elongation_rate_max = 0.15;
1088 shoot_parameters_proleptic.girth_area_factor = 7.f;
1089 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
1090 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.4;
1091 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
1092 shoot_parameters_proleptic.gravitropic_curvature.uniformDistribution(550, 700);
1093 shoot_parameters_proleptic.tortuosity = 3;
1094 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(70, 110);
1095 shoot_parameters_proleptic.insertion_angle_decay_rate = 20;
1096 shoot_parameters_proleptic.internode_length_max = 0.04;
1097 shoot_parameters_proleptic.internode_length_min = 0.01;
1098 shoot_parameters_proleptic.internode_length_decay_rate = 0.004;
1099 shoot_parameters_proleptic.fruit_set_probability = 0.3;
1100 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
1101 shoot_parameters_proleptic.max_terminal_floral_buds = 1;
1102 shoot_parameters_proleptic.flowers_require_dormancy =
true;
1103 shoot_parameters_proleptic.growth_requires_dormancy =
true;
1104 shoot_parameters_proleptic.determinate_shoot_growth =
false;
1105 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic"}, {1.0});
1108 ShootParameters shoot_parameters_lateral = shoot_parameters_proleptic;
1117uint PlantArchitecture::buildAppleFruitingWall(
const helios::vec3 &base_position) {
1119 if (shoot_types.empty()) {
1121 initializeAppleFruitingWallShoots();
1124 std::vector<std::vector<vec3>> trellis_points;
1126 std::vector<float> wire_heights{0.75, 1.6, 2.25, 2.8};
1127 float tree_spacing = 1.2;
1129 trellis_points.reserve(wire_heights.size());
1130 for (
int i = 0; i < wire_heights.size(); i++) {
1131 trellis_points.push_back(
linspace(
make_vec3(0, -0.5f * tree_spacing, wire_heights.at(i)),
make_vec3(0, 0.5f * tree_spacing, wire_heights.at(i)), 8));
1135 for (
int j = 0; j < trellis_points.size(); j++) {
1136 for (
int i = 0; i < trellis_points[j].size(); i++) {
1137 trellis_points.at(j).at(i) += base_position;
1143 uint uID_leader =
addBaseStemShoot(plantID, std::ceil(wire_heights.back() / 0.1), make_AxisRotation(context_ptr->
randu(0, 0.05 * M_PI), 0, 0), shoot_types.at(
"trunk").phytomer_parameters.internode.radius_initial.val(), 0.09, 1, 1, 0.1,
"trunk");
1144 plant_instances.at(plantID).shoot_tree.at(uID_leader)->meristem_is_alive =
false;
1149 for (
int i = 0; i < 8; i++) {
1152 z = wire_heights.front() - 0.1;
1154 z = context_ptr->
randu(wire_heights.front() - 0.1, wire_heights.at(wire_heights.size() - 1));
1156 int node = std::round(z / 0.1) - 1;
1157 addChildShoot(plantID, uID_leader, node, 8, make_AxisRotation(context_ptr->
randu(
float(0.45f * M_PI), 0.52f * M_PI), context_ptr->
randu(0, 1) * M_PI, M_PI), 0.005, 0.05, 1, 1, 0.5,
"lateral");
1161 setPlantAttractionPoints(plantID,
flatten(trellis_points), 45.f, 1.f, 0.8);
1164 plant_instances.at(plantID).max_age = 730;
1169void PlantArchitecture::initializeAsparagusShoots() {
1175 phytomer_parameters.internode.pitch = 1;
1176 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(127.5, 147.5);
1177 phytomer_parameters.internode.radius_initial = 0.00025;
1178 phytomer_parameters.internode.max_floral_buds_per_petiole = 0;
1179 phytomer_parameters.internode.max_vegetative_buds_per_petiole = 1;
1180 phytomer_parameters.internode.color = RGB::forestgreen;
1181 phytomer_parameters.internode.length_segments = 2;
1183 phytomer_parameters.petiole.petioles_per_internode = 1;
1184 phytomer_parameters.petiole.pitch = 90;
1185 phytomer_parameters.petiole.radius = 0.0001;
1186 phytomer_parameters.petiole.length = 0.0005;
1187 phytomer_parameters.petiole.taper = 0.5;
1188 phytomer_parameters.petiole.curvature = 0;
1189 phytomer_parameters.petiole.color = phytomer_parameters.internode.color;
1190 phytomer_parameters.petiole.length_segments = 1;
1191 phytomer_parameters.petiole.radial_subdivisions = 5;
1193 phytomer_parameters.leaf.leaves_per_petiole = 5;
1194 phytomer_parameters.leaf.pitch.normalDistribution(-5, 30);
1195 phytomer_parameters.leaf.yaw = 30;
1196 phytomer_parameters.leaf.roll = 0;
1197 phytomer_parameters.leaf.leaflet_offset = 0;
1198 phytomer_parameters.leaf.leaflet_scale = 0.9;
1199 phytomer_parameters.leaf.prototype.prototype_function = AsparagusLeafPrototype;
1200 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.018, 0.02);
1203 phytomer_parameters.peduncle.length = 0.17;
1204 phytomer_parameters.peduncle.radius = 0.0015;
1205 phytomer_parameters.peduncle.pitch.uniformDistribution(0, 30);
1206 phytomer_parameters.peduncle.roll = 90;
1207 phytomer_parameters.peduncle.curvature.uniformDistribution(50, 250);
1208 phytomer_parameters.peduncle.length_segments = 6;
1209 phytomer_parameters.peduncle.radial_subdivisions = 6;
1211 phytomer_parameters.inflorescence.flowers_per_peduncle.uniformDistribution(1, 3);
1212 phytomer_parameters.inflorescence.flower_offset = 0.;
1213 phytomer_parameters.inflorescence.pitch.uniformDistribution(50, 70);
1214 phytomer_parameters.inflorescence.roll.uniformDistribution(-20, 20);
1215 phytomer_parameters.inflorescence.flower_prototype_scale = 0.015;
1216 phytomer_parameters.inflorescence.fruit_prototype_scale.uniformDistribution(0.02, 0.025);
1217 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction.uniformDistribution(0., 0.5);
1222 shoot_parameters.phytomer_parameters = phytomer_parameters;
1223 shoot_parameters.phytomer_parameters.phytomer_creation_function = AsparagusPhytomerCreationFunction;
1225 shoot_parameters.max_nodes = 20;
1226 shoot_parameters.insertion_angle_tip.uniformDistribution(40, 70);
1228 shoot_parameters.internode_length_max = 0.015;
1231 shoot_parameters.base_roll = 90;
1232 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
1233 shoot_parameters.gravitropic_curvature = -200;
1235 shoot_parameters.phyllochron_min = 1;
1236 shoot_parameters.elongation_rate_max = 0.15;
1238 shoot_parameters.girth_area_factor = 30;
1239 shoot_parameters.vegetative_bud_break_time = 5;
1240 shoot_parameters.vegetative_bud_break_probability_min = 0.25;
1243 shoot_parameters.fruit_set_probability = 0.;
1248 shoot_parameters.defineChildShootTypes({
"main"}, {1.0});
1253uint PlantArchitecture::buildAsparagusPlant(
const helios::vec3 &base_position) {
1255 if (shoot_types.empty()) {
1257 initializeAsparagusShoots();
1262 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(0, 0.f, 0.f), 0.0003, 0.015, 1, 0.1, 0.1,
"main");
1268 plant_instances.at(plantID).max_age = 20;
1273void PlantArchitecture::initializeBindweedShoots() {
1279 phytomer_parameters_bindweed.internode.pitch.uniformDistribution(0, 15);
1280 phytomer_parameters_bindweed.internode.phyllotactic_angle = 180.f;
1281 phytomer_parameters_bindweed.internode.radius_initial = 0.0012;
1282 phytomer_parameters_bindweed.internode.color =
make_RGBcolor(0.3, 0.38, 0.21);
1283 phytomer_parameters_bindweed.internode.length_segments = 1;
1285 phytomer_parameters_bindweed.petiole.petioles_per_internode = 1;
1286 phytomer_parameters_bindweed.petiole.pitch.uniformDistribution(80, 100);
1287 phytomer_parameters_bindweed.petiole.radius = 0.001;
1288 phytomer_parameters_bindweed.petiole.length = 0.006;
1289 phytomer_parameters_bindweed.petiole.taper = 0;
1290 phytomer_parameters_bindweed.petiole.curvature = 0;
1291 phytomer_parameters_bindweed.petiole.color = phytomer_parameters_bindweed.internode.color;
1292 phytomer_parameters_bindweed.petiole.length_segments = 1;
1294 phytomer_parameters_bindweed.leaf.leaves_per_petiole = 1;
1295 phytomer_parameters_bindweed.leaf.pitch.uniformDistribution(5, 30);
1296 phytomer_parameters_bindweed.leaf.yaw = 0;
1297 phytomer_parameters_bindweed.leaf.roll = 90;
1298 phytomer_parameters_bindweed.leaf.prototype_scale = 0.05;
1299 phytomer_parameters_bindweed.leaf.prototype.OBJ_model_file =
"BindweedLeaf.obj";
1301 phytomer_parameters_bindweed.peduncle.length = 0.01;
1302 phytomer_parameters_bindweed.peduncle.radius = 0.0005;
1303 phytomer_parameters_bindweed.peduncle.color = phytomer_parameters_bindweed.internode.color;
1305 phytomer_parameters_bindweed.inflorescence.flowers_per_peduncle = 1;
1306 phytomer_parameters_bindweed.inflorescence.pitch = -90.f;
1307 phytomer_parameters_bindweed.inflorescence.flower_prototype_function = BindweedFlowerPrototype;
1308 phytomer_parameters_bindweed.inflorescence.flower_prototype_scale = 0.045;
1313 shoot_parameters_primary.phytomer_parameters = phytomer_parameters_bindweed;
1314 shoot_parameters_primary.vegetative_bud_break_probability_min = 0.1;
1315 shoot_parameters_primary.vegetative_bud_break_probability_decay_rate = -1.;
1316 shoot_parameters_primary.vegetative_bud_break_time = 10;
1317 shoot_parameters_primary.base_roll = 90;
1318 shoot_parameters_primary.phyllochron_min = 1;
1319 shoot_parameters_primary.elongation_rate_max = 0.25;
1320 shoot_parameters_primary.girth_area_factor = 0;
1321 shoot_parameters_primary.internode_length_max = 0.03;
1322 shoot_parameters_primary.internode_length_decay_rate = 0;
1323 shoot_parameters_primary.insertion_angle_tip.uniformDistribution(50, 80);
1324 shoot_parameters_primary.flowers_require_dormancy =
false;
1325 shoot_parameters_primary.growth_requires_dormancy =
false;
1326 shoot_parameters_primary.flower_bud_break_probability = 0.2;
1327 shoot_parameters_primary.determinate_shoot_growth =
false;
1328 shoot_parameters_primary.max_nodes = 15;
1329 shoot_parameters_primary.gravitropic_curvature = 40;
1330 shoot_parameters_primary.tortuosity = 0;
1331 shoot_parameters_primary.defineChildShootTypes({
"secondary_bindweed"}, {1.f});
1352 shoot_parameters_base.
max_nodes.uniformDistribution(3, 5);
1356 shoot_parameters_children.
base_roll = 0;
1363uint PlantArchitecture::buildBindweedPlant(
const helios::vec3 &base_position) {
1365 if (shoot_types.empty()) {
1367 initializeBindweedShoots();
1372 uint uID_stem =
addBaseStemShoot(plantID, 3, make_AxisRotation(0, 0.f, 0.f), 0.001, 0.001, 1, 1, 0,
"base_bindweed");
1378 plant_instances.at(plantID).max_age = 50;
1383void PlantArchitecture::initializeBeanShoots() {
1388 leaf_prototype_trifoliate.leaf_texture_file[0] =
"BeanLeaf_tip.png";
1389 leaf_prototype_trifoliate.leaf_texture_file[-1] =
"BeanLeaf_left_centered.png";
1390 leaf_prototype_trifoliate.leaf_texture_file[1] =
"BeanLeaf_right_centered.png";
1391 leaf_prototype_trifoliate.leaf_aspect_ratio = 1.f;
1392 leaf_prototype_trifoliate.midrib_fold_fraction = 0.2;
1393 leaf_prototype_trifoliate.longitudinal_curvature.uniformDistribution(-0.3f, -0.2f);
1394 leaf_prototype_trifoliate.lateral_curvature = -1.f;
1395 leaf_prototype_trifoliate.subdivisions = 6;
1396 leaf_prototype_trifoliate.unique_prototypes = 5;
1397 leaf_prototype_trifoliate.build_petiolule =
true;
1399 LeafPrototype leaf_prototype_unifoliate = leaf_prototype_trifoliate;
1401 leaf_prototype_unifoliate.
leaf_texture_file[0] =
"BeanLeaf_unifoliate_centered.png";
1408 phytomer_parameters_trifoliate.internode.pitch = 20;
1409 phytomer_parameters_trifoliate.internode.phyllotactic_angle.uniformDistribution(145, 215);
1410 phytomer_parameters_trifoliate.internode.radius_initial = 0.001;
1411 phytomer_parameters_trifoliate.internode.max_floral_buds_per_petiole = 1;
1412 phytomer_parameters_trifoliate.internode.max_vegetative_buds_per_petiole = 1;
1413 phytomer_parameters_trifoliate.internode.color =
make_RGBcolor(0.2, 0.25, 0.05);
1414 phytomer_parameters_trifoliate.internode.length_segments = 2;
1416 phytomer_parameters_trifoliate.petiole.petioles_per_internode = 1;
1417 phytomer_parameters_trifoliate.petiole.pitch.uniformDistribution(20, 50);
1418 phytomer_parameters_trifoliate.petiole.radius = 0.0015;
1419 phytomer_parameters_trifoliate.petiole.length.uniformDistribution(0.1, 0.14);
1420 phytomer_parameters_trifoliate.petiole.taper = 0.;
1421 phytomer_parameters_trifoliate.petiole.curvature.uniformDistribution(-100, 200);
1422 phytomer_parameters_trifoliate.petiole.color =
make_RGBcolor(0.28, 0.35, 0.07);
1423 phytomer_parameters_trifoliate.petiole.length_segments = 5;
1424 phytomer_parameters_trifoliate.petiole.radial_subdivisions = 6;
1426 phytomer_parameters_trifoliate.leaf.leaves_per_petiole = 3;
1427 phytomer_parameters_trifoliate.leaf.pitch.normalDistribution(0, 20);
1428 phytomer_parameters_trifoliate.leaf.yaw = 10;
1429 phytomer_parameters_trifoliate.leaf.roll = -15;
1430 phytomer_parameters_trifoliate.leaf.leaflet_offset = 0.3;
1431 phytomer_parameters_trifoliate.leaf.leaflet_scale = 0.9;
1432 phytomer_parameters_trifoliate.leaf.prototype_scale.uniformDistribution(0.09, 0.11);
1433 phytomer_parameters_trifoliate.leaf.prototype = leaf_prototype_trifoliate;
1435 phytomer_parameters_trifoliate.peduncle.length = 0.04;
1436 phytomer_parameters_trifoliate.peduncle.radius = 0.00075;
1437 phytomer_parameters_trifoliate.peduncle.pitch.uniformDistribution(0, 40);
1438 phytomer_parameters_trifoliate.peduncle.roll = 90;
1439 phytomer_parameters_trifoliate.peduncle.curvature.uniformDistribution(-500, 500);
1440 phytomer_parameters_trifoliate.peduncle.color = phytomer_parameters_trifoliate.petiole.color;
1441 phytomer_parameters_trifoliate.peduncle.length_segments = 1;
1442 phytomer_parameters_trifoliate.peduncle.radial_subdivisions = 6;
1444 phytomer_parameters_trifoliate.inflorescence.flowers_per_peduncle.uniformDistribution(1, 4);
1445 phytomer_parameters_trifoliate.inflorescence.flower_offset = 0.2;
1446 phytomer_parameters_trifoliate.inflorescence.pitch.uniformDistribution(50, 70);
1447 phytomer_parameters_trifoliate.inflorescence.roll.uniformDistribution(-20, 20);
1448 phytomer_parameters_trifoliate.inflorescence.flower_prototype_scale = 0.03;
1449 phytomer_parameters_trifoliate.inflorescence.flower_prototype_function = BeanFlowerPrototype;
1450 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_scale.uniformDistribution(0.15, 0.2);
1451 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_function = BeanFruitPrototype;
1452 phytomer_parameters_trifoliate.inflorescence.fruit_gravity_factor_fraction.uniformDistribution(0.8, 1.0);
1455 phytomer_parameters_unifoliate.
internode.pitch = 0;
1456 phytomer_parameters_unifoliate.
internode.max_vegetative_buds_per_petiole = 1;
1457 phytomer_parameters_unifoliate.
internode.max_floral_buds_per_petiole = 0;
1458 phytomer_parameters_unifoliate.
petiole.petioles_per_internode = 2;
1459 phytomer_parameters_unifoliate.
petiole.length = 0.0001;
1460 phytomer_parameters_unifoliate.
petiole.radius = 0.0004;
1461 phytomer_parameters_unifoliate.
petiole.pitch.uniformDistribution(50, 70);
1462 phytomer_parameters_unifoliate.
leaf.leaves_per_petiole = 1;
1463 phytomer_parameters_unifoliate.
leaf.prototype_scale = 0.04;
1464 phytomer_parameters_unifoliate.
leaf.pitch.uniformDistribution(-10, 10);
1465 phytomer_parameters_unifoliate.
leaf.prototype = leaf_prototype_unifoliate;
1470 shoot_parameters_trifoliate.phytomer_parameters = phytomer_parameters_trifoliate;
1471 shoot_parameters_trifoliate.phytomer_parameters.phytomer_creation_function = BeanPhytomerCreationFunction;
1473 shoot_parameters_trifoliate.max_nodes = 25;
1474 shoot_parameters_trifoliate.insertion_angle_tip.uniformDistribution(40, 60);
1476 shoot_parameters_trifoliate.internode_length_max = 0.025;
1479 shoot_parameters_trifoliate.base_roll = 90;
1480 shoot_parameters_trifoliate.base_yaw.uniformDistribution(-20, 20);
1481 shoot_parameters_trifoliate.gravitropic_curvature = 200;
1483 shoot_parameters_trifoliate.phyllochron_min = 2;
1484 shoot_parameters_trifoliate.elongation_rate_max = 0.1;
1485 shoot_parameters_trifoliate.girth_area_factor = 1.5f;
1486 shoot_parameters_trifoliate.vegetative_bud_break_time = 15;
1487 shoot_parameters_trifoliate.vegetative_bud_break_probability_min = 0.1;
1488 shoot_parameters_trifoliate.vegetative_bud_break_probability_decay_rate = -0.4;
1490 shoot_parameters_trifoliate.flower_bud_break_probability.uniformDistribution(0.3, 0.4);
1491 shoot_parameters_trifoliate.fruit_set_probability = 0.4;
1496 shoot_parameters_trifoliate.defineChildShootTypes({
"trifoliate"}, {1.0});
1499 ShootParameters shoot_parameters_unifoliate = shoot_parameters_trifoliate;
1502 shoot_parameters_unifoliate.
max_nodes = 1;
1517 if (shoot_types.empty()) {
1519 initializeBeanShoots();
1524 AxisRotation base_rotation = make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
1525 uint uID_unifoliate =
addBaseStemShoot(plantID, 1, base_rotation, 0.0005, 0.03, 0.01, 0.01, 0,
"unifoliate");
1527 appendShoot(plantID, uID_unifoliate, 1, make_AxisRotation(0, 0, 0.5f * M_PI), shoot_types.at(
"trifoliate").phytomer_parameters.internode.radius_initial.val(), shoot_types.at(
"trifoliate").internode_length_max.val(), 0.1, 0.1, 0,
"trifoliate");
1533 plant_instances.at(plantID).max_age = 365;
1538void PlantArchitecture::initializeBougainvilleaShoots() {
1543 leaf_prototype.leaf_texture_file[0] =
"CapsicumLeaf.png";
1544 leaf_prototype.leaf_aspect_ratio = 0.8f;
1545 leaf_prototype.midrib_fold_fraction = 0.2f;
1546 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.15, -0.05f);
1547 leaf_prototype.lateral_curvature = -0.25f;
1548 leaf_prototype.wave_period = 0.35f;
1549 leaf_prototype.wave_amplitude = 0.1f;
1550 leaf_prototype.subdivisions = 7;
1551 leaf_prototype.unique_prototypes = 5;
1557 phytomer_parameters.internode.pitch = 10;
1558 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(160, 190);
1559 phytomer_parameters.internode.radius_initial = 0.001;
1560 phytomer_parameters.internode.color =
make_RGBcolor(0.213, 0.270, 0.056);
1561 phytomer_parameters.internode.length_segments = 1;
1563 phytomer_parameters.petiole.petioles_per_internode = 1;
1564 phytomer_parameters.petiole.pitch.uniformDistribution(-60, -40);
1565 phytomer_parameters.petiole.radius = 0.0001;
1566 phytomer_parameters.petiole.length = 0.0001;
1567 phytomer_parameters.petiole.taper = 1;
1568 phytomer_parameters.petiole.curvature = 0;
1569 phytomer_parameters.petiole.color = phytomer_parameters.internode.color;
1570 phytomer_parameters.petiole.length_segments = 1;
1572 phytomer_parameters.leaf.leaves_per_petiole = 1;
1573 phytomer_parameters.leaf.pitch = 0;
1574 phytomer_parameters.leaf.yaw = 10;
1575 phytomer_parameters.leaf.roll = 0;
1576 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.08, 0.12);
1577 phytomer_parameters.leaf.prototype = leaf_prototype;
1579 phytomer_parameters.peduncle.length = 0.15;
1580 phytomer_parameters.peduncle.radius = 0.0015;
1581 phytomer_parameters.peduncle.pitch.uniformDistribution(70, 90);
1582 phytomer_parameters.peduncle.roll.uniformDistribution(0, 180);
1583 phytomer_parameters.peduncle.curvature.uniformDistribution(-200, 200);
1584 phytomer_parameters.peduncle.color = phytomer_parameters.internode.color;
1585 phytomer_parameters.peduncle.length_segments = 3;
1586 phytomer_parameters.peduncle.radial_subdivisions = 6;
1588 phytomer_parameters.inflorescence.flowers_per_peduncle.uniformDistribution(4, 6);
1589 phytomer_parameters.inflorescence.pitch = 80;
1590 phytomer_parameters.inflorescence.roll.uniformDistribution(-180, 180);
1591 phytomer_parameters.inflorescence.flower_prototype_scale = 0.05;
1592 phytomer_parameters.inflorescence.flower_prototype_function = BougainvilleaFlowerPrototype;
1593 phytomer_parameters.inflorescence.unique_prototypes = 1;
1594 phytomer_parameters.inflorescence.flower_offset = 0.12;
1599 shoot_parameters.phytomer_parameters = phytomer_parameters;
1601 shoot_parameters.max_nodes = 60;
1602 shoot_parameters.insertion_angle_tip = 25;
1603 shoot_parameters.insertion_angle_decay_rate = 0;
1604 shoot_parameters.internode_length_max = 0.04;
1605 shoot_parameters.internode_length_min = 0.0;
1606 shoot_parameters.internode_length_decay_rate = 0;
1607 shoot_parameters.base_roll = 90;
1608 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
1609 shoot_parameters.gravitropic_curvature = 500;
1610 shoot_parameters.tortuosity = 3;
1612 shoot_parameters.phyllochron_min = 2.75;
1613 shoot_parameters.elongation_rate_max = 0.1;
1614 shoot_parameters.girth_area_factor = 1.f;
1615 shoot_parameters.vegetative_bud_break_time = 30;
1616 shoot_parameters.vegetative_bud_break_probability_min = 0.075;
1617 shoot_parameters.vegetative_bud_break_probability_decay_rate = 0.8;
1618 shoot_parameters.flower_bud_break_probability = 0.5;
1619 shoot_parameters.flowers_require_dormancy =
false;
1620 shoot_parameters.growth_requires_dormancy =
false;
1621 shoot_parameters.determinate_shoot_growth =
false;
1623 shoot_parameters.defineChildShootTypes({
"secondary"}, {1.0});
1628 shoot_parameters_secondary.
max_nodes = 15;
1633uint PlantArchitecture::buildBougainvilleaPlant(
const helios::vec3 &base_position) {
1635 if (shoot_types.empty()) {
1637 initializeBougainvilleaShoots();
1642 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
1643 uint uID_stem =
addBaseStemShoot(plantID, 3, base_rotation, 0.002, shoot_types.at(
"mainstem").internode_length_max.val(), 0.01, 0.01, 0,
"mainstem");
1653 plant_instances.at(plantID).max_age = 365;
1658void PlantArchitecture::initializeCapsicumShoots() {
1663 leaf_prototype.leaf_texture_file[0] =
"CapsicumLeaf.png";
1664 leaf_prototype.leaf_aspect_ratio = 0.45f;
1665 leaf_prototype.midrib_fold_fraction = 0.1f;
1666 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.15, -0.05f);
1667 leaf_prototype.lateral_curvature = -0.15f;
1668 leaf_prototype.wave_period = 0.35f;
1669 leaf_prototype.wave_amplitude = 0.0f;
1670 leaf_prototype.subdivisions = 5;
1671 leaf_prototype.unique_prototypes = 5;
1677 phytomer_parameters.internode.pitch = 10;
1678 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(137.5 - 10, 137.5 + 10);
1679 phytomer_parameters.internode.radius_initial = 0.001;
1680 phytomer_parameters.internode.color =
make_RGBcolor(0.213, 0.270, 0.056);
1681 phytomer_parameters.internode.length_segments = 1;
1683 phytomer_parameters.petiole.petioles_per_internode = 1;
1684 phytomer_parameters.petiole.pitch.uniformDistribution(-60, -40);
1685 phytomer_parameters.petiole.radius = 0.0001;
1686 phytomer_parameters.petiole.length = 0.0001;
1687 phytomer_parameters.petiole.taper = 1;
1688 phytomer_parameters.petiole.curvature = 0;
1689 phytomer_parameters.petiole.color = phytomer_parameters.internode.color;
1690 phytomer_parameters.petiole.length_segments = 1;
1692 phytomer_parameters.leaf.leaves_per_petiole = 1;
1693 phytomer_parameters.leaf.pitch = 0;
1694 phytomer_parameters.leaf.yaw = 10;
1695 phytomer_parameters.leaf.roll = 0;
1696 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.12, 0.15);
1697 phytomer_parameters.leaf.prototype = leaf_prototype;
1699 phytomer_parameters.peduncle.length = 0.01;
1700 phytomer_parameters.peduncle.radius = 0.001;
1701 phytomer_parameters.peduncle.pitch.uniformDistribution(10, 30);
1702 phytomer_parameters.peduncle.roll = 0;
1703 phytomer_parameters.peduncle.curvature = -700;
1704 phytomer_parameters.peduncle.color = phytomer_parameters.internode.color;
1705 phytomer_parameters.peduncle.length_segments = 3;
1706 phytomer_parameters.peduncle.radial_subdivisions = 6;
1708 phytomer_parameters.inflorescence.flowers_per_peduncle = 1;
1709 phytomer_parameters.inflorescence.pitch = 20;
1710 phytomer_parameters.inflorescence.roll.uniformDistribution(-30, 30);
1711 phytomer_parameters.inflorescence.flower_prototype_scale = 0.025;
1712 phytomer_parameters.inflorescence.flower_prototype_function = AlmondFlowerPrototype;
1713 phytomer_parameters.inflorescence.fruit_prototype_scale.uniformDistribution(0.12, 0.16);
1714 phytomer_parameters.inflorescence.fruit_prototype_function = CapsicumFruitPrototype;
1715 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction = 0.9;
1716 phytomer_parameters.inflorescence.unique_prototypes = 10;
1723 shoot_parameters.phytomer_parameters = phytomer_parameters;
1724 shoot_parameters.phytomer_parameters.phytomer_creation_function = CapsicumPhytomerCreationFunction;
1726 shoot_parameters.max_nodes = 30;
1727 shoot_parameters.insertion_angle_tip = 35;
1728 shoot_parameters.insertion_angle_decay_rate = 0;
1729 shoot_parameters.internode_length_max = 0.04;
1730 shoot_parameters.internode_length_min = 0.0;
1731 shoot_parameters.internode_length_decay_rate = 0;
1732 shoot_parameters.base_roll = 90;
1733 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
1734 shoot_parameters.gravitropic_curvature = 300;
1735 shoot_parameters.tortuosity = 3;
1737 shoot_parameters.phyllochron_min = 3;
1738 shoot_parameters.elongation_rate_max = 0.1;
1739 shoot_parameters.girth_area_factor = 2.f;
1740 shoot_parameters.vegetative_bud_break_time = 30;
1741 shoot_parameters.vegetative_bud_break_probability_min = 0.4;
1742 shoot_parameters.vegetative_bud_break_probability_decay_rate = 0;
1743 shoot_parameters.flower_bud_break_probability = 0.5;
1744 shoot_parameters.fruit_set_probability = 0.05;
1745 shoot_parameters.flowers_require_dormancy =
false;
1746 shoot_parameters.growth_requires_dormancy =
false;
1747 shoot_parameters.determinate_shoot_growth =
true;
1749 shoot_parameters.defineChildShootTypes({
"secondary"}, {1.0});
1755 shoot_parameters_secondary.
max_nodes = 7;
1762uint PlantArchitecture::buildCapsicumPlant(
const helios::vec3 &base_position) {
1764 if (shoot_types.empty()) {
1766 initializeCapsicumShoots();
1771 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
1772 uint uID_stem =
addBaseStemShoot(plantID, 1, base_rotation, 0.002, shoot_types.at(
"mainstem").internode_length_max.val(), 0.01, 0.01, 0,
"mainstem");
1778 plant_instances.at(plantID).max_age = 365;
1783void PlantArchitecture::initializeCheeseweedShoots() {
1788 leaf_prototype.OBJ_model_file =
"CheeseweedLeaf.obj";
1794 phytomer_parameters_cheeseweed.internode.pitch = 0;
1795 phytomer_parameters_cheeseweed.internode.phyllotactic_angle.uniformDistribution(127.5f, 147.5);
1796 phytomer_parameters_cheeseweed.internode.radius_initial = 0.0005;
1797 phytomer_parameters_cheeseweed.internode.color =
make_RGBcolor(0.60, 0.65, 0.40);
1798 phytomer_parameters_cheeseweed.internode.length_segments = 1;
1800 phytomer_parameters_cheeseweed.petiole.petioles_per_internode = 1;
1801 phytomer_parameters_cheeseweed.petiole.pitch.uniformDistribution(45, 75);
1802 phytomer_parameters_cheeseweed.petiole.radius = 0.0005;
1803 phytomer_parameters_cheeseweed.petiole.length.uniformDistribution(0.02, 0.06);
1804 phytomer_parameters_cheeseweed.petiole.taper = 0;
1805 phytomer_parameters_cheeseweed.petiole.curvature = -300;
1806 phytomer_parameters_cheeseweed.petiole.length_segments = 5;
1807 phytomer_parameters_cheeseweed.petiole.color = phytomer_parameters_cheeseweed.internode.color;
1809 phytomer_parameters_cheeseweed.leaf.leaves_per_petiole = 1;
1810 phytomer_parameters_cheeseweed.leaf.pitch.uniformDistribution(-30, 0);
1811 phytomer_parameters_cheeseweed.leaf.yaw = 0;
1812 phytomer_parameters_cheeseweed.leaf.roll = 0;
1813 phytomer_parameters_cheeseweed.leaf.prototype_scale = 0.035;
1814 phytomer_parameters_cheeseweed.leaf.prototype = leaf_prototype;
1836uint PlantArchitecture::buildCheeseweedPlant(
const helios::vec3 &base_position) {
1838 if (shoot_types.empty()) {
1840 initializeCheeseweedShoots();
1845 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(0, 0.f, 0.f), 0.0001, 0.0025, 0.1, 0.1, 0,
"base");
1851 plant_instances.at(plantID).max_age = 40;
1856void PlantArchitecture::initializeCowpeaShoots() {
1861 leaf_prototype_trifoliate.leaf_texture_file[0] =
"CowpeaLeaf_tip_centered.png";
1862 leaf_prototype_trifoliate.leaf_texture_file[-1] =
"CowpeaLeaf_left_centered.png";
1863 leaf_prototype_trifoliate.leaf_texture_file[1] =
"CowpeaLeaf_right_centered.png";
1864 leaf_prototype_trifoliate.leaf_aspect_ratio = 0.7f;
1865 leaf_prototype_trifoliate.midrib_fold_fraction = 0.2;
1866 leaf_prototype_trifoliate.longitudinal_curvature.uniformDistribution(-0.3f, -0.1f);
1867 leaf_prototype_trifoliate.lateral_curvature = -0.4f;
1868 leaf_prototype_trifoliate.subdivisions = 6;
1869 leaf_prototype_trifoliate.unique_prototypes = 5;
1870 leaf_prototype_trifoliate.build_petiolule =
true;
1872 LeafPrototype leaf_prototype_unifoliate = leaf_prototype_trifoliate;
1874 leaf_prototype_unifoliate.
leaf_texture_file[0] =
"CowpeaLeaf_unifoliate_centered.png";
1880 phytomer_parameters_trifoliate.internode.pitch = 20;
1881 phytomer_parameters_trifoliate.internode.phyllotactic_angle.uniformDistribution(145, 215);
1882 phytomer_parameters_trifoliate.internode.radius_initial = 0.0015;
1883 phytomer_parameters_trifoliate.internode.max_floral_buds_per_petiole = 1;
1884 phytomer_parameters_trifoliate.internode.max_vegetative_buds_per_petiole = 1;
1885 phytomer_parameters_trifoliate.internode.color =
make_RGBcolor(0.15, 0.2, 0.1);
1886 phytomer_parameters_trifoliate.internode.length_segments = 2;
1888 phytomer_parameters_trifoliate.petiole.petioles_per_internode = 1;
1889 phytomer_parameters_trifoliate.petiole.pitch.uniformDistribution(45, 60);
1890 phytomer_parameters_trifoliate.petiole.radius = 0.0018;
1891 phytomer_parameters_trifoliate.petiole.length.uniformDistribution(0.06, 0.08);
1892 phytomer_parameters_trifoliate.petiole.taper = 0.25;
1893 phytomer_parameters_trifoliate.petiole.curvature.uniformDistribution(-200, -50);
1894 phytomer_parameters_trifoliate.petiole.color =
make_RGBcolor(0.2, 0.25, 0.06);
1895 phytomer_parameters_trifoliate.petiole.length_segments = 5;
1896 phytomer_parameters_trifoliate.petiole.radial_subdivisions = 6;
1898 phytomer_parameters_trifoliate.leaf.leaves_per_petiole = 3;
1899 phytomer_parameters_trifoliate.leaf.pitch.normalDistribution(45, 20);
1900 phytomer_parameters_trifoliate.leaf.yaw = 10;
1901 phytomer_parameters_trifoliate.leaf.roll = -15;
1902 phytomer_parameters_trifoliate.leaf.leaflet_offset = 0.4;
1903 phytomer_parameters_trifoliate.leaf.leaflet_scale = 0.9;
1904 phytomer_parameters_trifoliate.leaf.prototype_scale.uniformDistribution(0.09, 0.12);
1905 phytomer_parameters_trifoliate.leaf.prototype = leaf_prototype_trifoliate;
1907 phytomer_parameters_trifoliate.peduncle.length.uniformDistribution(0.3, 0.4);
1908 phytomer_parameters_trifoliate.peduncle.radius = 0.00225;
1909 phytomer_parameters_trifoliate.peduncle.pitch.uniformDistribution(0, 30);
1910 phytomer_parameters_trifoliate.peduncle.roll = 90;
1911 phytomer_parameters_trifoliate.peduncle.curvature.uniformDistribution(125, 200);
1912 phytomer_parameters_trifoliate.peduncle.color =
make_RGBcolor(0.17, 0.213, 0.051);
1913 phytomer_parameters_trifoliate.peduncle.length_segments = 6;
1914 phytomer_parameters_trifoliate.peduncle.radial_subdivisions = 6;
1916 phytomer_parameters_trifoliate.inflorescence.flowers_per_peduncle.uniformDistribution(1, 3);
1917 phytomer_parameters_trifoliate.inflorescence.flower_offset = 0.05;
1918 phytomer_parameters_trifoliate.inflorescence.pitch.uniformDistribution(40, 60);
1919 phytomer_parameters_trifoliate.inflorescence.roll.uniformDistribution(-20, 20);
1920 phytomer_parameters_trifoliate.inflorescence.flower_prototype_scale = 0.03;
1921 phytomer_parameters_trifoliate.inflorescence.flower_prototype_function = CowpeaFlowerPrototype;
1922 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_scale.uniformDistribution(0.09, 0.1);
1923 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_function = CowpeaFruitPrototype;
1924 phytomer_parameters_trifoliate.inflorescence.fruit_gravity_factor_fraction.uniformDistribution(0.5, 0.7);
1927 phytomer_parameters_unifoliate.
internode.pitch = 0;
1928 phytomer_parameters_unifoliate.
internode.max_vegetative_buds_per_petiole = 1;
1929 phytomer_parameters_unifoliate.
internode.max_floral_buds_per_petiole = 0;
1930 phytomer_parameters_unifoliate.
petiole.petioles_per_internode = 2;
1931 phytomer_parameters_unifoliate.
petiole.length = 0.0001;
1932 phytomer_parameters_unifoliate.
petiole.radius = 0.0004;
1933 phytomer_parameters_unifoliate.
petiole.pitch.uniformDistribution(60, 80);
1934 phytomer_parameters_unifoliate.
leaf.leaves_per_petiole = 1;
1935 phytomer_parameters_unifoliate.
leaf.prototype_scale = 0.02;
1936 phytomer_parameters_unifoliate.
leaf.pitch.uniformDistribution(-10, 10);
1937 phytomer_parameters_unifoliate.
leaf.prototype = leaf_prototype_unifoliate;
1942 shoot_parameters_trifoliate.phytomer_parameters = phytomer_parameters_trifoliate;
1943 shoot_parameters_trifoliate.phytomer_parameters.phytomer_creation_function = CowpeaPhytomerCreationFunction;
1945 shoot_parameters_trifoliate.max_nodes = 20;
1946 shoot_parameters_trifoliate.insertion_angle_tip.uniformDistribution(40, 60);
1948 shoot_parameters_trifoliate.internode_length_max = 0.025;
1951 shoot_parameters_trifoliate.base_roll = 90;
1952 shoot_parameters_trifoliate.base_yaw.uniformDistribution(-20, 20);
1953 shoot_parameters_trifoliate.gravitropic_curvature = 200;
1955 shoot_parameters_trifoliate.phyllochron_min = 2;
1956 shoot_parameters_trifoliate.elongation_rate_max = 0.1;
1957 shoot_parameters_trifoliate.girth_area_factor = 1.5f;
1958 shoot_parameters_trifoliate.vegetative_bud_break_time = 10;
1959 shoot_parameters_trifoliate.vegetative_bud_break_probability_min = 0.2;
1960 shoot_parameters_trifoliate.vegetative_bud_break_probability_decay_rate = -0.4;
1962 shoot_parameters_trifoliate.flower_bud_break_probability.uniformDistribution(0.1, 0.15);
1963 shoot_parameters_trifoliate.fruit_set_probability = 0.4;
1968 shoot_parameters_trifoliate.defineChildShootTypes({
"trifoliate"}, {1.0});
1971 ShootParameters shoot_parameters_unifoliate = shoot_parameters_trifoliate;
1973 shoot_parameters_unifoliate.
max_nodes = 1;
1986uint PlantArchitecture::buildCowpeaPlant(
const helios::vec3 &base_position) {
1988 if (shoot_types.empty()) {
1990 initializeCowpeaShoots();
1995 AxisRotation base_rotation = make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
1996 uint uID_unifoliate =
addBaseStemShoot(plantID, 1, base_rotation, 0.0005, 0.03, 0.01, 0.01, 0,
"unifoliate");
1998 appendShoot(plantID, uID_unifoliate, 1, make_AxisRotation(0, 0, 0.5f * M_PI), shoot_types.at(
"trifoliate").phytomer_parameters.internode.radius_initial.val(), shoot_types.at(
"trifoliate").internode_length_max.val(), 0.1, 0.1, 0,
"trifoliate");
2004 plant_instances.at(plantID).max_age = 365;
2009void PlantArchitecture::initializeGrapevineVSPShoots() {
2014 leaf_prototype.leaf_texture_file[0] =
"GrapeLeaf.png";
2015 leaf_prototype.leaf_aspect_ratio = 1.f;
2016 leaf_prototype.midrib_fold_fraction = 0.3f;
2017 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.4, 0.4);
2018 leaf_prototype.lateral_curvature = 0;
2019 leaf_prototype.wave_period = 0.3f;
2020 leaf_prototype.wave_amplitude = 0.1f;
2021 leaf_prototype.subdivisions = 5;
2022 leaf_prototype.unique_prototypes = 10;
2023 leaf_prototype.leaf_offset =
make_vec3(-0.3, 0, 0);
2029 phytomer_parameters_grapevine.internode.pitch = 20;
2030 phytomer_parameters_grapevine.internode.phyllotactic_angle.uniformDistribution(160, 200);
2031 phytomer_parameters_grapevine.internode.radius_initial = 0.003;
2032 phytomer_parameters_grapevine.internode.color =
make_RGBcolor(0.23, 0.13, 0.062);
2033 phytomer_parameters_grapevine.internode.length_segments = 1;
2034 phytomer_parameters_grapevine.internode.max_floral_buds_per_petiole = 1;
2035 phytomer_parameters_grapevine.internode.max_vegetative_buds_per_petiole = 1;
2037 phytomer_parameters_grapevine.petiole.petioles_per_internode = 1;
2038 phytomer_parameters_grapevine.petiole.color =
make_RGBcolor(0.13, 0.066, 0.03);
2039 phytomer_parameters_grapevine.petiole.pitch.uniformDistribution(45, 70);
2040 phytomer_parameters_grapevine.petiole.radius = 0.0025;
2041 phytomer_parameters_grapevine.petiole.length = 0.1;
2042 phytomer_parameters_grapevine.petiole.taper = 0;
2043 phytomer_parameters_grapevine.petiole.curvature = 0;
2044 phytomer_parameters_grapevine.petiole.length_segments = 1;
2046 phytomer_parameters_grapevine.leaf.leaves_per_petiole = 1;
2047 phytomer_parameters_grapevine.leaf.pitch.uniformDistribution(-110, -80);
2048 phytomer_parameters_grapevine.leaf.yaw.uniformDistribution(-20, 20);
2049 phytomer_parameters_grapevine.leaf.roll.uniformDistribution(-5, 5);
2050 phytomer_parameters_grapevine.leaf.prototype_scale = 0.2;
2051 phytomer_parameters_grapevine.leaf.prototype = leaf_prototype;
2053 phytomer_parameters_grapevine.peduncle.length = 0.08;
2054 phytomer_parameters_grapevine.peduncle.pitch.uniformDistribution(50, 90);
2055 phytomer_parameters_grapevine.peduncle.color =
make_RGBcolor(0.32, 0.05, 0.13);
2057 phytomer_parameters_grapevine.inflorescence.flowers_per_peduncle = 1;
2058 phytomer_parameters_grapevine.inflorescence.pitch = 0;
2060 phytomer_parameters_grapevine.inflorescence.flower_prototype_scale = 0.04;
2061 phytomer_parameters_grapevine.inflorescence.fruit_prototype_function = GrapevineFruitPrototype;
2062 phytomer_parameters_grapevine.inflorescence.fruit_prototype_scale = 0.04;
2063 phytomer_parameters_grapevine.inflorescence.fruit_gravity_factor_fraction = 0.7;
2065 phytomer_parameters_grapevine.phytomer_creation_function = GrapevinePhytomerCreationFunction;
2071 shoot_parameters_main.phytomer_parameters = phytomer_parameters_grapevine;
2072 shoot_parameters_main.vegetative_bud_break_probability_min = 0.075;
2073 shoot_parameters_main.vegetative_bud_break_probability_decay_rate = 1.;
2074 shoot_parameters_main.vegetative_bud_break_time = 30;
2075 shoot_parameters_main.phyllochron_min.uniformDistribution(1.75, 2.25);
2076 shoot_parameters_main.elongation_rate_max = 0.15;
2077 shoot_parameters_main.girth_area_factor = 1.f;
2078 shoot_parameters_main.gravitropic_curvature = 400;
2079 shoot_parameters_main.tortuosity = 15;
2080 shoot_parameters_main.internode_length_max.uniformDistribution(0.06, 0.08);
2081 shoot_parameters_main.internode_length_decay_rate = 0;
2082 shoot_parameters_main.insertion_angle_tip = 45;
2083 shoot_parameters_main.insertion_angle_decay_rate = 0;
2084 shoot_parameters_main.flowers_require_dormancy =
false;
2085 shoot_parameters_main.growth_requires_dormancy =
false;
2086 shoot_parameters_main.determinate_shoot_growth =
false;
2087 shoot_parameters_main.max_terminal_floral_buds = 0;
2088 shoot_parameters_main.flower_bud_break_probability = 0.5;
2089 shoot_parameters_main.fruit_set_probability = 0.2;
2090 shoot_parameters_main.max_nodes = 20;
2091 shoot_parameters_main.base_roll.uniformDistribution(90 - 25, 90 + 25);
2092 shoot_parameters_main.base_yaw = 0;
2129uint PlantArchitecture::buildGrapevineVSP(
const helios::vec3 &base_position) {
2131 if (shoot_types.empty()) {
2133 initializeGrapevineVSPShoots();
2137 auto vine_spacing = getParameterValue(current_build_parameters,
"vine_spacing", 2.4f, 0.5f, 5.f,
"plant-to-plant spacing in meters");
2138 auto trunk_height = getParameterValue(current_build_parameters,
"trunk_height", 0.1f, 0.05f, 1.f,
"total trunk height in meters");
2141 float trunk_internode_length = 0.1f;
2142 uint trunk_nodes =
uint(trunk_height / trunk_internode_length);
2143 if (trunk_nodes < 1)
2147 float cane_internode_length = 0.15f;
2148 float cane_total_length = vine_spacing / 2.f;
2149 uint cane_nodes =
uint(cane_total_length / cane_internode_length);
2154 float cane_radius = 0.005f;
2155 float cane_pitch_min = float(0.45f * M_PI);
2156 float cane_pitch_max = float(0.52f * M_PI);
2160 uint uID_stem =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(context_ptr->
randu(0, 0.05 * M_PI), 0, 0), shoot_types.at(
"grapevine_trunk").phytomer_parameters.internode.radius_initial.val(), trunk_internode_length, 1, 1, 0.1,
2163 uint uID_cane_L =
appendShoot(plantID, uID_stem, cane_nodes, make_AxisRotation(context_ptr->
randu(cane_pitch_min, cane_pitch_max), 0, M_PI), cane_radius, cane_internode_length, 1, 1, 0.5,
"grapevine_cane");
2164 uint uID_cane_R =
appendShoot(plantID, uID_stem, cane_nodes, make_AxisRotation(context_ptr->
randu(cane_pitch_min, cane_pitch_max), M_PI, M_PI), cane_radius, cane_internode_length, 1, 1, 0.5,
"grapevine_cane");
2174 plant_instances.at(plantID).max_age = 365;
2179void PlantArchitecture::initializeGrapevineWyeShoots() {
2184 leaf_prototype.leaf_texture_file[0] =
"GrapeLeaf.png";
2185 leaf_prototype.leaf_aspect_ratio = 1.f;
2186 leaf_prototype.midrib_fold_fraction = 0.3f;
2187 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.4, 0.4);
2188 leaf_prototype.lateral_curvature = 0;
2189 leaf_prototype.wave_period = 0.3f;
2190 leaf_prototype.wave_amplitude = 0.1f;
2191 leaf_prototype.subdivisions = 5;
2192 leaf_prototype.unique_prototypes = 10;
2193 leaf_prototype.leaf_offset =
make_vec3(-0.3, 0, 0);
2199 phytomer_parameters_grapevine.internode.pitch = 20;
2200 phytomer_parameters_grapevine.internode.phyllotactic_angle.uniformDistribution(160, 200);
2201 phytomer_parameters_grapevine.internode.radius_initial = 0.003;
2202 phytomer_parameters_grapevine.internode.color =
make_RGBcolor(0.23, 0.13, 0.062);
2203 phytomer_parameters_grapevine.internode.length_segments = 1;
2204 phytomer_parameters_grapevine.internode.max_floral_buds_per_petiole = 1;
2205 phytomer_parameters_grapevine.internode.max_vegetative_buds_per_petiole = 1;
2207 phytomer_parameters_grapevine.petiole.petioles_per_internode = 1;
2208 phytomer_parameters_grapevine.petiole.color =
make_RGBcolor(0.13, 0.125, 0.03);
2209 phytomer_parameters_grapevine.petiole.pitch.uniformDistribution(45, 70);
2210 phytomer_parameters_grapevine.petiole.radius = 0.0025;
2211 phytomer_parameters_grapevine.petiole.length = 0.1;
2212 phytomer_parameters_grapevine.petiole.taper = 0;
2213 phytomer_parameters_grapevine.petiole.curvature = 0;
2214 phytomer_parameters_grapevine.petiole.length_segments = 1;
2216 phytomer_parameters_grapevine.leaf.leaves_per_petiole = 1;
2217 phytomer_parameters_grapevine.leaf.pitch.uniformDistribution(-110, -80);
2218 phytomer_parameters_grapevine.leaf.yaw.uniformDistribution(-20, 20);
2219 phytomer_parameters_grapevine.leaf.roll.uniformDistribution(-5, 5);
2220 phytomer_parameters_grapevine.leaf.prototype_scale = 0.2;
2221 phytomer_parameters_grapevine.leaf.prototype = leaf_prototype;
2223 phytomer_parameters_grapevine.peduncle.length = 0.04;
2224 phytomer_parameters_grapevine.peduncle.radius = 0.005;
2225 phytomer_parameters_grapevine.peduncle.color =
make_RGBcolor(0.13, 0.125, 0.03);
2226 phytomer_parameters_grapevine.peduncle.pitch.uniformDistribution(80, 100);
2228 phytomer_parameters_grapevine.inflorescence.flowers_per_peduncle = 1;
2229 phytomer_parameters_grapevine.inflorescence.pitch = 0;
2231 phytomer_parameters_grapevine.inflorescence.flower_prototype_scale = 0.04;
2232 phytomer_parameters_grapevine.inflorescence.fruit_prototype_function = GrapevineFruitPrototype;
2233 phytomer_parameters_grapevine.inflorescence.fruit_prototype_scale = 0.04;
2234 phytomer_parameters_grapevine.inflorescence.fruit_gravity_factor_fraction = 0.9;
2236 phytomer_parameters_grapevine.phytomer_creation_function = GrapevinePhytomerCreationFunction;
2242 shoot_parameters_main.phytomer_parameters = phytomer_parameters_grapevine;
2243 shoot_parameters_main.vegetative_bud_break_probability_min = 0.025;
2244 shoot_parameters_main.vegetative_bud_break_probability_decay_rate = -1.;
2245 shoot_parameters_main.vegetative_bud_break_time = 30;
2246 shoot_parameters_main.phyllochron_min.uniformDistribution(2.5, 3.5);
2247 shoot_parameters_main.elongation_rate_max = 0.15;
2248 shoot_parameters_main.girth_area_factor = 0.8f;
2249 shoot_parameters_main.gravitropic_curvature.uniformDistribution(0, 100);
2250 shoot_parameters_main.tortuosity = 10;
2251 shoot_parameters_main.internode_length_max.uniformDistribution(0.06, 0.08);
2252 shoot_parameters_main.internode_length_decay_rate = 0;
2253 shoot_parameters_main.insertion_angle_tip = 45;
2254 shoot_parameters_main.insertion_angle_decay_rate = 0;
2255 shoot_parameters_main.flowers_require_dormancy =
false;
2256 shoot_parameters_main.growth_requires_dormancy =
false;
2257 shoot_parameters_main.determinate_shoot_growth =
false;
2258 shoot_parameters_main.max_terminal_floral_buds = 0;
2259 shoot_parameters_main.flower_bud_break_probability = 0.5;
2260 shoot_parameters_main.fruit_set_probability = 0.2;
2261 shoot_parameters_main.max_nodes.uniformDistribution(14, 18);
2262 shoot_parameters_main.base_roll.uniformDistribution(90 - 25, 90 + 25);
2263 shoot_parameters_main.base_yaw.uniformDistribution(-50, 50);
2277 shoot_parameters_cordon.
base_yaw = 0;
2300uint PlantArchitecture::buildGrapevineWye(
const helios::vec3 &base_position) {
2302 if (shoot_types.empty()) {
2304 initializeGrapevineWyeShoots();
2308 auto trunk_height_total = getParameterValue(current_build_parameters,
"trunk_height", 0.165f, 0.05f, 1.f,
"total trunk height in meters");
2309 auto cordon_spacing = getParameterValue(current_build_parameters,
"cordon_spacing", 0.6f, 0.2f, 2.f,
"spacing between cordon rows in meters");
2310 auto vine_spacing = getParameterValue(current_build_parameters,
"vine_spacing", 1.8f, 0.5f, 5.f,
"plant-to-plant spacing in meters");
2311 auto catch_wire_height = getParameterValue(current_build_parameters,
"catch_wire_height", 2.1f, 0.5f, 4.f,
"absolute height of catch wires in meters");
2314 float trunk_internode_length = 0.165f / 8.f;
2315 uint trunk_nodes =
uint(trunk_height_total / trunk_internode_length);
2316 if (trunk_nodes < 1)
2320 float head_height = catch_wire_height - 0.35f;
2323 uint upright_nodes = 3;
2324 float upright_pitch_min = 42.f;
2325 float upright_pitch_max = 48.f;
2326 float upright_radius = 0.03f;
2327 float upright_length = 0.14f;
2328 uint cordon_nodes = 8;
2329 float cordon_radius = 0.02f;
2330 float cordon_length = 0.11f;
2331 float catch_wire_offset_1 = 0.15f;
2332 float catch_wire_offset_2 = 0.35f;
2334 std::vector<std::vector<vec3>> trellis_points;
2337 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, -0.5f * cordon_spacing, head_height),
make_vec3(0.5f * vine_spacing, -0.5f * cordon_spacing, head_height), 8));
2338 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, 0.5f * cordon_spacing, head_height),
make_vec3(0.5f * vine_spacing, 0.5f * cordon_spacing, head_height), 8));
2341 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, -0.5f * cordon_spacing - catch_wire_offset_1, catch_wire_height - catch_wire_offset_2),
2342 make_vec3(0.5f * vine_spacing, -0.5f * cordon_spacing - catch_wire_offset_1, catch_wire_height - catch_wire_offset_2), 8));
2343 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, 0.5f * cordon_spacing + catch_wire_offset_1, catch_wire_height - catch_wire_offset_2),
2344 make_vec3(0.5f * vine_spacing, 0.5f * cordon_spacing + catch_wire_offset_1, catch_wire_height - catch_wire_offset_2), 8));
2347 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, -0.5f * cordon_spacing - catch_wire_offset_2, catch_wire_height),
make_vec3(0.5f * vine_spacing, -0.5f * cordon_spacing - catch_wire_offset_2, catch_wire_height), 8));
2348 trellis_points.push_back(
linspace(
make_vec3(-0.5f * vine_spacing, 0.5f * cordon_spacing + catch_wire_offset_2, catch_wire_height),
make_vec3(0.5f * vine_spacing, 0.5f * cordon_spacing + catch_wire_offset_2, catch_wire_height), 8));
2350 for (
int j = 0; j < trellis_points.size(); j++) {
2351 for (
int i = 0; i < trellis_points[j].size(); i++) {
2352 trellis_points.at(j).at(i) += base_position;
2359 setPlantAttractionPoints(plantID,
flatten(trellis_points), 45.f, 0.5f, 0.5);
2361 uint uID_stem =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(0., 0, 0), shoot_types.at(
"grapevine_trunk").phytomer_parameters.internode.radius_initial.val(), trunk_internode_length, 1, 1, 0.1,
"grapevine_trunk");
2363 uint uID_upright_L =
appendShoot(plantID, uID_stem, upright_nodes, make_AxisRotation(
deg2rad(context_ptr->
randu(upright_pitch_min, upright_pitch_max)), 0, M_PI), upright_radius, upright_length, 1, 1, 0.2,
"grapevine_trunk");
2364 uint uID_upright_R =
appendShoot(plantID, uID_stem, upright_nodes, make_AxisRotation(
deg2rad(context_ptr->
randu(upright_pitch_min, upright_pitch_max)), M_PI, M_PI), upright_radius, upright_length, 1, 1, 0.2,
"grapevine_trunk");
2366 uint uID_cordon_L1 =
appendShoot(plantID, uID_upright_L, cordon_nodes, make_AxisRotation(
deg2rad(-90), 0.5 * M_PI, -0.2), cordon_radius, cordon_length, 1, 1, 0.5,
"grapevine_cordon");
2367 uint uID_cordon_L2 =
appendShoot(plantID, uID_upright_L, cordon_nodes, make_AxisRotation(
deg2rad(-90), -0.5 * M_PI, 0.2), cordon_radius, cordon_length, 1, 1, 0.5,
"grapevine_cordon");
2369 uint uID_cordon_R1 =
appendShoot(plantID, uID_upright_R, cordon_nodes, make_AxisRotation(
deg2rad(-90), 0.5 * M_PI, 0.2), cordon_radius, cordon_length, 1, 1, 0.5,
"grapevine_cordon");
2370 uint uID_cordon_R2 =
appendShoot(plantID, uID_upright_R, cordon_nodes, make_AxisRotation(
deg2rad(-90), -0.5 * M_PI, -0.2), cordon_radius, cordon_length, 1, 1, 0.5,
"grapevine_cordon");
2385 plant_instances.at(plantID).max_age = 365;
2390void PlantArchitecture::initializeGroundCherryWeedShoots() {
2395 leaf_prototype.leaf_texture_file[0] =
"GroundCherryLeaf.png";
2396 leaf_prototype.leaf_aspect_ratio.uniformDistribution(0.3, 0.5);
2397 leaf_prototype.midrib_fold_fraction = 0.2f;
2398 leaf_prototype.longitudinal_curvature = 0.1f;
2400 leaf_prototype.lateral_curvature = -0.3f;
2401 leaf_prototype.wave_period = 0.35f;
2402 leaf_prototype.wave_amplitude = 0.08f;
2403 leaf_prototype.subdivisions = 6;
2404 leaf_prototype.unique_prototypes = 5;
2410 phytomer_parameters.internode.pitch = 5;
2411 phytomer_parameters.internode.phyllotactic_angle = 137.5;
2412 phytomer_parameters.internode.radius_initial = 0.0005;
2413 phytomer_parameters.internode.color =
make_RGBcolor(0.266, 0.3375, 0.0700);
2414 phytomer_parameters.internode.length_segments = 1;
2416 phytomer_parameters.petiole.petioles_per_internode = 1;
2417 phytomer_parameters.petiole.pitch.uniformDistribution(45, 60);
2418 phytomer_parameters.petiole.radius = 0.0005;
2419 phytomer_parameters.petiole.length = 0.025;
2420 phytomer_parameters.petiole.taper = 0.15;
2421 phytomer_parameters.petiole.curvature.uniformDistribution(-150, -50);
2422 phytomer_parameters.petiole.color = phytomer_parameters.internode.color;
2423 phytomer_parameters.petiole.length_segments = 2;
2425 phytomer_parameters.leaf.leaves_per_petiole = 1;
2426 phytomer_parameters.leaf.pitch.uniformDistribution(-30, 5);
2427 phytomer_parameters.leaf.yaw = 10;
2428 phytomer_parameters.leaf.roll = 0;
2429 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.06, 0.08);
2430 phytomer_parameters.leaf.prototype = leaf_prototype;
2432 phytomer_parameters.peduncle.length = 0.01;
2433 phytomer_parameters.peduncle.radius = 0.001;
2434 phytomer_parameters.peduncle.pitch = 20;
2435 phytomer_parameters.peduncle.roll = 0;
2436 phytomer_parameters.peduncle.curvature = -700;
2437 phytomer_parameters.peduncle.color = phytomer_parameters.internode.color;
2438 phytomer_parameters.peduncle.length_segments = 2;
2439 phytomer_parameters.peduncle.radial_subdivisions = 6;
2441 phytomer_parameters.inflorescence.flowers_per_peduncle = 1;
2442 phytomer_parameters.inflorescence.pitch = 0;
2443 phytomer_parameters.inflorescence.roll.uniformDistribution(-30, 30);
2444 phytomer_parameters.inflorescence.flower_prototype_scale = 0.01;
2445 phytomer_parameters.inflorescence.flower_prototype_function = BindweedFlowerPrototype;
2446 phytomer_parameters.inflorescence.fruit_prototype_scale = 0.06;
2448 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction = 0.75;
2453 shoot_parameters.phytomer_parameters = phytomer_parameters;
2456 shoot_parameters.max_nodes = 26;
2457 shoot_parameters.insertion_angle_tip = 50;
2458 shoot_parameters.insertion_angle_decay_rate = 0;
2459 shoot_parameters.internode_length_max = 0.015;
2460 shoot_parameters.internode_length_min = 0.0;
2461 shoot_parameters.internode_length_decay_rate = 0;
2462 shoot_parameters.base_roll = 90;
2463 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
2464 shoot_parameters.gravitropic_curvature = 700;
2465 shoot_parameters.tortuosity = 3;
2467 shoot_parameters.phyllochron_min = 1;
2468 shoot_parameters.elongation_rate_max = 0.1;
2469 shoot_parameters.girth_area_factor = 2.f;
2470 shoot_parameters.vegetative_bud_break_time = 10;
2471 shoot_parameters.vegetative_bud_break_probability_min = 0.1;
2472 shoot_parameters.vegetative_bud_break_probability_decay_rate = -0.5;
2473 shoot_parameters.flower_bud_break_probability = 0.25;
2474 shoot_parameters.fruit_set_probability = 0.5;
2475 shoot_parameters.flowers_require_dormancy =
false;
2476 shoot_parameters.growth_requires_dormancy =
false;
2477 shoot_parameters.determinate_shoot_growth =
false;
2479 shoot_parameters.defineChildShootTypes({
"mainstem"}, {1.0});
2484uint PlantArchitecture::buildGroundCherryWeedPlant(
const helios::vec3 &base_position) {
2486 if (shoot_types.empty()) {
2488 initializeGroundCherryWeedShoots();
2493 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
2494 uint uID_stem =
addBaseStemShoot(plantID, 1, base_rotation, 0.0025, 0.018, 0.01, 0.01, 0,
"mainstem");
2500 plant_instances.at(plantID).max_age = 80;
2505void PlantArchitecture::initializeMaizeShoots() {
2510 leaf_prototype.leaf_texture_file[0] =
"SorghumLeaf.png";
2511 leaf_prototype.leaf_aspect_ratio = 0.25f;
2512 leaf_prototype.midrib_fold_fraction = 0.3f;
2513 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.45, -0.3);
2514 leaf_prototype.lateral_curvature = -0.3f;
2516 leaf_prototype.petiole_roll = 0.04f;
2517 leaf_prototype.wave_period = 0.1f;
2518 leaf_prototype.wave_amplitude = 0.1f;
2519 leaf_prototype.leaf_buckle_length.uniformDistribution(0.4, 0.6);
2520 leaf_prototype.leaf_buckle_angle.uniformDistribution(40, 50);
2521 leaf_prototype.subdivisions = 50;
2522 leaf_prototype.unique_prototypes = 10;
2528 phytomer_parameters_maize.internode.pitch = 0;
2529 phytomer_parameters_maize.internode.phyllotactic_angle.uniformDistribution(170, 190);
2530 phytomer_parameters_maize.internode.radius_initial = 0.0075;
2531 phytomer_parameters_maize.internode.color =
make_RGBcolor(0.126, 0.182, 0.084);
2532 phytomer_parameters_maize.internode.length_segments = 2;
2533 phytomer_parameters_maize.internode.radial_subdivisions = 10;
2534 phytomer_parameters_maize.internode.max_floral_buds_per_petiole = 1;
2535 phytomer_parameters_maize.internode.max_vegetative_buds_per_petiole = 0;
2537 phytomer_parameters_maize.petiole.petioles_per_internode = 1;
2538 phytomer_parameters_maize.petiole.pitch.uniformDistribution(-40, -20);
2539 phytomer_parameters_maize.petiole.radius = 0.0;
2540 phytomer_parameters_maize.petiole.length = 0.05;
2541 phytomer_parameters_maize.petiole.taper = 0;
2542 phytomer_parameters_maize.petiole.curvature = 0;
2543 phytomer_parameters_maize.petiole.length_segments = 1;
2545 phytomer_parameters_maize.leaf.leaves_per_petiole = 1;
2546 phytomer_parameters_maize.leaf.pitch = 0;
2547 phytomer_parameters_maize.leaf.yaw = 0;
2548 phytomer_parameters_maize.leaf.roll = 0;
2549 phytomer_parameters_maize.leaf.prototype_scale = 0.6;
2550 phytomer_parameters_maize.leaf.prototype = leaf_prototype;
2552 phytomer_parameters_maize.peduncle.length = 0.14f;
2553 phytomer_parameters_maize.peduncle.radius = 0.004;
2554 phytomer_parameters_maize.peduncle.curvature = 0;
2555 phytomer_parameters_maize.peduncle.color = phytomer_parameters_maize.internode.color;
2556 phytomer_parameters_maize.peduncle.radial_subdivisions = 6;
2557 phytomer_parameters_maize.peduncle.length_segments = 2;
2559 phytomer_parameters_maize.inflorescence.flowers_per_peduncle = 7;
2560 phytomer_parameters_maize.inflorescence.pitch.uniformDistribution(0, 30);
2561 phytomer_parameters_maize.inflorescence.roll = 0;
2562 phytomer_parameters_maize.inflorescence.flower_offset = 0.1;
2563 phytomer_parameters_maize.inflorescence.fruit_prototype_scale = 0.15;
2564 phytomer_parameters_maize.inflorescence.fruit_prototype_function = MaizeTasselPrototype;
2566 phytomer_parameters_maize.phytomer_creation_function = MaizePhytomerCreationFunction;
2571 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters_maize;
2572 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0.5;
2573 shoot_parameters_mainstem.flower_bud_break_probability = 1;
2574 shoot_parameters_mainstem.phyllochron_min = 2;
2575 shoot_parameters_mainstem.elongation_rate_max = 0.1;
2576 shoot_parameters_mainstem.girth_area_factor = 6.f;
2577 shoot_parameters_mainstem.gravitropic_curvature.uniformDistribution(-500, 0);
2578 shoot_parameters_mainstem.internode_length_max = 0.22;
2579 shoot_parameters_mainstem.tortuosity = 1.f;
2580 shoot_parameters_mainstem.internode_length_decay_rate = 0;
2581 shoot_parameters_mainstem.flowers_require_dormancy =
false;
2582 shoot_parameters_mainstem.growth_requires_dormancy =
false;
2583 shoot_parameters_mainstem.determinate_shoot_growth =
false;
2584 shoot_parameters_mainstem.flower_bud_break_probability = 1.0;
2585 shoot_parameters_mainstem.fruit_set_probability = 1.0;
2586 shoot_parameters_mainstem.defineChildShootTypes({
"mainstem"}, {1.0});
2587 shoot_parameters_mainstem.max_nodes = 17;
2588 shoot_parameters_mainstem.max_terminal_floral_buds = 1;
2593uint PlantArchitecture::buildMaizePlant(
const helios::vec3 &base_position) {
2595 if (shoot_types.empty()) {
2597 initializeMaizeShoots();
2602 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(context_ptr->
randu(0.f, 0.035f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)), 0.003, 0.08, 0.01, 0.01, 0.2,
"mainstem");
2608 plant_instances.at(plantID).max_age = 365;
2613void PlantArchitecture::initializeOliveTreeShoots() {
2618 leaf_prototype.prototype_function = OliveLeafPrototype;
2619 leaf_prototype.unique_prototypes = 1;
2625 phytomer_parameters_olive.internode.pitch = 0;
2626 phytomer_parameters_olive.internode.phyllotactic_angle.uniformDistribution(80, 100);
2627 phytomer_parameters_olive.internode.radius_initial = 0.002;
2628 phytomer_parameters_olive.internode.length_segments = 1;
2629 phytomer_parameters_olive.internode.image_texture =
"OliveBark.jpg";
2630 phytomer_parameters_olive.internode.max_floral_buds_per_petiole = 3;
2632 phytomer_parameters_olive.petiole.petioles_per_internode = 2;
2633 phytomer_parameters_olive.petiole.pitch.uniformDistribution(-40, -20);
2634 phytomer_parameters_olive.petiole.taper = 0.1;
2635 phytomer_parameters_olive.petiole.curvature = 0;
2636 phytomer_parameters_olive.petiole.length = 0.01;
2637 phytomer_parameters_olive.petiole.radius = 0.0005;
2638 phytomer_parameters_olive.petiole.length_segments = 1;
2639 phytomer_parameters_olive.petiole.radial_subdivisions = 3;
2640 phytomer_parameters_olive.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
2642 phytomer_parameters_olive.leaf.leaves_per_petiole = 1;
2643 phytomer_parameters_olive.leaf.prototype_scale = 0.06;
2644 phytomer_parameters_olive.leaf.prototype = leaf_prototype;
2646 phytomer_parameters_olive.peduncle.length = 0.065;
2647 phytomer_parameters_olive.peduncle.radius = 0.001;
2648 phytomer_parameters_olive.peduncle.pitch = 60;
2649 phytomer_parameters_olive.peduncle.roll = 0;
2650 phytomer_parameters_olive.peduncle.length_segments = 1;
2651 phytomer_parameters_olive.peduncle.color =
make_RGBcolor(0.7, 0.72, 0.7);
2653 phytomer_parameters_olive.inflorescence.flowers_per_peduncle = 10;
2654 phytomer_parameters_olive.inflorescence.flower_offset = 0.13;
2655 phytomer_parameters_olive.inflorescence.pitch.uniformDistribution(80, 100);
2656 phytomer_parameters_olive.inflorescence.roll.uniformDistribution(0, 360);
2657 phytomer_parameters_olive.inflorescence.flower_prototype_scale = 0.01;
2659 phytomer_parameters_olive.inflorescence.fruit_prototype_scale = 0.025;
2660 phytomer_parameters_olive.inflorescence.fruit_prototype_function = OliveFruitPrototype;
2681 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_olive;
2683 shoot_parameters_proleptic.phytomer_parameters.phytomer_callback_function = OlivePhytomerCallbackFunction;
2684 shoot_parameters_proleptic.max_nodes.uniformDistribution(16, 24);
2685 shoot_parameters_proleptic.max_nodes_per_season.uniformDistribution(8, 12);
2686 shoot_parameters_proleptic.phyllochron_min = 2.0;
2687 shoot_parameters_proleptic.elongation_rate_max = 0.25;
2688 shoot_parameters_proleptic.girth_area_factor = 5.f;
2689 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.025;
2690 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 1.0;
2691 shoot_parameters_proleptic.vegetative_bud_break_time = 30;
2692 shoot_parameters_proleptic.gravitropic_curvature.uniformDistribution(550, 650);
2693 shoot_parameters_proleptic.tortuosity = 5;
2694 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(35, 40);
2695 shoot_parameters_proleptic.insertion_angle_decay_rate = 2;
2696 shoot_parameters_proleptic.internode_length_max = 0.05;
2697 shoot_parameters_proleptic.internode_length_min = 0.03;
2698 shoot_parameters_proleptic.internode_length_decay_rate = 0.004;
2699 shoot_parameters_proleptic.fruit_set_probability = 0.25;
2700 shoot_parameters_proleptic.flower_bud_break_probability = 0.25;
2701 shoot_parameters_proleptic.max_terminal_floral_buds = 4;
2702 shoot_parameters_proleptic.flowers_require_dormancy =
true;
2703 shoot_parameters_proleptic.growth_requires_dormancy =
true;
2704 shoot_parameters_proleptic.determinate_shoot_growth =
false;
2705 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic"}, {1.0});
2708 ShootParameters shoot_parameters_scaffold = shoot_parameters_proleptic;
2710 shoot_parameters_scaffold.
max_nodes = 30;
2724 if (shoot_types.empty()) {
2726 initializeOliveTreeShoots();
2731 uint uID_trunk =
addBaseStemShoot(plantID, 19, make_AxisRotation(context_ptr->
randu(0.f, 0.025f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)),
2732 shoot_types.at(
"trunk").phytomer_parameters.internode.radius_initial.val(), 0.01, 1.f, 1.f, 0,
"trunk");
2733 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0, 0.01, 1, 1);
2735 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
2737 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
2738 for (
const auto &phytomer: phytomers) {
2739 phytomer->removeLeaf();
2740 phytomer->setVegetativeBudState(BUD_DEAD);
2741 phytomer->setFloralBudState(BUD_DEAD);
2744 uint Nscaffolds = 4;
2746 for (
int i = 0; i < Nscaffolds; i++) {
2748 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, context_ptr->
randu(5, 7), make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(Nscaffolds) * 2 * M_PI, 0), 0.007,
2749 shoot_types.at(
"scaffold").internode_length_max.val(), 1.f, 1.f, 0.5,
"scaffold", 0);
2755 plant_instances.at(plantID).max_age = 1825;
2760void PlantArchitecture::initializePistachioTreeShoots() {
2765 leaf_prototype.leaf_texture_file[0] =
"PistachioLeaf.png";
2766 leaf_prototype.leaf_aspect_ratio = 0.6f;
2767 leaf_prototype.midrib_fold_fraction = 0.;
2768 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.4, 0.4);
2769 leaf_prototype.lateral_curvature = 0.;
2770 leaf_prototype.wave_period = 0.3f;
2771 leaf_prototype.wave_amplitude = 0.1f;
2772 leaf_prototype.subdivisions = 3;
2773 leaf_prototype.unique_prototypes = 5;
2779 phytomer_parameters_pistachio.internode.pitch = 0;
2780 phytomer_parameters_pistachio.internode.phyllotactic_angle.uniformDistribution(160, 200);
2781 phytomer_parameters_pistachio.internode.radius_initial = 0.002;
2782 phytomer_parameters_pistachio.internode.length_segments = 1;
2783 phytomer_parameters_pistachio.internode.image_texture =
"OliveBark.jpg";
2784 phytomer_parameters_pistachio.internode.max_floral_buds_per_petiole = 3;
2786 phytomer_parameters_pistachio.petiole.petioles_per_internode = 1;
2787 phytomer_parameters_pistachio.petiole.pitch.uniformDistribution(-60, -45);
2788 phytomer_parameters_pistachio.petiole.taper = 0.1;
2789 phytomer_parameters_pistachio.petiole.curvature.uniformDistribution(-800, 800);
2790 phytomer_parameters_pistachio.petiole.length = 0.075;
2791 phytomer_parameters_pistachio.petiole.radius = 0.001;
2792 phytomer_parameters_pistachio.petiole.length_segments = 1;
2793 phytomer_parameters_pistachio.petiole.radial_subdivisions = 3;
2794 phytomer_parameters_pistachio.petiole.color =
make_RGBcolor(0.6, 0.6, 0.4);
2796 phytomer_parameters_pistachio.leaf.leaves_per_petiole = 3;
2797 phytomer_parameters_pistachio.leaf.prototype_scale = 0.08;
2798 phytomer_parameters_pistachio.leaf.leaflet_offset = 0.3;
2799 phytomer_parameters_pistachio.leaf.leaflet_scale = 0.75;
2800 phytomer_parameters_pistachio.leaf.pitch.uniformDistribution(-20, 20);
2801 phytomer_parameters_pistachio.leaf.roll.uniformDistribution(-20, 20);
2802 phytomer_parameters_pistachio.leaf.prototype = leaf_prototype;
2804 phytomer_parameters_pistachio.peduncle.length = 0.1;
2805 phytomer_parameters_pistachio.peduncle.radius = 0.001;
2806 phytomer_parameters_pistachio.peduncle.pitch = 60;
2807 phytomer_parameters_pistachio.peduncle.roll = 0;
2808 phytomer_parameters_pistachio.peduncle.length_segments = 1;
2809 phytomer_parameters_pistachio.peduncle.curvature.uniformDistribution(500, 900);
2810 phytomer_parameters_pistachio.peduncle.color =
make_RGBcolor(0.7, 0.72, 0.7);
2812 phytomer_parameters_pistachio.inflorescence.flowers_per_peduncle = 16;
2813 phytomer_parameters_pistachio.inflorescence.flower_offset = 0.08;
2814 phytomer_parameters_pistachio.inflorescence.pitch.uniformDistribution(50, 70);
2815 phytomer_parameters_pistachio.inflorescence.roll.uniformDistribution(0, 360);
2816 phytomer_parameters_pistachio.inflorescence.flower_prototype_scale = 0.025;
2818 phytomer_parameters_pistachio.inflorescence.fruit_prototype_scale = 0.025;
2819 phytomer_parameters_pistachio.inflorescence.fruit_prototype_function = PistachioFruitPrototype;
2840 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_pistachio;
2841 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = PistachioPhytomerCreationFunction;
2842 shoot_parameters_proleptic.phytomer_parameters.phytomer_callback_function = PistachioPhytomerCallbackFunction;
2843 shoot_parameters_proleptic.phytomer_parameters.internode.pitch.uniformDistribution(-15, 15);
2844 shoot_parameters_proleptic.max_nodes.uniformDistribution(16, 24);
2845 shoot_parameters_proleptic.max_nodes_per_season.uniformDistribution(8, 10);
2846 shoot_parameters_proleptic.phyllochron_min = 2.0;
2847 shoot_parameters_proleptic.elongation_rate_max = 0.25;
2848 shoot_parameters_proleptic.girth_area_factor = 7.f;
2849 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.1;
2850 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.7;
2851 shoot_parameters_proleptic.vegetative_bud_break_time = 0;
2852 shoot_parameters_proleptic.gravitropic_curvature = 350;
2853 shoot_parameters_proleptic.tortuosity = 2;
2854 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(45, 55);
2855 shoot_parameters_proleptic.insertion_angle_decay_rate = 10;
2856 shoot_parameters_proleptic.internode_length_max = 0.06;
2857 shoot_parameters_proleptic.internode_length_min = 0.02;
2858 shoot_parameters_proleptic.internode_length_decay_rate = 0.06;
2859 shoot_parameters_proleptic.fruit_set_probability = 0.2;
2860 shoot_parameters_proleptic.flower_bud_break_probability = 0.35;
2861 shoot_parameters_proleptic.max_terminal_floral_buds = 2;
2862 shoot_parameters_proleptic.flowers_require_dormancy =
true;
2863 shoot_parameters_proleptic.growth_requires_dormancy =
true;
2864 shoot_parameters_proleptic.determinate_shoot_growth =
false;
2870uint PlantArchitecture::buildPistachioTree(
const helios::vec3 &base_position) {
2872 if (shoot_types.empty()) {
2874 initializePistachioTreeShoots();
2878 auto trunk_height = getParameterValue(current_build_parameters,
"trunk_height", 1.0f, 0.1f, 3.f,
"total trunk height in meters");
2879 auto num_scaffolds =
uint(getParameterValue(current_build_parameters,
"num_scaffolds", 4.f, 2.f, 8.f,
"number of scaffold branches"));
2880 auto scaffold_angle = getParameterValue(current_build_parameters,
"scaffold_angle", 50.f, 20.f, 70.f,
"scaffold branch angle in degrees");
2883 float trunk_internode_length = 0.05f;
2884 uint trunk_nodes =
uint(trunk_height / trunk_internode_length);
2885 if (trunk_nodes < 1)
2889 float scaffold_radius = 0.007f;
2890 float scaffold_length = 0.03f;
2891 uint scaffold_nodes = 5;
2895 uint uID_trunk =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)),
2896 shoot_types.at(
"trunk").phytomer_parameters.internode.radius_initial.val(), trunk_internode_length, 1.f, 1.f, 0,
"trunk");
2897 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0, 0.01, 1, 1);
2899 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
2901 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
2902 for (
const auto &phytomer: phytomers) {
2903 phytomer->removeLeaf();
2904 phytomer->setVegetativeBudState(BUD_DEAD);
2905 phytomer->setFloralBudState(BUD_DEAD);
2908 float pitch =
deg2rad(scaffold_angle);
2910 if (num_scaffolds >= 1) {
2911 addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - 1, scaffold_nodes, make_AxisRotation(pitch + context_ptr->
randu(-0.15f, 0.15f), 0, 0.5 * M_PI + context_ptr->
randu(-0.2f, 0.2f)), scaffold_radius, scaffold_length, 1.f,
2912 1.f, 0.5,
"proleptic", 0);
2914 if (num_scaffolds >= 2) {
2915 addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - 1, scaffold_nodes, make_AxisRotation(pitch + context_ptr->
randu(-0.15f, 0.15f), M_PI, 0.5 * M_PI + context_ptr->
randu(-0.2f, 0.2f)), scaffold_radius, scaffold_length,
2916 1.f, 1.f, 0.5,
"proleptic", 0);
2918 if (num_scaffolds >= 3) {
2919 addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - 2, scaffold_nodes, make_AxisRotation(pitch + context_ptr->
randu(-0.15f, 0.15f), 0.5 * M_PI, 0.5 * M_PI + context_ptr->
randu(-0.2f, 0.2f)), scaffold_radius,
2920 scaffold_length, 1.f, 1.f, 0.5,
"proleptic", 0);
2922 if (num_scaffolds >= 4) {
2923 addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - 2, scaffold_nodes, make_AxisRotation(pitch + context_ptr->
randu(-0.15f, 0.15f), 1.5 * M_PI, 0.5 * M_PI + context_ptr->
randu(-0.2f, 0.2f)), scaffold_radius,
2924 scaffold_length, 1.f, 1.f, 0.5,
"proleptic", 0);
2931 plant_instances.at(plantID).max_age = 1460;
2936void PlantArchitecture::initializePuncturevineShoots() {
2941 leaf_prototype.leaf_texture_file[0] =
"PuncturevineLeaf.png";
2942 leaf_prototype.leaf_aspect_ratio = 0.4f;
2943 leaf_prototype.midrib_fold_fraction = 0.2f;
2944 leaf_prototype.longitudinal_curvature = -0.1f;
2945 leaf_prototype.lateral_curvature = 0.4f;
2946 leaf_prototype.subdivisions = 1;
2947 leaf_prototype.unique_prototypes = 1;
2953 phytomer_parameters_puncturevine.internode.pitch.uniformDistribution(0, 15);
2954 phytomer_parameters_puncturevine.internode.phyllotactic_angle = 180.f;
2955 phytomer_parameters_puncturevine.internode.radius_initial = 0.001;
2956 phytomer_parameters_puncturevine.internode.color =
make_RGBcolor(0.28, 0.18, 0.13);
2957 phytomer_parameters_puncturevine.internode.length_segments = 1;
2959 phytomer_parameters_puncturevine.petiole.petioles_per_internode = 1;
2960 phytomer_parameters_puncturevine.petiole.pitch.uniformDistribution(60, 80);
2961 phytomer_parameters_puncturevine.petiole.radius = 0.0005;
2962 phytomer_parameters_puncturevine.petiole.length = 0.03;
2963 phytomer_parameters_puncturevine.petiole.taper = 0;
2964 phytomer_parameters_puncturevine.petiole.curvature = 0;
2965 phytomer_parameters_puncturevine.petiole.color = phytomer_parameters_puncturevine.internode.color;
2966 phytomer_parameters_puncturevine.petiole.length_segments = 1;
2968 phytomer_parameters_puncturevine.leaf.leaves_per_petiole = 11;
2969 phytomer_parameters_puncturevine.leaf.pitch.uniformDistribution(0, 40);
2970 phytomer_parameters_puncturevine.leaf.yaw = 30;
2971 phytomer_parameters_puncturevine.leaf.roll.uniformDistribution(-5, 5);
2972 phytomer_parameters_puncturevine.leaf.prototype_scale = 0.012;
2973 phytomer_parameters_puncturevine.leaf.leaflet_offset = 0.18;
2974 phytomer_parameters_puncturevine.leaf.leaflet_scale = 1;
2975 phytomer_parameters_puncturevine.leaf.prototype = leaf_prototype;
2977 phytomer_parameters_puncturevine.peduncle.length = 0.001;
2978 phytomer_parameters_puncturevine.peduncle.color = phytomer_parameters_puncturevine.internode.color;
2980 phytomer_parameters_puncturevine.inflorescence.flowers_per_peduncle = 1;
2981 phytomer_parameters_puncturevine.inflorescence.pitch = -90.f;
2982 phytomer_parameters_puncturevine.inflorescence.flower_prototype_function = PuncturevineFlowerPrototype;
2983 phytomer_parameters_puncturevine.inflorescence.flower_prototype_scale = 0.01;
2988 shoot_parameters_primary.phytomer_parameters = phytomer_parameters_puncturevine;
2989 shoot_parameters_primary.vegetative_bud_break_probability_min = 0.1;
2990 shoot_parameters_primary.vegetative_bud_break_probability_decay_rate = 1.f;
2991 shoot_parameters_primary.vegetative_bud_break_time = 10;
2992 shoot_parameters_primary.base_roll = 90;
2993 shoot_parameters_primary.phyllochron_min = 1;
2994 shoot_parameters_primary.elongation_rate_max = 0.2;
2995 shoot_parameters_primary.girth_area_factor = 0.f;
2996 shoot_parameters_primary.internode_length_max = 0.02;
2997 shoot_parameters_primary.internode_length_decay_rate = 0;
2998 shoot_parameters_primary.insertion_angle_tip.uniformDistribution(75, 85);
2999 shoot_parameters_primary.insertion_angle_decay_rate = 0;
3000 shoot_parameters_primary.flowers_require_dormancy =
false;
3001 shoot_parameters_primary.growth_requires_dormancy =
false;
3002 shoot_parameters_primary.flower_bud_break_probability = 0.2;
3003 shoot_parameters_primary.determinate_shoot_growth =
false;
3004 shoot_parameters_primary.max_nodes = 15;
3005 shoot_parameters_primary.gravitropic_curvature = 25;
3006 shoot_parameters_primary.tortuosity = 0;
3007 shoot_parameters_primary.defineChildShootTypes({
"secondary_puncturevine"}, {1.f});
3027 shoot_parameters_base.
max_nodes.uniformDistribution(3, 5);
3031 shoot_parameters_children.
base_roll = 0;
3038uint PlantArchitecture::buildPuncturevinePlant(
const helios::vec3 &base_position) {
3040 if (shoot_types.empty()) {
3042 initializePuncturevineShoots();
3047 uint uID_stem =
addBaseStemShoot(plantID, 3, make_AxisRotation(0, 0.f, 0.f), 0.001, 0.001, 1, 1, 0,
"base_puncturevine");
3051 plant_instances.at(plantID).max_age = 45;
3058void PlantArchitecture::initializeEasternRedbudShoots() {
3063 leaf_prototype.leaf_texture_file[0] =
"RedbudLeaf.png";
3064 leaf_prototype.leaf_aspect_ratio = 1.f;
3065 leaf_prototype.midrib_fold_fraction = 0.2f;
3066 leaf_prototype.longitudinal_curvature = -0.15f;
3067 leaf_prototype.lateral_curvature = -0.1f;
3068 leaf_prototype.wave_period = 0.3f;
3069 leaf_prototype.wave_amplitude = 0.025f;
3070 leaf_prototype.subdivisions = 5;
3071 leaf_prototype.unique_prototypes = 5;
3072 leaf_prototype.leaf_offset =
make_vec3(-0.3, 0, 0);
3078 phytomer_parameters_redbud.internode.pitch = 15;
3079 phytomer_parameters_redbud.internode.phyllotactic_angle.uniformDistribution(170, 190);
3080 phytomer_parameters_redbud.internode.radius_initial = 0.0015;
3081 phytomer_parameters_redbud.internode.image_texture =
"WesternRedbudBark.jpg";
3082 phytomer_parameters_redbud.internode.color.scale(0.3);
3083 phytomer_parameters_redbud.internode.length_segments = 1;
3084 phytomer_parameters_redbud.internode.max_floral_buds_per_petiole = 5;
3086 phytomer_parameters_redbud.petiole.petioles_per_internode = 1;
3087 phytomer_parameters_redbud.petiole.color =
make_RGBcolor(0.65, 0.52, 0.39);
3088 phytomer_parameters_redbud.petiole.pitch.uniformDistribution(20, 40);
3089 phytomer_parameters_redbud.petiole.radius = 0.002;
3090 phytomer_parameters_redbud.petiole.length = 0.075;
3091 phytomer_parameters_redbud.petiole.taper = 0;
3092 phytomer_parameters_redbud.petiole.curvature = 0;
3093 phytomer_parameters_redbud.petiole.length_segments = 1;
3095 phytomer_parameters_redbud.leaf.leaves_per_petiole = 1;
3096 phytomer_parameters_redbud.leaf.pitch.uniformDistribution(-110, -80);
3097 phytomer_parameters_redbud.leaf.yaw = 0;
3098 phytomer_parameters_redbud.leaf.roll.uniformDistribution(-5, 5);
3099 phytomer_parameters_redbud.leaf.prototype_scale = 0.1;
3100 phytomer_parameters_redbud.leaf.prototype = leaf_prototype;
3102 phytomer_parameters_redbud.peduncle.length = 0.02;
3103 phytomer_parameters_redbud.peduncle.pitch.uniformDistribution(50, 90);
3104 phytomer_parameters_redbud.peduncle.color =
make_RGBcolor(0.32, 0.05, 0.13);
3106 phytomer_parameters_redbud.inflorescence.flowers_per_peduncle = 1;
3107 phytomer_parameters_redbud.inflorescence.pitch = 0;
3108 phytomer_parameters_redbud.inflorescence.flower_prototype_function = RedbudFlowerPrototype;
3109 phytomer_parameters_redbud.inflorescence.flower_prototype_scale = 0.04;
3110 phytomer_parameters_redbud.inflorescence.fruit_prototype_function = RedbudFruitPrototype;
3111 phytomer_parameters_redbud.inflorescence.fruit_prototype_scale = 0.1;
3112 phytomer_parameters_redbud.inflorescence.fruit_gravity_factor_fraction = 0.7;
3114 phytomer_parameters_redbud.phytomer_creation_function = RedbudPhytomerCreationFunction;
3115 phytomer_parameters_redbud.phytomer_callback_function = RedbudPhytomerCallbackFunction;
3120 shoot_parameters_main.phytomer_parameters = phytomer_parameters_redbud;
3121 shoot_parameters_main.vegetative_bud_break_probability_min = 1.0;
3122 shoot_parameters_main.vegetative_bud_break_time = 2;
3123 shoot_parameters_main.phyllochron_min = 2;
3124 shoot_parameters_main.elongation_rate_max = 0.1;
3125 shoot_parameters_main.girth_area_factor = 4.f;
3126 shoot_parameters_main.gravitropic_curvature = 300;
3127 shoot_parameters_main.tortuosity = 5;
3128 shoot_parameters_main.internode_length_max = 0.04;
3129 shoot_parameters_main.internode_length_decay_rate = 0.005;
3130 shoot_parameters_main.internode_length_min = 0.01;
3131 shoot_parameters_main.insertion_angle_tip = 75;
3132 shoot_parameters_main.insertion_angle_decay_rate = 10;
3133 shoot_parameters_main.flowers_require_dormancy =
true;
3134 shoot_parameters_main.growth_requires_dormancy =
true;
3135 shoot_parameters_main.determinate_shoot_growth =
false;
3136 shoot_parameters_main.max_terminal_floral_buds = 0;
3137 shoot_parameters_main.flower_bud_break_probability = 0.8;
3138 shoot_parameters_main.fruit_set_probability = 0.3;
3139 shoot_parameters_main.max_nodes = 25;
3140 shoot_parameters_main.max_nodes_per_season = 10;
3141 shoot_parameters_main.base_roll = 90;
3157uint PlantArchitecture::buildEasternRedbudPlant(
const helios::vec3 &base_position) {
3159 if (shoot_types.empty()) {
3161 initializeEasternRedbudShoots();
3166 uint uID_stem =
addBaseStemShoot(plantID, 16, make_AxisRotation(context_ptr->
randu(0, 0.1 * M_PI), context_ptr->
randu(0, 2 * M_PI), context_ptr->
randu(0, 2 * M_PI)), 0.0075, 0.05, 1, 1, 0.4,
"eastern_redbud_trunk");
3172 for (
auto &phytomer: this->plant_instances.at(plantID).shoot_tree.at(uID_stem)->phytomers) {
3173 if (phytomer->shoot_index.x < 12) {
3174 for (
auto &petiole: phytomer->axillary_vegetative_buds) {
3175 for (
auto &vbud: petiole) {
3176 phytomer->setVegetativeBudState(BUD_DEAD, vbud);
3184 plant_instances.at(plantID).max_age = 1460;
3189void PlantArchitecture::initializeRiceShoots() {
3194 leaf_prototype.leaf_texture_file[0] =
"SorghumLeaf.png";
3195 leaf_prototype.leaf_aspect_ratio = 0.06f;
3196 leaf_prototype.midrib_fold_fraction = 0.3f;
3197 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.2, 0);
3198 leaf_prototype.lateral_curvature = -0.3;
3199 leaf_prototype.wave_period = 0.1f;
3200 leaf_prototype.wave_amplitude = 0.1f;
3201 leaf_prototype.subdivisions = 20;
3202 leaf_prototype.unique_prototypes = 10;
3208 phytomer_parameters_rice.internode.pitch = 0;
3209 phytomer_parameters_rice.internode.phyllotactic_angle.uniformDistribution(67, 77);
3210 phytomer_parameters_rice.internode.radius_initial = 0.001;
3211 phytomer_parameters_rice.internode.color =
make_RGBcolor(0.27, 0.31, 0.16);
3212 phytomer_parameters_rice.internode.length_segments = 1;
3213 phytomer_parameters_rice.internode.radial_subdivisions = 6;
3214 phytomer_parameters_rice.internode.max_floral_buds_per_petiole = 0;
3215 phytomer_parameters_rice.internode.max_vegetative_buds_per_petiole = 0;
3217 phytomer_parameters_rice.petiole.petioles_per_internode = 1;
3218 phytomer_parameters_rice.petiole.pitch.uniformDistribution(-40, 0);
3219 phytomer_parameters_rice.petiole.radius = 0.0;
3220 phytomer_parameters_rice.petiole.length = 0.01;
3221 phytomer_parameters_rice.petiole.taper = 0;
3222 phytomer_parameters_rice.petiole.curvature = 0;
3223 phytomer_parameters_rice.petiole.length_segments = 1;
3225 phytomer_parameters_rice.leaf.leaves_per_petiole = 1;
3226 phytomer_parameters_rice.leaf.pitch = 0;
3227 phytomer_parameters_rice.leaf.yaw = 0;
3228 phytomer_parameters_rice.leaf.roll = 0;
3229 phytomer_parameters_rice.leaf.prototype_scale = 0.15;
3230 phytomer_parameters_rice.leaf.prototype = leaf_prototype;
3232 phytomer_parameters_rice.peduncle.pitch = 0;
3233 phytomer_parameters_rice.peduncle.length.uniformDistribution(0.14, 0.18);
3234 phytomer_parameters_rice.peduncle.radius = 0.0005;
3235 phytomer_parameters_rice.peduncle.color = phytomer_parameters_rice.internode.color;
3236 phytomer_parameters_rice.peduncle.curvature.uniformDistribution(-800, -50);
3237 phytomer_parameters_rice.peduncle.radial_subdivisions = 6;
3238 phytomer_parameters_rice.peduncle.length_segments = 8;
3240 phytomer_parameters_rice.inflorescence.flowers_per_peduncle = 60;
3241 phytomer_parameters_rice.inflorescence.pitch.uniformDistribution(20, 25);
3242 phytomer_parameters_rice.inflorescence.roll = 0;
3243 phytomer_parameters_rice.inflorescence.fruit_prototype_scale = 0.008;
3244 phytomer_parameters_rice.inflorescence.flower_offset = 0.012;
3245 phytomer_parameters_rice.inflorescence.fruit_prototype_function = RiceSpikePrototype;
3252 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters_rice;
3253 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0;
3254 shoot_parameters_mainstem.flower_bud_break_probability = 1;
3255 shoot_parameters_mainstem.phyllochron_min = 2;
3256 shoot_parameters_mainstem.elongation_rate_max = 0.1;
3257 shoot_parameters_mainstem.girth_area_factor = 5.f;
3258 shoot_parameters_mainstem.gravitropic_curvature.uniformDistribution(-1000, -400);
3259 shoot_parameters_mainstem.internode_length_max = 0.0075;
3260 shoot_parameters_mainstem.internode_length_decay_rate = 0;
3261 shoot_parameters_mainstem.flowers_require_dormancy =
false;
3262 shoot_parameters_mainstem.growth_requires_dormancy =
false;
3263 shoot_parameters_mainstem.determinate_shoot_growth =
false;
3264 shoot_parameters_mainstem.fruit_set_probability = 1.0;
3265 shoot_parameters_mainstem.defineChildShootTypes({
"mainstem"}, {1.0});
3266 shoot_parameters_mainstem.max_nodes = 30;
3267 shoot_parameters_mainstem.max_terminal_floral_buds = 5;
3274 if (shoot_types.empty()) {
3276 initializeRiceShoots();
3281 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(context_ptr->
randu(0.f, 0.1f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)), 0.001, 0.0075, 0.01, 0.01, 0,
"mainstem");
3287 plant_instances.at(plantID).max_age = 365;
3292void PlantArchitecture::initializeButterLettuceShoots() {
3295 leaf_prototype.leaf_texture_file[0] =
"RomaineLettuceLeaf.png";
3296 leaf_prototype.leaf_aspect_ratio = 0.85f;
3297 leaf_prototype.midrib_fold_fraction = 0.2f;
3298 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.2, 0.05);
3299 leaf_prototype.lateral_curvature = -0.4f;
3300 leaf_prototype.wave_period.uniformDistribution(0.15, 0.25);
3301 leaf_prototype.wave_amplitude.uniformDistribution(0.05, 0.1);
3302 leaf_prototype.subdivisions = 30;
3303 leaf_prototype.unique_prototypes = 10;
3309 phytomer_parameters.internode.pitch = 0;
3310 phytomer_parameters.internode.phyllotactic_angle = 137.5;
3311 phytomer_parameters.internode.radius_initial = 0.02;
3312 phytomer_parameters.internode.color =
make_RGBcolor(0.402, 0.423, 0.413);
3313 phytomer_parameters.internode.length_segments = 1;
3314 phytomer_parameters.internode.radial_subdivisions = 10;
3316 phytomer_parameters.petiole.petioles_per_internode = 1;
3317 phytomer_parameters.petiole.pitch.uniformDistribution(0, 30);
3318 phytomer_parameters.petiole.radius = 0.001;
3319 phytomer_parameters.petiole.length = 0.001;
3320 phytomer_parameters.petiole.length_segments = 1;
3321 phytomer_parameters.petiole.radial_subdivisions = 3;
3322 phytomer_parameters.petiole.color = RGB::red;
3324 phytomer_parameters.leaf.leaves_per_petiole = 1;
3325 phytomer_parameters.leaf.pitch = 10;
3326 phytomer_parameters.leaf.yaw = 0;
3327 phytomer_parameters.leaf.roll = 0;
3328 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.15, 0.25);
3329 phytomer_parameters.leaf.prototype = leaf_prototype;
3331 phytomer_parameters.phytomer_creation_function = ButterLettucePhytomerCreationFunction;
3336 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters;
3337 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0;
3338 shoot_parameters_mainstem.phyllochron_min = 2;
3339 shoot_parameters_mainstem.elongation_rate_max = 0.15;
3340 shoot_parameters_mainstem.girth_area_factor = 0.f;
3341 shoot_parameters_mainstem.gravitropic_curvature = 10;
3342 shoot_parameters_mainstem.internode_length_max = 0.001;
3343 shoot_parameters_mainstem.internode_length_decay_rate = 0;
3344 shoot_parameters_mainstem.flowers_require_dormancy =
false;
3345 shoot_parameters_mainstem.growth_requires_dormancy =
false;
3346 shoot_parameters_mainstem.flower_bud_break_probability = 0.0;
3347 shoot_parameters_mainstem.max_nodes = 25;
3352uint PlantArchitecture::buildButterLettucePlant(
const helios::vec3 &base_position) {
3354 if (shoot_types.empty()) {
3356 initializeButterLettuceShoots();
3361 uint uID_stem =
addBaseStemShoot(plantID, 3, make_AxisRotation(context_ptr->
randu(0.f, 0.03f * M_PI), 0.f, context_ptr->
randu(0.f, 2.f * M_PI)), 0.005, 0.001, 1, 1, 0,
"mainstem");
3367 plant_instances.at(plantID).max_age = 365;
3372void PlantArchitecture::initializeSorghumShoots() {
3377 leaf_prototype.leaf_texture_file[0] =
"SorghumLeaf.png";
3378 leaf_prototype.leaf_aspect_ratio = 0.2f;
3379 leaf_prototype.midrib_fold_fraction = 0.3f;
3380 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.4, -0.2);
3381 leaf_prototype.lateral_curvature = -0.3f;
3382 leaf_prototype.petiole_roll = 0.04f;
3383 leaf_prototype.wave_period = 0.1f;
3384 leaf_prototype.wave_amplitude = 0.1f;
3385 leaf_prototype.leaf_buckle_length.uniformDistribution(0.4, 0.6);
3386 leaf_prototype.leaf_buckle_angle.uniformDistribution(45, 55);
3387 leaf_prototype.subdivisions = 50;
3388 leaf_prototype.unique_prototypes = 10;
3394 phytomer_parameters_sorghum.internode.pitch = 0;
3395 phytomer_parameters_sorghum.internode.phyllotactic_angle.uniformDistribution(170, 190);
3396 phytomer_parameters_sorghum.internode.radius_initial = 0.003;
3397 phytomer_parameters_sorghum.internode.color =
make_RGBcolor(0.09, 0.13, 0.06);
3398 phytomer_parameters_sorghum.internode.length_segments = 2;
3399 phytomer_parameters_sorghum.internode.radial_subdivisions = 10;
3400 phytomer_parameters_sorghum.internode.max_floral_buds_per_petiole = 0;
3401 phytomer_parameters_sorghum.internode.max_vegetative_buds_per_petiole = 0;
3403 phytomer_parameters_sorghum.petiole.petioles_per_internode = 1;
3404 phytomer_parameters_sorghum.petiole.pitch.uniformDistribution(-40, -20);
3405 phytomer_parameters_sorghum.petiole.radius = 0.0;
3406 phytomer_parameters_sorghum.petiole.length = 0.05;
3407 phytomer_parameters_sorghum.petiole.taper = 0;
3408 phytomer_parameters_sorghum.petiole.curvature = 0;
3409 phytomer_parameters_sorghum.petiole.length_segments = 1;
3411 phytomer_parameters_sorghum.leaf.leaves_per_petiole = 1;
3412 phytomer_parameters_sorghum.leaf.pitch = 0;
3413 phytomer_parameters_sorghum.leaf.yaw = 0;
3414 phytomer_parameters_sorghum.leaf.roll = 0;
3415 phytomer_parameters_sorghum.leaf.prototype_scale = 0.6;
3416 phytomer_parameters_sorghum.leaf.prototype = leaf_prototype;
3418 phytomer_parameters_sorghum.peduncle.length = 0.3;
3419 phytomer_parameters_sorghum.peduncle.radius = 0.008;
3420 phytomer_parameters_sorghum.peduncle.color = phytomer_parameters_sorghum.internode.color;
3421 phytomer_parameters_sorghum.peduncle.radial_subdivisions = 10;
3423 phytomer_parameters_sorghum.inflorescence.flowers_per_peduncle = 1;
3424 phytomer_parameters_sorghum.inflorescence.pitch = 0;
3425 phytomer_parameters_sorghum.inflorescence.roll = 0;
3426 phytomer_parameters_sorghum.inflorescence.fruit_prototype_scale = 0.18;
3427 phytomer_parameters_sorghum.inflorescence.fruit_prototype_function = SorghumPaniclePrototype;
3429 phytomer_parameters_sorghum.phytomer_creation_function = SorghumPhytomerCreationFunction;
3434 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters_sorghum;
3435 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0;
3436 shoot_parameters_mainstem.flower_bud_break_probability = 1;
3437 shoot_parameters_mainstem.phyllochron_min = 2;
3438 shoot_parameters_mainstem.elongation_rate_max = 0.1;
3439 shoot_parameters_mainstem.girth_area_factor = 5.f;
3440 shoot_parameters_mainstem.gravitropic_curvature.uniformDistribution(-1000, -400);
3441 shoot_parameters_mainstem.internode_length_max = 0.26;
3442 shoot_parameters_mainstem.internode_length_decay_rate = 0;
3443 shoot_parameters_mainstem.flowers_require_dormancy =
false;
3444 shoot_parameters_mainstem.growth_requires_dormancy =
false;
3445 shoot_parameters_mainstem.determinate_shoot_growth =
false;
3446 shoot_parameters_mainstem.flower_bud_break_probability = 1.0;
3447 shoot_parameters_mainstem.fruit_set_probability = 1.0;
3448 shoot_parameters_mainstem.defineChildShootTypes({
"mainstem"}, {1.0});
3449 shoot_parameters_mainstem.max_nodes = 16;
3450 shoot_parameters_mainstem.max_terminal_floral_buds = 1;
3455uint PlantArchitecture::buildSorghumPlant(
const helios::vec3 &base_position) {
3457 if (shoot_types.empty()) {
3459 initializeSorghumShoots();
3464 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(context_ptr->
randu(0.f, 0.075f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)), 0.003, 0.06, 0.01, 0.01, 0,
"mainstem");
3470 plant_instances.at(plantID).max_age = 365;
3475void PlantArchitecture::initializeSoybeanShoots() {
3480 leaf_prototype.leaf_texture_file[0] =
"SoybeanLeaf.png";
3481 leaf_prototype.leaf_aspect_ratio = 1.f;
3482 leaf_prototype.midrib_fold_fraction = 0.1f;
3483 leaf_prototype.longitudinal_curvature.uniformDistribution(0.1, 0.2);
3484 leaf_prototype.lateral_curvature = 0.45;
3485 leaf_prototype.subdivisions = 8;
3486 leaf_prototype.unique_prototypes = 5;
3487 leaf_prototype.build_petiolule =
true;
3491 phytomer_parameters_trifoliate.internode.pitch = 20;
3492 phytomer_parameters_trifoliate.internode.phyllotactic_angle.uniformDistribution(145, 215);
3493 phytomer_parameters_trifoliate.internode.radius_initial = 0.002;
3494 phytomer_parameters_trifoliate.internode.max_floral_buds_per_petiole = 1;
3495 phytomer_parameters_trifoliate.internode.max_vegetative_buds_per_petiole = 1;
3496 phytomer_parameters_trifoliate.internode.color =
make_RGBcolor(0.2, 0.25, 0.05);
3497 phytomer_parameters_trifoliate.internode.length_segments = 5;
3499 phytomer_parameters_trifoliate.petiole.petioles_per_internode = 1;
3500 phytomer_parameters_trifoliate.petiole.pitch.uniformDistribution(15, 40);
3501 phytomer_parameters_trifoliate.petiole.radius = 0.002;
3502 phytomer_parameters_trifoliate.petiole.length.uniformDistribution(0.12, 0.16);
3503 phytomer_parameters_trifoliate.petiole.taper = 0.25;
3504 phytomer_parameters_trifoliate.petiole.curvature.uniformDistribution(-250, 50);
3505 phytomer_parameters_trifoliate.petiole.color = phytomer_parameters_trifoliate.internode.color;
3506 phytomer_parameters_trifoliate.petiole.length_segments = 5;
3507 phytomer_parameters_trifoliate.petiole.radial_subdivisions = 6;
3509 phytomer_parameters_trifoliate.leaf.leaves_per_petiole = 3;
3510 phytomer_parameters_trifoliate.leaf.pitch.uniformDistribution(-30, 10);
3511 phytomer_parameters_trifoliate.leaf.yaw = 10;
3512 phytomer_parameters_trifoliate.leaf.roll.uniformDistribution(-25, 5);
3513 phytomer_parameters_trifoliate.leaf.leaflet_offset = 0.5;
3514 phytomer_parameters_trifoliate.leaf.leaflet_scale = 0.9;
3515 phytomer_parameters_trifoliate.leaf.prototype_scale.uniformDistribution(0.1, 0.14);
3516 phytomer_parameters_trifoliate.leaf.prototype = leaf_prototype;
3518 phytomer_parameters_trifoliate.peduncle.length = 0.01;
3519 phytomer_parameters_trifoliate.peduncle.radius = 0.0005;
3520 phytomer_parameters_trifoliate.peduncle.pitch.uniformDistribution(0, 40);
3521 phytomer_parameters_trifoliate.peduncle.roll = 90;
3522 phytomer_parameters_trifoliate.peduncle.curvature.uniformDistribution(-500, 500);
3523 phytomer_parameters_trifoliate.peduncle.color = phytomer_parameters_trifoliate.internode.color;
3524 phytomer_parameters_trifoliate.peduncle.length_segments = 1;
3525 phytomer_parameters_trifoliate.peduncle.radial_subdivisions = 6;
3527 phytomer_parameters_trifoliate.inflorescence.flowers_per_peduncle.uniformDistribution(1, 4);
3528 phytomer_parameters_trifoliate.inflorescence.flower_offset = 0.2;
3529 phytomer_parameters_trifoliate.inflorescence.pitch.uniformDistribution(50, 70);
3530 phytomer_parameters_trifoliate.inflorescence.roll.uniformDistribution(-20, 20);
3531 phytomer_parameters_trifoliate.inflorescence.flower_prototype_scale = 0.015;
3532 phytomer_parameters_trifoliate.inflorescence.flower_prototype_function = SoybeanFlowerPrototype;
3533 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_scale.uniformDistribution(0.1, 0.12);
3534 phytomer_parameters_trifoliate.inflorescence.fruit_prototype_function = SoybeanFruitPrototype;
3535 phytomer_parameters_trifoliate.inflorescence.fruit_gravity_factor_fraction.uniformDistribution(0.8, 1.0);
3538 phytomer_parameters_unifoliate.
internode.pitch = 0;
3539 phytomer_parameters_unifoliate.
internode.max_vegetative_buds_per_petiole = 0;
3540 phytomer_parameters_unifoliate.
internode.max_floral_buds_per_petiole = 0;
3541 phytomer_parameters_unifoliate.
petiole.petioles_per_internode = 2;
3542 phytomer_parameters_unifoliate.
petiole.length = 0.01;
3543 phytomer_parameters_unifoliate.
petiole.radius = 0.001;
3544 phytomer_parameters_unifoliate.
petiole.pitch.uniformDistribution(60, 80);
3545 phytomer_parameters_unifoliate.
leaf.leaves_per_petiole = 1;
3546 phytomer_parameters_unifoliate.
leaf.prototype_scale = 0.02;
3547 phytomer_parameters_unifoliate.
leaf.pitch.uniformDistribution(-10, 10);
3548 phytomer_parameters_unifoliate.
leaf.prototype = leaf_prototype;
3553 shoot_parameters_trifoliate.phytomer_parameters = phytomer_parameters_trifoliate;
3554 shoot_parameters_trifoliate.phytomer_parameters.phytomer_creation_function = BeanPhytomerCreationFunction;
3556 shoot_parameters_trifoliate.max_nodes = 25;
3557 shoot_parameters_trifoliate.insertion_angle_tip.uniformDistribution(20, 30);
3559 shoot_parameters_trifoliate.internode_length_max = 0.035;
3562 shoot_parameters_trifoliate.base_roll = 90;
3563 shoot_parameters_trifoliate.base_yaw.uniformDistribution(-20, 20);
3564 shoot_parameters_trifoliate.gravitropic_curvature = 400;
3566 shoot_parameters_trifoliate.phyllochron_min = 2;
3567 shoot_parameters_trifoliate.elongation_rate_max = 0.1;
3568 shoot_parameters_trifoliate.girth_area_factor = 2.f;
3569 shoot_parameters_trifoliate.vegetative_bud_break_time = 15;
3570 shoot_parameters_trifoliate.vegetative_bud_break_probability_min = 0.05;
3571 shoot_parameters_trifoliate.vegetative_bud_break_probability_decay_rate = 0.6;
3573 shoot_parameters_trifoliate.flower_bud_break_probability.uniformDistribution(0.8, 1.0);
3574 shoot_parameters_trifoliate.fruit_set_probability = 0.4;
3579 shoot_parameters_trifoliate.defineChildShootTypes({
"trifoliate"}, {1.0});
3582 ShootParameters shoot_parameters_unifoliate = shoot_parameters_trifoliate;
3584 shoot_parameters_unifoliate.
max_nodes = 1;
3595uint PlantArchitecture::buildSoybeanPlant(
const helios::vec3 &base_position) {
3597 if (shoot_types.empty()) {
3599 initializeSoybeanShoots();
3604 AxisRotation base_rotation = make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
3605 uint uID_unifoliate =
addBaseStemShoot(plantID, 1, base_rotation, 0.0005, 0.04, 0.01, 0.01, 0,
"unifoliate");
3607 appendShoot(plantID, uID_unifoliate, 1, make_AxisRotation(0, 0, 0.5f * M_PI), shoot_types.at(
"trifoliate").phytomer_parameters.internode.radius_initial.val(), shoot_types.at(
"trifoliate").internode_length_max.val(), 0.1, 0.1, 0,
"trifoliate");
3613 plant_instances.at(plantID).max_age = 365;
3618void PlantArchitecture::initializeStrawberryShoots() {
3623 leaf_prototype.leaf_texture_file[0] =
"StrawberryLeaf.png";
3624 leaf_prototype.leaf_aspect_ratio = 1.f;
3625 leaf_prototype.midrib_fold_fraction = 0.2f;
3626 leaf_prototype.longitudinal_curvature = 0.15f;
3627 leaf_prototype.lateral_curvature = -0.35f;
3628 leaf_prototype.wave_period = 0.4f;
3629 leaf_prototype.wave_amplitude = 0.03f;
3630 leaf_prototype.subdivisions = 6;
3631 leaf_prototype.unique_prototypes = 10;
3637 phytomer_parameters.internode.pitch = 10;
3638 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(80, 100);
3639 phytomer_parameters.internode.radius_initial = 0.001;
3640 phytomer_parameters.internode.color =
make_RGBcolor(0.15, 0.2, 0.1);
3641 phytomer_parameters.internode.length_segments = 1;
3643 phytomer_parameters.petiole.petioles_per_internode = 1;
3644 phytomer_parameters.petiole.pitch.uniformDistribution(10, 45);
3645 phytomer_parameters.petiole.radius = 0.0025;
3646 phytomer_parameters.petiole.length.uniformDistribution(0.15, 0.35);
3647 phytomer_parameters.petiole.taper = 0.5;
3648 phytomer_parameters.petiole.curvature.uniformDistribution(-150, -50);
3649 phytomer_parameters.petiole.color =
make_RGBcolor(0.18, 0.23, 0.1);
3650 phytomer_parameters.petiole.length_segments = 5;
3652 phytomer_parameters.leaf.leaves_per_petiole = 3;
3653 phytomer_parameters.leaf.pitch.uniformDistribution(-35, 0);
3654 phytomer_parameters.leaf.yaw = -30;
3655 phytomer_parameters.leaf.roll = -30;
3656 phytomer_parameters.leaf.leaflet_offset = 0.01;
3657 phytomer_parameters.leaf.leaflet_scale = 1.0;
3658 phytomer_parameters.leaf.prototype_scale = 0.12;
3659 phytomer_parameters.leaf.prototype = leaf_prototype;
3661 phytomer_parameters.peduncle.length.uniformDistribution(0.16, 0.2);
3662 phytomer_parameters.peduncle.radius = 0.0018;
3663 phytomer_parameters.peduncle.pitch.uniformDistribution(35, 55);
3664 phytomer_parameters.peduncle.roll = 90;
3665 phytomer_parameters.peduncle.curvature = -150;
3666 phytomer_parameters.peduncle.length_segments = 5;
3667 phytomer_parameters.peduncle.radial_subdivisions = 6;
3668 phytomer_parameters.peduncle.color = phytomer_parameters.petiole.color;
3670 phytomer_parameters.inflorescence.flowers_per_peduncle = 1;
3671 phytomer_parameters.inflorescence.flower_offset = 0.2;
3672 phytomer_parameters.inflorescence.pitch = 70;
3673 phytomer_parameters.inflorescence.roll = 90;
3674 phytomer_parameters.inflorescence.flower_prototype_scale = 0.04;
3675 phytomer_parameters.inflorescence.flower_prototype_function = StrawberryFlowerPrototype;
3676 phytomer_parameters.inflorescence.fruit_prototype_scale = 0.085;
3677 phytomer_parameters.inflorescence.fruit_prototype_function = StrawberryFruitPrototype;
3678 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction = 0.65;
3683 shoot_parameters.phytomer_parameters = phytomer_parameters;
3685 shoot_parameters.max_nodes = 15;
3686 shoot_parameters.insertion_angle_tip = 40;
3687 shoot_parameters.insertion_angle_decay_rate = 0;
3688 shoot_parameters.internode_length_max = 0.015;
3689 shoot_parameters.internode_length_decay_rate = 0;
3690 shoot_parameters.internode_length_min = 0.0;
3691 shoot_parameters.base_roll = 90;
3692 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
3693 shoot_parameters.gravitropic_curvature.uniformDistribution(-10, 0);
3694 shoot_parameters.tortuosity = 0;
3696 shoot_parameters.phyllochron_min = 2;
3697 shoot_parameters.elongation_rate_max = 0.1;
3698 shoot_parameters.girth_area_factor = 2.f;
3699 shoot_parameters.vegetative_bud_break_time = 15;
3700 shoot_parameters.vegetative_bud_break_probability_min = 0.;
3701 shoot_parameters.vegetative_bud_break_probability_decay_rate = -0.5;
3702 shoot_parameters.flower_bud_break_probability = 1;
3703 shoot_parameters.fruit_set_probability = 0.3;
3704 shoot_parameters.flowers_require_dormancy =
false;
3705 shoot_parameters.growth_requires_dormancy =
false;
3706 shoot_parameters.determinate_shoot_growth =
true;
3708 shoot_parameters.defineChildShootTypes({
"mainstem"}, {1.0});
3713uint PlantArchitecture::buildStrawberryPlant(
const helios::vec3 &base_position) {
3715 if (shoot_types.empty()) {
3717 initializeStrawberryShoots();
3722 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
3723 uint uID_stem =
addBaseStemShoot(plantID, 1, base_rotation, 0.001, 0.004, 0.01, 0.01, 0,
"mainstem");
3729 plant_instances.at(plantID).max_age = 120;
3734void PlantArchitecture::initializeSugarbeetShoots() {
3739 leaf_prototype.leaf_texture_file[0] =
"SugarbeetLeaf.png";
3740 leaf_prototype.leaf_aspect_ratio = 0.4f;
3741 leaf_prototype.midrib_fold_fraction = 0.1f;
3742 leaf_prototype.longitudinal_curvature = -0.2f;
3743 leaf_prototype.lateral_curvature = -0.4f;
3744 leaf_prototype.petiole_roll = 0.75f;
3745 leaf_prototype.wave_period.uniformDistribution(0.08f, 0.15f);
3746 leaf_prototype.wave_amplitude.uniformDistribution(0.02, 0.04);
3747 leaf_prototype.subdivisions = 20;
3749 leaf_prototype.unique_prototypes = 10;
3755 phytomer_parameters_sugarbeet.internode.pitch = 0;
3756 phytomer_parameters_sugarbeet.internode.phyllotactic_angle = 137.5;
3757 phytomer_parameters_sugarbeet.internode.radius_initial = 0.005;
3758 phytomer_parameters_sugarbeet.internode.color =
make_RGBcolor(0.44, 0.58, 0.19);
3759 phytomer_parameters_sugarbeet.internode.length_segments = 1;
3760 phytomer_parameters_sugarbeet.internode.max_vegetative_buds_per_petiole = 0;
3761 phytomer_parameters_sugarbeet.internode.max_floral_buds_per_petiole = 0;
3763 phytomer_parameters_sugarbeet.petiole.petioles_per_internode = 1;
3764 phytomer_parameters_sugarbeet.petiole.pitch.uniformDistribution(0, 40);
3765 phytomer_parameters_sugarbeet.petiole.radius = 0.005;
3766 phytomer_parameters_sugarbeet.petiole.length.uniformDistribution(0.15, 0.2);
3767 phytomer_parameters_sugarbeet.petiole.taper = 0.6;
3768 phytomer_parameters_sugarbeet.petiole.curvature.uniformDistribution(-300, 100);
3769 phytomer_parameters_sugarbeet.petiole.color = phytomer_parameters_sugarbeet.internode.color;
3770 phytomer_parameters_sugarbeet.petiole.length_segments = 8;
3772 phytomer_parameters_sugarbeet.leaf.leaves_per_petiole = 1;
3773 phytomer_parameters_sugarbeet.leaf.pitch.uniformDistribution(-10, 0);
3774 phytomer_parameters_sugarbeet.leaf.yaw.uniformDistribution(-5, 5);
3775 phytomer_parameters_sugarbeet.leaf.roll.uniformDistribution(-15, 15);
3776 phytomer_parameters_sugarbeet.leaf.prototype_scale.uniformDistribution(0.15, 0.25);
3777 phytomer_parameters_sugarbeet.leaf.prototype = leaf_prototype;
3782 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters_sugarbeet;
3783 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0;
3784 shoot_parameters_mainstem.phyllochron_min = 2;
3785 shoot_parameters_mainstem.elongation_rate_max = 0.1;
3786 shoot_parameters_mainstem.girth_area_factor = 20.f;
3787 shoot_parameters_mainstem.gravitropic_curvature = 10;
3788 shoot_parameters_mainstem.internode_length_max = 0.001;
3789 shoot_parameters_mainstem.internode_length_decay_rate = 0;
3790 shoot_parameters_mainstem.flowers_require_dormancy =
false;
3791 shoot_parameters_mainstem.growth_requires_dormancy =
false;
3792 shoot_parameters_mainstem.flower_bud_break_probability = 0.0;
3793 shoot_parameters_mainstem.max_nodes = 30;
3798uint PlantArchitecture::buildSugarbeetPlant(
const helios::vec3 &base_position) {
3800 if (shoot_types.empty()) {
3802 initializeSugarbeetShoots();
3807 uint uID_stem =
addBaseStemShoot(plantID, 3, make_AxisRotation(context_ptr->
randu(0.f, 0.01f * M_PI), 0.f * context_ptr->
randu(0.f, 2.f * M_PI), 0.25f * M_PI), 0.005, 0.001, 1, 1, 0,
"mainstem");
3813 plant_instances.at(plantID).max_age = 365;
3818void PlantArchitecture::initializeTomatoShoots() {
3823 leaf_prototype.leaf_texture_file[0] =
"TomatoLeaf_centered.png";
3824 leaf_prototype.leaf_aspect_ratio = 0.5f;
3825 leaf_prototype.midrib_fold_fraction = 0.1f;
3826 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.45, -0.2f);
3827 leaf_prototype.lateral_curvature = -0.3f;
3828 leaf_prototype.wave_period = 0.35f;
3829 leaf_prototype.wave_amplitude = 0.08f;
3830 leaf_prototype.subdivisions = 6;
3831 leaf_prototype.unique_prototypes = 5;
3837 phytomer_parameters.internode.pitch = 10;
3838 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(140, 220);
3839 phytomer_parameters.internode.radius_initial = 0.001;
3840 phytomer_parameters.internode.color =
make_RGBcolor(0.2495, 0.3162, 0.0657);
3841 phytomer_parameters.internode.length_segments = 1;
3843 phytomer_parameters.petiole.petioles_per_internode = 1;
3844 phytomer_parameters.petiole.pitch.uniformDistribution(45, 60);
3845 phytomer_parameters.petiole.radius = 0.002;
3846 phytomer_parameters.petiole.length = 0.2;
3847 phytomer_parameters.petiole.taper = 0.25;
3848 phytomer_parameters.petiole.curvature.uniformDistribution(-150, -50);
3849 phytomer_parameters.petiole.color =
make_RGBcolor(0.3, 0.37, 0.0657);
3850 phytomer_parameters.petiole.length_segments = 5;
3852 phytomer_parameters.leaf.leaves_per_petiole = 7;
3853 phytomer_parameters.leaf.pitch.uniformDistribution(-30, 5);
3854 phytomer_parameters.leaf.yaw = 10;
3855 phytomer_parameters.leaf.roll = 0;
3856 phytomer_parameters.leaf.leaflet_offset = 0.15;
3857 phytomer_parameters.leaf.leaflet_scale = 0.7;
3858 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.12, 0.18);
3859 phytomer_parameters.leaf.prototype = leaf_prototype;
3861 phytomer_parameters.peduncle.length = 0.18;
3862 phytomer_parameters.peduncle.radius = 0.0015;
3863 phytomer_parameters.peduncle.pitch = 20;
3864 phytomer_parameters.peduncle.roll = 0;
3865 phytomer_parameters.peduncle.curvature = -900;
3866 phytomer_parameters.peduncle.color = phytomer_parameters.internode.color;
3867 phytomer_parameters.peduncle.length_segments = 5;
3868 phytomer_parameters.peduncle.radial_subdivisions = 8;
3870 phytomer_parameters.inflorescence.flowers_per_peduncle = 6;
3871 phytomer_parameters.inflorescence.flower_offset = 0.15;
3872 phytomer_parameters.inflorescence.pitch = 80;
3873 phytomer_parameters.inflorescence.roll = 180;
3874 phytomer_parameters.inflorescence.flower_prototype_scale = 0.05;
3875 phytomer_parameters.inflorescence.flower_prototype_function = TomatoFlowerPrototype;
3876 phytomer_parameters.inflorescence.fruit_prototype_scale = 0.15;
3877 phytomer_parameters.inflorescence.fruit_prototype_function = TomatoFruitPrototype;
3878 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction = 0.;
3883 shoot_parameters.phytomer_parameters = phytomer_parameters;
3884 shoot_parameters.phytomer_parameters.phytomer_creation_function = TomatoPhytomerCreationFunction;
3886 shoot_parameters.max_nodes = 16;
3887 shoot_parameters.insertion_angle_tip = 30;
3888 shoot_parameters.insertion_angle_decay_rate = 0;
3889 shoot_parameters.internode_length_max = 0.04;
3890 shoot_parameters.internode_length_min = 0.0;
3891 shoot_parameters.internode_length_decay_rate = 0;
3892 shoot_parameters.base_roll = 90;
3893 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
3894 shoot_parameters.gravitropic_curvature = 150;
3895 shoot_parameters.tortuosity = 3;
3897 shoot_parameters.phyllochron_min = 2;
3898 shoot_parameters.elongation_rate_max = 0.1;
3899 shoot_parameters.girth_area_factor = 2.f;
3900 shoot_parameters.vegetative_bud_break_time = 30;
3901 shoot_parameters.vegetative_bud_break_probability_min = 0.25;
3902 shoot_parameters.vegetative_bud_break_probability_decay_rate = -0.25;
3903 shoot_parameters.flower_bud_break_probability = 0.2;
3904 shoot_parameters.fruit_set_probability = 0.8;
3905 shoot_parameters.flowers_require_dormancy =
false;
3906 shoot_parameters.growth_requires_dormancy =
false;
3907 shoot_parameters.determinate_shoot_growth =
true;
3909 shoot_parameters.defineChildShootTypes({
"mainstem"}, {1.0});
3914uint PlantArchitecture::buildTomatoPlant(
const helios::vec3 &base_position) {
3916 if (shoot_types.empty()) {
3918 initializeTomatoShoots();
3923 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
3924 uint uID_stem =
addBaseStemShoot(plantID, 1, base_rotation, 0.002, 0.04, 0.01, 0.01, 0,
"mainstem");
3930 plant_instances.at(plantID).max_age = 365;
3935void PlantArchitecture::initializeCherryTomatoShoots() {
3940 leaf_prototype.leaf_texture_file[0] =
"CherryTomatoLeaf.png";
3941 leaf_prototype.leaf_aspect_ratio = 0.6f;
3942 leaf_prototype.midrib_fold_fraction = 0.1f;
3943 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.3, -0.15f);
3944 leaf_prototype.lateral_curvature = -0.8f;
3945 leaf_prototype.wave_period = 0.35f;
3946 leaf_prototype.wave_amplitude = 0.08f;
3947 leaf_prototype.subdivisions = 7;
3948 leaf_prototype.unique_prototypes = 5;
3954 phytomer_parameters.internode.pitch = 5;
3955 phytomer_parameters.internode.phyllotactic_angle.uniformDistribution(14, 220);
3956 phytomer_parameters.internode.radius_initial = 0.001;
3957 phytomer_parameters.internode.color =
make_RGBcolor(0.2495, 0.3162, 0.0657);
3958 phytomer_parameters.internode.length_segments = 1;
3959 phytomer_parameters.internode.radial_subdivisions = 14;
3961 phytomer_parameters.petiole.petioles_per_internode = 1;
3962 phytomer_parameters.petiole.pitch.uniformDistribution(45, 60);
3963 phytomer_parameters.petiole.radius = 0.0025;
3964 phytomer_parameters.petiole.length = 0.25;
3965 phytomer_parameters.petiole.taper = 0.25;
3966 phytomer_parameters.petiole.curvature.uniformDistribution(-250, 0);
3967 phytomer_parameters.petiole.color =
make_RGBcolor(0.32, 0.37, 0.12);
3968 phytomer_parameters.petiole.length_segments = 5;
3970 phytomer_parameters.leaf.leaves_per_petiole = 9;
3971 phytomer_parameters.leaf.pitch.uniformDistribution(-30, 5);
3972 phytomer_parameters.leaf.yaw = 10;
3973 phytomer_parameters.leaf.roll.uniformDistribution(-20, 20);
3974 phytomer_parameters.leaf.leaflet_offset = 0.22;
3975 phytomer_parameters.leaf.leaflet_scale = 0.9;
3976 phytomer_parameters.leaf.prototype_scale.uniformDistribution(0.12, 0.17);
3977 phytomer_parameters.leaf.prototype = leaf_prototype;
3979 phytomer_parameters.peduncle.length = 0.2;
3980 phytomer_parameters.peduncle.radius = 0.0015;
3981 phytomer_parameters.peduncle.pitch = 20;
3982 phytomer_parameters.peduncle.roll = 0;
3983 phytomer_parameters.peduncle.curvature = -1000;
3984 phytomer_parameters.peduncle.color = phytomer_parameters.internode.color;
3985 phytomer_parameters.peduncle.length_segments = 5;
3986 phytomer_parameters.peduncle.radial_subdivisions = 8;
3988 phytomer_parameters.inflorescence.flowers_per_peduncle = 6;
3989 phytomer_parameters.inflorescence.flower_offset = 0.15;
3990 phytomer_parameters.inflorescence.pitch = 80;
3991 phytomer_parameters.inflorescence.roll = 180;
3992 phytomer_parameters.inflorescence.flower_prototype_scale = 0.05;
3993 phytomer_parameters.inflorescence.flower_prototype_function = TomatoFlowerPrototype;
3994 phytomer_parameters.inflorescence.fruit_prototype_scale = 0.1;
3995 phytomer_parameters.inflorescence.fruit_prototype_function = TomatoFruitPrototype;
3996 phytomer_parameters.inflorescence.fruit_gravity_factor_fraction = 0.2;
4001 shoot_parameters.phytomer_parameters = phytomer_parameters;
4002 shoot_parameters.phytomer_parameters.phytomer_creation_function = CherryTomatoPhytomerCreationFunction;
4003 shoot_parameters.phytomer_parameters.phytomer_callback_function = CherryTomatoPhytomerCallbackFunction;
4005 shoot_parameters.max_nodes = 100;
4006 shoot_parameters.insertion_angle_tip = 30;
4007 shoot_parameters.insertion_angle_decay_rate = 0;
4008 shoot_parameters.internode_length_max = 0.04;
4009 shoot_parameters.internode_length_min = 0.0;
4010 shoot_parameters.internode_length_decay_rate = 0;
4011 shoot_parameters.base_roll = 90;
4012 shoot_parameters.base_yaw.uniformDistribution(-20, 20);
4013 shoot_parameters.gravitropic_curvature = 800;
4014 shoot_parameters.tortuosity = 1.5;
4016 shoot_parameters.phyllochron_min = 4;
4017 shoot_parameters.elongation_rate_max = 0.1;
4018 shoot_parameters.girth_area_factor = 2.f;
4019 shoot_parameters.vegetative_bud_break_time = 40;
4020 shoot_parameters.vegetative_bud_break_probability_min = 0.2;
4021 shoot_parameters.vegetative_bud_break_probability_decay_rate = 0.;
4022 shoot_parameters.flower_bud_break_probability = 0.5;
4023 shoot_parameters.fruit_set_probability = 0.9;
4024 shoot_parameters.flowers_require_dormancy =
false;
4025 shoot_parameters.growth_requires_dormancy =
false;
4026 shoot_parameters.determinate_shoot_growth =
false;
4028 shoot_parameters.defineChildShootTypes({
"mainstem"}, {1.0});
4033uint PlantArchitecture::buildCherryTomatoPlant(
const helios::vec3 &base_position) {
4035 if (shoot_types.empty()) {
4037 initializeCherryTomatoShoots();
4042 AxisRotation base_rotation = make_AxisRotation(0, context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI));
4043 uint uID_stem =
addBaseStemShoot(plantID, 1, base_rotation, 0.002, 0.06, 0.01, 0.01, 0,
"mainstem");
4049 plant_instances.at(plantID).max_age = 175;
4054void PlantArchitecture::initializeWalnutTreeShoots() {
4059 leaf_prototype.leaf_texture_file[0] =
"WalnutLeaf.png";
4060 leaf_prototype.leaf_aspect_ratio = 0.5f;
4061 leaf_prototype.midrib_fold_fraction = 0.15f;
4062 leaf_prototype.longitudinal_curvature = -0.2f;
4063 leaf_prototype.lateral_curvature = 0.1f;
4064 leaf_prototype.wave_period.uniformDistribution(0.08, 0.15);
4065 leaf_prototype.wave_amplitude.uniformDistribution(0.02, 0.04);
4066 leaf_prototype.subdivisions = 3;
4067 leaf_prototype.unique_prototypes = 5;
4073 phytomer_parameters_walnut.internode.pitch = 0;
4074 phytomer_parameters_walnut.internode.phyllotactic_angle.uniformDistribution(160, 200);
4075 phytomer_parameters_walnut.internode.radius_initial = 0.004;
4076 phytomer_parameters_walnut.internode.length_segments = 1;
4077 phytomer_parameters_walnut.internode.image_texture =
"AppleBark.jpg";
4078 phytomer_parameters_walnut.internode.max_floral_buds_per_petiole = 3;
4080 phytomer_parameters_walnut.petiole.petioles_per_internode = 1;
4081 phytomer_parameters_walnut.petiole.pitch.uniformDistribution(-80, -70);
4082 phytomer_parameters_walnut.petiole.taper = 0.2;
4083 phytomer_parameters_walnut.petiole.curvature.uniformDistribution(-1000, 0);
4084 phytomer_parameters_walnut.petiole.length = 0.15;
4085 phytomer_parameters_walnut.petiole.radius = 0.0015;
4086 phytomer_parameters_walnut.petiole.length_segments = 5;
4087 phytomer_parameters_walnut.petiole.radial_subdivisions = 3;
4088 phytomer_parameters_walnut.petiole.color =
make_RGBcolor(0.61, 0.5, 0.24);
4090 phytomer_parameters_walnut.leaf.leaves_per_petiole = 5;
4091 phytomer_parameters_walnut.leaf.pitch.uniformDistribution(-40, 0);
4092 phytomer_parameters_walnut.leaf.prototype_scale = 0.14;
4093 phytomer_parameters_walnut.leaf.leaflet_scale = 0.7;
4094 phytomer_parameters_walnut.leaf.leaflet_offset = 0.35;
4095 phytomer_parameters_walnut.leaf.prototype = leaf_prototype;
4097 phytomer_parameters_walnut.peduncle.length = 0.02;
4098 phytomer_parameters_walnut.peduncle.radius = 0.0005;
4099 phytomer_parameters_walnut.peduncle.pitch = 90;
4100 phytomer_parameters_walnut.peduncle.roll = 90;
4101 phytomer_parameters_walnut.peduncle.length_segments = 1;
4103 phytomer_parameters_walnut.inflorescence.flowers_per_peduncle = 1;
4104 phytomer_parameters_walnut.inflorescence.pitch = 0;
4105 phytomer_parameters_walnut.inflorescence.roll = 0;
4106 phytomer_parameters_walnut.inflorescence.flower_prototype_scale = 0.03;
4107 phytomer_parameters_walnut.inflorescence.flower_prototype_function = WalnutFlowerPrototype;
4108 phytomer_parameters_walnut.inflorescence.fruit_prototype_scale = 0.075;
4109 phytomer_parameters_walnut.inflorescence.fruit_prototype_function = WalnutFruitPrototype;
4130 shoot_parameters_proleptic.phytomer_parameters = phytomer_parameters_walnut;
4131 shoot_parameters_proleptic.phytomer_parameters.internode.color =
make_RGBcolor(0.3, 0.2, 0.2);
4132 shoot_parameters_proleptic.phytomer_parameters.phytomer_creation_function = WalnutPhytomerCreationFunction;
4134 shoot_parameters_proleptic.max_nodes = 24;
4135 shoot_parameters_proleptic.max_nodes_per_season = 12;
4136 shoot_parameters_proleptic.phyllochron_min = 2.;
4137 shoot_parameters_proleptic.elongation_rate_max = 0.15;
4138 shoot_parameters_proleptic.girth_area_factor = 9.f;
4139 shoot_parameters_proleptic.vegetative_bud_break_probability_min = 0.05;
4140 shoot_parameters_proleptic.vegetative_bud_break_probability_decay_rate = 0.7;
4141 shoot_parameters_proleptic.vegetative_bud_break_time = 3;
4142 shoot_parameters_proleptic.gravitropic_curvature = 300;
4143 shoot_parameters_proleptic.tortuosity = 4;
4144 shoot_parameters_proleptic.insertion_angle_tip.uniformDistribution(20, 25);
4145 shoot_parameters_proleptic.insertion_angle_decay_rate = 15;
4146 shoot_parameters_proleptic.internode_length_max = 0.08;
4147 shoot_parameters_proleptic.internode_length_min = 0.01;
4148 shoot_parameters_proleptic.internode_length_decay_rate = 0.006;
4149 shoot_parameters_proleptic.fruit_set_probability = 0.3;
4150 shoot_parameters_proleptic.flower_bud_break_probability = 0.3;
4151 shoot_parameters_proleptic.max_terminal_floral_buds = 4;
4152 shoot_parameters_proleptic.flowers_require_dormancy =
true;
4153 shoot_parameters_proleptic.growth_requires_dormancy =
true;
4154 shoot_parameters_proleptic.determinate_shoot_growth =
false;
4155 shoot_parameters_proleptic.defineChildShootTypes({
"proleptic"}, {1.0});
4158 ShootParameters shoot_parameters_scaffold = shoot_parameters_proleptic;
4160 shoot_parameters_scaffold.
max_nodes = 30;
4171uint PlantArchitecture::buildWalnutTree(
const helios::vec3 &base_position) {
4173 if (shoot_types.empty()) {
4175 initializeWalnutTreeShoots();
4179 auto trunk_height = getParameterValue(current_build_parameters,
"trunk_height", 0.8f, 0.1f, 3.f,
"total trunk height in meters");
4180 auto num_scaffolds =
uint(getParameterValue(current_build_parameters,
"num_scaffolds", 4.f, 2.f, 8.f,
"number of scaffold branches"));
4181 auto scaffold_angle = getParameterValue(current_build_parameters,
"scaffold_angle", 40.f, 25.f, 60.f,
"scaffold branch angle in degrees");
4184 float trunk_internode_length = 0.04f;
4185 uint trunk_nodes =
uint(trunk_height / trunk_internode_length);
4186 if (trunk_nodes < 1)
4190 float scaffold_radius = 0.007f;
4191 float scaffold_length = 0.06f;
4195 uint uID_trunk =
addBaseStemShoot(plantID, trunk_nodes, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), 0.f * M_PI), shoot_types.at(
"trunk").phytomer_parameters.internode.radius_initial.val(),
4196 trunk_internode_length, 1.f, 1.f, 0,
"trunk");
4197 appendPhytomerToShoot(plantID, uID_trunk, shoot_types.at(
"trunk").phytomer_parameters, 0, 0.01, 1, 1);
4199 plant_instances.at(plantID).shoot_tree.at(uID_trunk)->meristem_is_alive =
false;
4201 auto phytomers = plant_instances.at(plantID).shoot_tree.at(uID_trunk)->phytomers;
4202 for (
const auto &phytomer: phytomers) {
4203 phytomer->removeLeaf();
4204 phytomer->setVegetativeBudState(BUD_DEAD);
4205 phytomer->setFloralBudState(BUD_DEAD);
4209 uint scaffold_nodes_min = 5;
4210 uint scaffold_nodes_max = 7;
4212 for (
int i = 0; i < num_scaffolds; i++) {
4213 float pitch =
deg2rad(scaffold_angle) + context_ptr->
randu(-0.1f, 0.1f);
4214 uint scaffold_nodes = context_ptr->
randu(
int(scaffold_nodes_min),
int(scaffold_nodes_max));
4215 uint uID_shoot =
addChildShoot(plantID, uID_trunk,
getShootNodeCount(plantID, uID_trunk) - i - 1, scaffold_nodes, make_AxisRotation(pitch, (
float(i) + context_ptr->
randu(-0.2f, 0.2f)) /
float(num_scaffolds) * 2 * M_PI, 0), scaffold_radius,
4216 scaffold_length, 1.f, 1.f, 0.5,
"scaffold", 0);
4223 plant_instances.at(plantID).max_age = 1460;
4228void PlantArchitecture::initializeWheatShoots() {
4233 leaf_prototype.leaf_texture_file[0] =
"SorghumLeaf.png";
4234 leaf_prototype.leaf_aspect_ratio = 0.1f;
4235 leaf_prototype.midrib_fold_fraction = 0.3f;
4236 leaf_prototype.longitudinal_curvature.uniformDistribution(-0.5, -0.1);
4237 leaf_prototype.lateral_curvature = -0.3;
4238 leaf_prototype.petiole_roll = 0.04f;
4239 leaf_prototype.wave_period = 0.1f;
4240 leaf_prototype.wave_amplitude = 0.1f;
4241 leaf_prototype.leaf_buckle_length.uniformDistribution(0.5, 0.6);
4242 leaf_prototype.leaf_buckle_angle.uniformDistribution(25, 35);
4243 leaf_prototype.subdivisions = 20;
4244 leaf_prototype.unique_prototypes = 10;
4250 phytomer_parameters_wheat.internode.pitch = 0;
4251 phytomer_parameters_wheat.internode.phyllotactic_angle.uniformDistribution(67, 77);
4252 phytomer_parameters_wheat.internode.radius_initial = 0.001;
4253 phytomer_parameters_wheat.internode.color =
make_RGBcolor(0.27, 0.31, 0.16);
4254 phytomer_parameters_wheat.internode.length_segments = 1;
4255 phytomer_parameters_wheat.internode.radial_subdivisions = 6;
4256 phytomer_parameters_wheat.internode.max_floral_buds_per_petiole = 0;
4257 phytomer_parameters_wheat.internode.max_vegetative_buds_per_petiole = 0;
4259 phytomer_parameters_wheat.petiole.petioles_per_internode = 1;
4260 phytomer_parameters_wheat.petiole.pitch.uniformDistribution(-40, -20);
4261 phytomer_parameters_wheat.petiole.radius = 0.0;
4262 phytomer_parameters_wheat.petiole.length = 0.005;
4263 phytomer_parameters_wheat.petiole.taper = 0;
4264 phytomer_parameters_wheat.petiole.curvature = 0;
4265 phytomer_parameters_wheat.petiole.length_segments = 1;
4267 phytomer_parameters_wheat.leaf.leaves_per_petiole = 1;
4268 phytomer_parameters_wheat.leaf.pitch = 0;
4269 phytomer_parameters_wheat.leaf.yaw = 0;
4270 phytomer_parameters_wheat.leaf.roll = 0;
4271 phytomer_parameters_wheat.leaf.prototype_scale = 0.22;
4272 phytomer_parameters_wheat.leaf.prototype = leaf_prototype;
4274 phytomer_parameters_wheat.peduncle.length = 0.1;
4275 phytomer_parameters_wheat.peduncle.radius = 0.002;
4276 phytomer_parameters_wheat.peduncle.color = phytomer_parameters_wheat.internode.color;
4277 phytomer_parameters_wheat.peduncle.curvature = -100;
4278 phytomer_parameters_wheat.peduncle.radial_subdivisions = 6;
4280 phytomer_parameters_wheat.inflorescence.flowers_per_peduncle = 1;
4281 phytomer_parameters_wheat.inflorescence.pitch = 0;
4282 phytomer_parameters_wheat.inflorescence.roll = 0;
4283 phytomer_parameters_wheat.inflorescence.fruit_prototype_scale = 0.1;
4284 phytomer_parameters_wheat.inflorescence.fruit_prototype_function = WheatSpikePrototype;
4286 phytomer_parameters_wheat.phytomer_creation_function = WheatPhytomerCreationFunction;
4291 shoot_parameters_mainstem.phytomer_parameters = phytomer_parameters_wheat;
4292 shoot_parameters_mainstem.vegetative_bud_break_probability_min = 0;
4293 shoot_parameters_mainstem.flower_bud_break_probability = 1;
4294 shoot_parameters_mainstem.phyllochron_min = 2;
4295 shoot_parameters_mainstem.elongation_rate_max = 0.1;
4296 shoot_parameters_mainstem.girth_area_factor = 6.f;
4297 shoot_parameters_mainstem.gravitropic_curvature.uniformDistribution(-500, -200);
4298 shoot_parameters_mainstem.flowers_require_dormancy =
false;
4299 shoot_parameters_mainstem.growth_requires_dormancy =
false;
4300 shoot_parameters_mainstem.determinate_shoot_growth =
false;
4301 shoot_parameters_mainstem.fruit_set_probability = 1.0;
4302 shoot_parameters_mainstem.defineChildShootTypes({
"mainstem"}, {1.0});
4303 shoot_parameters_mainstem.max_nodes = 20;
4304 shoot_parameters_mainstem.max_terminal_floral_buds = 1;
4309uint PlantArchitecture::buildWheatPlant(
const helios::vec3 &base_position) {
4311 if (shoot_types.empty()) {
4313 initializeWheatShoots();
4318 uint uID_stem =
addBaseStemShoot(plantID, 1, make_AxisRotation(context_ptr->
randu(0.f, 0.05f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI), context_ptr->
randu(0.f, 2.f * M_PI)), 0.001, 0.025, 0.01, 0.01, 0,
"mainstem");
4324 plant_instances.at(plantID).max_age = 365;