void main() {
// preparing a scene
SculptRoom sculpt;
sculpt.clear().toSurface();
Mesh a, b;
const Vec3 dir = Vec3( 0, 1, 0 );
// I) add
float delta = 0;
Vec3 shift = dir * delta;
{
build( a, b, shift );
const Mesh ab = a | b;
sculpt += ab;
}
// II) subtruct
delta += 200;
shift = dir * delta;
{
build( a, b, shift );
const Mesh ab = a - b;
sculpt += ab;
}
// III) intersect
delta += 200;
shift = dir * delta;
{
build( a, b, shift );
const Mesh ab = a & b;
sculpt += ab;
}
}
void build( Mesh &out a, Mesh &out b, const Vec3 &in shift ) {
Builder builder;
const Vec3 pa( 0 );
a = builder.sphere()
.radius( 90 )
.position( pa + shift )
.details( 0.1 )
.build();
const Vec3 pb( 30, 40, 50 );
b = builder.sphere()
.radius( 50 )
.position( pb + shift )
.details( 0.5 )
.build();
}
Launching this script in 3D-Coat, we will see:
Why is such a picture understandable after reading a string of code, with its comments. Notice: the sphere's detail state remains the same after adding, subtraction and intersection.
Script can be written more compact when excluding command `
Mesh ab
`:{
build( a, b, shift );
sculpt += a | b;
}
This is my first post with new scripting architecture. Syntax is a red thread, which I would maintain. Also there is a short presentation which demonstrates how I plan to expand 3D-Coat's possibilities. Please let me know if there is something that you need first. Old code works too, but when a proper substitute appears old code is marked as DEPRECATED.
In the near term I will add new primitives and will expand this review.
Updated 14/12/2015
See "Primitives and Scripting: what you can do already".
Комментариев нет:
Отправить комментарий