One of the new things in GeeXLab 0.9.4.1 is the addition of few new procedural meshes.
These meshes are generated with this tiny C-header library: par_shapes.h. This lib allows to generate shapes like spheres, isospheres, platonic solids, trefoil knots or Klein bottles.
You can find GeeXLab demos about these procedural meshes in the host_api/Mesh_Shapes/ folder of the code sample pack
Some meshes like the sphere, trefoil knot or the Klein bottle are generated with normals and texture coordinates which is nice. Other meshes like the platonic solids or the isosphere (based on the icosahedron which is one of the platonic solids) do not have texture coordinates:
The library allows to generate L-system based mesh but I didn’t manage to create one because of a crash in the lsystem creation function. I don’t have time to investigate about the source of this crash. Maybe the lsystem works better on Linux / OS X. I will test it on those platforms soon as possible.
The first version of this tiny C lib was shipped with this instruction in the par_shapes_create_lsystem() function:
char program[strlen(text) + 1];
This array declaration is called Variable-Length-Array or VLA in short. This kind of array construction is allowed in C99. But curiously (or not?) VLAs are not accepted by VS2015 C compiler:
error C2057: expected constant expression error C2466: cannot allocate an array of constant size 0
That’s probably why the author of par_shapes.h has updated his C lib recently, by removing VLAs and replacing them by regular dynamic memory allocations:
size_t len = strlen(text); char* program = (char*)malloc(char, len + 1);
Good old C, nothing’s better 😉