9 std::vector<std::vector<uint>> U;
11 std::vector<vec3> nodes;
12 std::vector<float> radius;
32 float azimuth = 2.f *
PI_F * context->
randu();
34 if (context->
randu() < 0.75) {
36 std::vector<vec3> nodes2 = nodes;
37 for (
int i = 0; i < nodes2.size(); i++) {
44 if (context->
randu() < 0.5) {
46 std::vector<vec3> nodes3 = nodes;
47 for (
int i = 0; i < nodes3.size(); i++) {
62 float dx = 1.f / float(Nx);
63 float dy = 0.5f / float(Ny);
65 std::vector<uint> UUIDs;
70 for (
int i = 0; i < Nx; i++) {
71 for (
int j = 0; j < Ny; j++) {
78 mag = sqrt(x * x + 2 * y * y);
79 z = a0 * mag / (e0 + mag);
82 mag = sqrt((x + dx) * (x + dx) + 2 * y * y);
83 z = a0 * mag / (e0 + mag);
84 vec3 v1(x + dx, y, z);
86 mag = sqrt((x + dx) * (x + dx) + 2 * (y + dy) * (y + dy));
87 z = a0 * mag / (e0 + mag);
88 vec3 v2(x + dx, y + dy, z);
90 mag = sqrt(x * x + 2 * (y + dy) * (y + dy));
91 z = a0 * mag / (e0 + mag);
92 vec3 v3(x, y + dy, z);
94 vec2 uv0(1.f - x, 0.5 + j * dy);
95 vec2 uv1(1.f - x - dx, 0.5 + j * dy);
96 vec2 uv2(1.f - x - dx, 0.5 + (j + 1) * dy);
97 vec2 uv3(1.f - x, 0.5 + (j + 1) * dy);
108 uv1 =
make_vec2(1.f - x - dx, 0.5 - j * dy);
109 uv2 =
make_vec2(1.f - x - dx, 0.5 - (j + 1) * dy);
110 uv3 =
make_vec2(1.f - x, 0.5 - (j + 1) * dy);
121 std::vector<std::vector<uint>> &leaf_UUIDs, std::vector<uint> &branch_UUIDs, std::vector<std::vector<std::vector<uint>>> &fruit_UUIDs,
Context *context) {
125 std::vector<vec3> nodes;
126 std::vector<float> radius;
127 std::vector<RGBcolor> color;
131 vec3 dir = base_direction;
136 nodes.push_back(base_position);
141 for (
int i = 1; i < node_count; i++) {
143 float vfrac = float(i) / float(node_count - 1);
149 theta -= bend_angle / float(node_count - 1);
151 nodes.push_back(position);
157 branch_UUIDs.insert(branch_UUIDs.end(), U.begin(), U.end());
170 leaf_UUIDs.push_back(U);
181 leaf_UUIDs.push_back(U);
191 leaf_UUIDs.push_back(U);
199 fruit_UUIDs.push_back(strawberryCluster(cluster_position, params, context));
205 std::vector<std::vector<uint>> leaf_UUIDs;
206 std::vector<uint> branch_UUIDs;
207 std::vector<std::vector<std::vector<uint>>> fruit_UUIDs;
209 std::vector<uint> leaf_prototype = leafPrototype(params, context);
221 strawberryShoot(params, position, base_direction, length, tip_angle, leaf_prototype, leaf_UUIDs, branch_UUIDs, fruit_UUIDs, context);
226 UUID_leaf.push_back(leaf_UUIDs);
227 UUID_branch.push_back(branch_UUIDs);
228 UUID_fruit.push_back(fruit_UUIDs);
230 return UUID_leaf.size() - 1;