3DCoat Core API
The 3DCoat API documentation.
|
The abstract prim class. More...
#include <CorePrimAPI.h>
Public Member Functions | |
prim () | |
constructs a new prim object. | |
str | class_name () |
get the primitive class name. | |
prim & | name (const char *s) |
set the primitive object name. | |
str | name () const |
get the primitive object name. | |
void | add (Volume &v) |
add the prim into scene | |
void | subtract (Volume &v) |
subtract the prim from scene | |
void | intersect (Volume &v) |
intersect the prim into scene | |
void | merge (Volume &v, const BoolOpType op) |
merge the prim into scene | |
Mesh | mesh () |
get the mesh prim | |
prim & | color (DWORD CL) |
assign the color to the primitive (in voxels) | |
prim & | color (float r, float g, float b, float a) |
assign the color to the primitive (in voxels) | |
prim & | color (float r, float g, float b) |
assign the color to the primitive (in voxels) | |
prim & | color (const char *colorid) |
assign the color to the primitive (in voxels) | |
prim & | gloss (float value) |
assign the gloss for the voxel primitive, it will work only if the color already assigned | |
prim & | roughness (float value) |
assign the roughness for the voxel primitive, it will work only if the color already assigned | |
prim & | metal (float value) |
the metalliclty value for the voxel primitive, it will work only if the color already assigned | |
prim & | opacity (float value) |
assign the opacity of the color over the voxel primitive. The color should be assigned before you assign the opacity, for example p.color("red").opacity(0.5) | |
prim & | details (const float det_level) |
set the detail level | |
float | details () |
get the detail level | |
prim & | transform (const mat4 &t) |
set the transform matrix | |
mat4 | transform () const |
get the transform matrix | |
prim & | scale (float scale) |
set the scale | |
prim & | scale (const vec3 &v) |
set the scale | |
vec3 | scale () const |
get the scale | |
prim & | translate (const vec3 &_pos) |
Set the primitive translation. | |
vec3 | translate () const |
get the primitive translation | |
prim & | translate (float x, float y, float z) |
Set the primitive translation. | |
prim & | x (float x) |
shift the primitive along the x - axis | |
prim & | y (float y) |
shift the primitive along the y - axis | |
prim & | z (float z) |
shift the primitive along the z - axis | |
prim & | auto_divide (float average_div) |
set the auto devide | |
prim & | step_divide (float step) |
set the step devide | |
prim & | fillet (float radius) |
set the fillet | |
template<typename T > | |
T & | Obj () |
Get the primitive object reference. | |
template<typename T > | |
bool | isAs () |
Check the prim's type. | |
virtual float | fillet_relative () |
calculates a fillet relative value (0..1). | |
Static Public Member Functions | |
static void | debug_on (bool isOn=true) |
indicates whether to turn on or off the debug mode. | |
static void | debug_clear () |
clear the debug info for primitive operations | |
static void | push_transform (const mat4 &t) |
set the global transform matrix to all primitives | |
static void | push_translate (const vec3 &d) |
Set the translation to all primitives. | |
static void | push_scale (float scale) |
Set the scale to all primitives. | |
static void | push_scale (const vec3 &s) |
Set the scale to all primitives. | |
static void | push_details (float details_modulator) |
set the detail level to all primitives | |
static void | reset_transform () |
reset the global transform matrix | |
Protected Member Functions | |
template<class T > | |
T & | to_cast_this () |
cast this prim to the obj type T | |
virtual cMeshContainer * | create_mesh () |
abstract method to create a mesh container. | |
void | merge_debug (Volume &vol, Mesh &mesh) |
merge the mesh debug into scene | |
Protected Attributes | |
prim * | _this |
Friends | |
class | box |
class | sphere |
class | ellipse |
class | cylinder |
class | cone |
class | tube |
class | gear |
class | ngon |
class | capsule |
class | torus |
class | spiral |
The abstract prim class.
void coat::prim::add | ( | Volume & | v | ) |
add the prim into scene
v | the scene volume reference |
prim & coat::prim::auto_divide | ( | float | average_div | ) |
set the auto devide
average_div | the average divide factor |
prim & coat::prim::color | ( | const char * | colorid | ) |
assign the color to the primitive (in voxels)
colorid | the color in any suitable form: "RGB", "ARGB", "RRGGBB", "AARRGGBB", "#RGB", "#ARGB", "#RRGGBB", "#AARRGGBB", any web-color common name as "red", "green", "purple", google "webcolors" |
prim & coat::prim::color | ( | DWORD | CL | ) |
assign the color to the primitive (in voxels)
CL | color in hexadecimal form 0xAARRGGBB |
prim & coat::prim::color | ( | float | r, |
float | g, | ||
float | b ) |
assign the color to the primitive (in voxels)
r | red value 0..255 |
g | green value 0..255 |
b | blue value 0..255 |
prim & coat::prim::color | ( | float | r, |
float | g, | ||
float | b, | ||
float | a ) |
assign the color to the primitive (in voxels)
r | red value 0..255 |
g | green value 0..255 |
b | blue value 0..255 |
a | alpha value 0..255 |
|
inlineprotectedvirtual |
abstract method to create a mesh container.
Reimplemented in coat::bolt, coat::boltHead, coat::box, coat::capsule, coat::cone, coat::cylinder, coat::ellipse, coat::freeform, coat::gear, coat::image, coat::lathe, coat::ngon, coat::nut, coat::screw, coat::sphere, coat::spiral, coat::text, coat::thread, coat::threadStud, coat::torus, coat::tube, and coat::washer.
|
static |
indicates whether to turn on or off the debug mode.
isOn | if this parameter is true, the debug mode is on, otherwise the debug mode is off. |
float coat::prim::details | ( | ) |
get the detail level
prim & coat::prim::details | ( | const float | det_level | ) |
set the detail level
prim & coat::prim::fillet | ( | float | radius | ) |
set the fillet
radius | the fillet radius |
|
virtual |
calculates a fillet relative value (0..1).
Reimplemented in coat::box, coat::cone, coat::cylinder, coat::ngon, and coat::tube.
prim & coat::prim::gloss | ( | float | value | ) |
assign the gloss for the voxel primitive, it will work only if the color already assigned
value | the [0..1] value of the gloss |
void coat::prim::intersect | ( | Volume & | v | ) |
intersect the prim into scene
v | the scene volume reference |
|
inline |
Check the prim's type.
void coat::prim::merge | ( | Volume & | v, |
const BoolOpType | op ) |
merge the prim into scene
v | the scene volume reference |
op | the type of the merge |
merge the mesh debug into scene
vol | the volume reference |
mesh | the mesh geometry of this prim |
Mesh coat::prim::mesh | ( | ) |
get the mesh prim
prim & coat::prim::metal | ( | float | value | ) |
the metalliclty value for the voxel primitive, it will work only if the color already assigned
value | the [0..1] metal value |
prim & coat::prim::name | ( | const char * | s | ) |
set the primitive object name.
s | the object name |
|
inline |
Get the primitive object reference.
prim & coat::prim::opacity | ( | float | value | ) |
assign the opacity of the color over the voxel primitive. The color should be assigned before you assign the opacity, for example p.color("red").opacity(0.5)
value | the opacity value [0..1] |
|
static |
set the detail level to all primitives
details_modulator | datail level |
Not implemented yet
|
static |
Set the scale to all primitives.
scale | the new scale 3d vector |
Not implemented yet
|
static |
Set the scale to all primitives.
scale | the new scale factor |
Not implemented yet
|
static |
set the global transform matrix to all primitives
t | the matrix |
|
static |
Set the translation to all primitives.
d | the new position of the primitives |
Not implemented yet
|
static |
prim & coat::prim::roughness | ( | float | value | ) |
assign the roughness for the voxel primitive, it will work only if the color already assigned
value | the [0..1] value of the roughness |
vec3 coat::prim::scale | ( | ) | const |
get the scale
set the scale
v | the scale vector |
prim & coat::prim::scale | ( | float | scale | ) |
set the scale
scale | the scale factor |
prim & coat::prim::step_divide | ( | float | step | ) |
set the step devide
step | the step divide factor |
void coat::prim::subtract | ( | Volume & | v | ) |
subtract the prim from scene
v | the scene volume reference |
|
inlineprotected |
cast this prim to the obj type T
mat4 coat::prim::transform | ( | ) | const |
get the transform matrix
set the transform matrix
t | the matrix |
vec3 coat::prim::translate | ( | ) | const |
get the primitive translation
Set the primitive translation.
_pos | the new primitive position |
prim & coat::prim::translate | ( | float | x, |
float | y, | ||
float | z ) |
Set the primitive translation.
x | the new x primitive position |
y | the new y primitive position |
z | the new z primitive position |
prim & coat::prim::x | ( | float | x | ) |
shift the primitive along the x - axis
x | the x value |
prim & coat::prim::y | ( | float | y | ) |
shift the primitive along the y - axis
y | the y value |
prim & coat::prim::z | ( | float | z | ) |
shift the primitive along the z - axis
z | the z value |