3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
ffBlob.cpp

This example generates the freeform primitive (blob)

// This example generates the freeform primitive (blob)
#include <CoreAPI.h>
using namespace coat;
EXPORT
int main() {
// get to sculpt room
coat::ui::toRoom("Sculpt");
// add new volume
auto current = coat::Scene::sculptRoot().addChild("Blob"+coat::str::ToString(voxId));
auto volume = current.Volume();
// turn to surface
volume.toSurface();
// get subnames for Blob
list<str>* subNames = ff.ffSubNamesList("Blob");
// add the meshes with sub names to volume
const float R = 150;
const int N = subNames->Count();
for(int i = 0; i < N; i++) {
str so = (*subNames)[i];
float x = 1.8 * R * cos(cMath::TwoPi * i / N);
float y = 1.8 * R * sin(cMath::TwoPi * i / N);
freeform("Blob",so).size(R,R,R).translate(vec3(x,y,0)).details(0.5).add(volume);
}
}
int childCount() const
returns the child elements count
SceneElement addChild(const char *name) const
add the child element of the same nature
static SceneElement sculptRoot()
get the root of all sculpt objects
freeform primitive
Definition CorePrimAPI.h:3880
freeform & size(float x, float y, float z)
set the free form size
list< str > * ffSubNamesList()
get the sub names for current free form name.
prim & details(const float det_level)
set the detail level
prim & translate(const vec3 &_pos)
Set the primitive translation.
void add(Volume &v)
add the prim into scene
static void toRoom(const char *name, bool Force=false)
switch to the room
The coat namespace used for most 3DCoat API calls except low-level internal structures.
Definition CoreAPI.h:43
comms::cVec3 vec3
3D - float vector, see the cVec3
Definition CoreAPI.h:50
comms::cList< X > list
the array template, see cList
Definition CoreAPI.h:70
comms::cStr str
the string that is compatible with the 3DCoat engine, see the cStr
Definition CoreAPI.h:67