3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
coat::prim Class Reference

The abstract prim class. More...

#include <CorePrimAPI.h>

Inheritance diagram for coat::prim:
coat::bolt coat::boltHead coat::box coat::cylinder coat::freeform coat::nut coat::screw coat::sphere coat::spiral coat::text coat::thread coat::washer

Public Member Functions

 prim ()
 constructs a new prim object.
 
str class_name ()
 get the primitive class name.
 
primname (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
 
primcolor (DWORD CL)
 assign the color to the primitive (in voxels)
 
primcolor (float r, float g, float b, float a)
 assign the color to the primitive (in voxels)
 
primcolor (float r, float g, float b)
 assign the color to the primitive (in voxels)
 
primcolor (const char *colorid)
 assign the color to the primitive (in voxels)
 
primgloss (float value)
 assign the gloss for the voxel primitive, it will work only if the color already assigned
 
primroughness (float value)
 assign the roughness for the voxel primitive, it will work only if the color already assigned
 
primmetal (float value)
 the metalliclty value for the voxel primitive, it will work only if the color already assigned
 
primopacity (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)
 
primdetails (const float det_level)
 set the detail level
 
float details ()
 get the detail level
 
primtransform (const mat4 &t)
 set the transform matrix
 
mat4 transform () const
 get the transform matrix
 
primscale (float scale)
 set the scale
 
primscale (const vec3 &v)
 set the scale
 
vec3 scale () const
 get the scale
 
primtranslate (const vec3 &_pos)
 Set the primitive translation.
 
vec3 translate () const
 get the primitive translation
 
primtranslate (float x, float y, float z)
 Set the primitive translation.
 
primx (float x)
 shift the primitive along the x - axis
 
primy (float y)
 shift the primitive along the y - axis
 
primz (float z)
 shift the primitive along the z - axis
 
primauto_divide (float average_div)
 set the auto devide
 
primstep_divide (float step)
 set the step devide
 
primfillet (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
 

Detailed Description

The abstract prim class.

Member Function Documentation

◆ add()

◆ auto_divide()

prim & coat::prim::auto_divide ( float average_div)

set the auto devide

Parameters
average_divthe average divide factor
Returns
this prim reference

◆ color() [1/4]

prim & coat::prim::color ( const char * colorid)

assign the color to the primitive (in voxels)

Parameters
coloridthe color in any suitable form: "RGB", "ARGB", "RRGGBB", "AARRGGBB", "#RGB", "#ARGB", "#RRGGBB", "#AARRGGBB", any web-color common name as "red", "green", "purple", google "webcolors"
Returns
the reference

◆ color() [2/4]

prim & coat::prim::color ( DWORD CL)

assign the color to the primitive (in voxels)

Parameters
CLcolor in hexadecimal form 0xAARRGGBB
Returns
the reference

◆ color() [3/4]

prim & coat::prim::color ( float r,
float g,
float b )

assign the color to the primitive (in voxels)

Parameters
rred value 0..255
ggreen value 0..255
bblue value 0..255
Returns
the reference

◆ color() [4/4]

prim & coat::prim::color ( float r,
float g,
float b,
float a )

assign the color to the primitive (in voxels)

Parameters
rred value 0..255
ggreen value 0..255
bblue value 0..255
aalpha value 0..255
Returns
the reference

◆ create_mesh()

virtual cMeshContainer * coat::prim::create_mesh ( )
inlineprotectedvirtual

◆ debug_on()

static void coat::prim::debug_on ( bool isOn = true)
static

indicates whether to turn on or off the debug mode.

Parameters
isOnif this parameter is true, the debug mode is on, otherwise the debug mode is off.

◆ details() [1/2]

float coat::prim::details ( )

get the detail level

Returns
detail level

◆ details() [2/2]

◆ fillet()

prim & coat::prim::fillet ( float radius)

set the fillet

Parameters
radiusthe fillet radius
Returns
this primitive reference
Examples
BrickWall.cpp, DoorStop.cpp, Dumbbell.cpp, HoneyComb.cpp, and tube.cpp.

◆ fillet_relative()

virtual float coat::prim::fillet_relative ( )
virtual

calculates a fillet relative value (0..1).

Returns
fillet relative value

Reimplemented in coat::box, coat::cone, coat::cylinder, coat::ngon, and coat::tube.

◆ gloss()

prim & coat::prim::gloss ( float value)

assign the gloss for the voxel primitive, it will work only if the color already assigned

Parameters
valuethe [0..1] value of the gloss
Returns
the reference

◆ intersect()

void coat::prim::intersect ( Volume & v)

intersect the prim into scene

Parameters
vthe scene volume reference

◆ isAs()

template<typename T >
bool coat::prim::isAs ( )
inline

Check the prim's type.

Returns
true if the prim's type T is or inherits prim type T.

◆ merge()

void coat::prim::merge ( Volume & v,
const BoolOpType op )

merge the prim into scene

Parameters
vthe scene volume reference
opthe type of the merge

◆ merge_debug()

void coat::prim::merge_debug ( Volume & vol,
Mesh & mesh )
protected

merge the mesh debug into scene

Parameters
volthe volume reference
meshthe mesh geometry of this prim

◆ mesh()

Mesh coat::prim::mesh ( )

get the mesh prim

Returns
mesh object

◆ metal()

prim & coat::prim::metal ( float value)

the metalliclty value for the voxel primitive, it will work only if the color already assigned

Parameters
valuethe [0..1] metal value
Returns
the reference

◆ name()

prim & coat::prim::name ( const char * s)

set the primitive object name.

Parameters
sthe object name
Returns
the prim object reference
Examples
Dumbbell.cpp.

◆ Obj()

template<typename T >
T & coat::prim::Obj ( )
inline

Get the primitive object reference.

Returns
this primitive object reference
Examples
HoneyComb.cpp, gear.cpp, and tube.cpp.

◆ opacity()

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)

Parameters
valuethe opacity value [0..1]
Returns
the reference

◆ push_details()

static void coat::prim::push_details ( float details_modulator)
static

set the detail level to all primitives

Parameters
details_modulatordatail level

Not implemented yet

◆ push_scale() [1/2]

static void coat::prim::push_scale ( const vec3 & s)
static

Set the scale to all primitives.

Parameters
scalethe new scale 3d vector

Not implemented yet

◆ push_scale() [2/2]

static void coat::prim::push_scale ( float scale)
static

Set the scale to all primitives.

Parameters
scalethe new scale factor

Not implemented yet

◆ push_transform()

static void coat::prim::push_transform ( const mat4 & t)
static

set the global transform matrix to all primitives

Parameters
tthe matrix

◆ push_translate()

static void coat::prim::push_translate ( const vec3 & d)
static

Set the translation to all primitives.

Parameters
dthe new position of the primitives

Not implemented yet

Examples
RollingPin.cpp.

◆ reset_transform()

static void coat::prim::reset_transform ( )
static

reset the global transform matrix

Not implemented yet

Examples
RollingPin.cpp.

◆ roughness()

prim & coat::prim::roughness ( float value)

assign the roughness for the voxel primitive, it will work only if the color already assigned

Parameters
valuethe [0..1] value of the roughness
Returns
the reference

◆ scale() [1/3]

vec3 coat::prim::scale ( ) const

get the scale

Returns
the scale 3d vector

◆ scale() [2/3]

prim & coat::prim::scale ( const vec3 & v)

set the scale

Parameters
vthe scale vector
Returns
this primitive reference

◆ scale() [3/3]

prim & coat::prim::scale ( float scale)

set the scale

Parameters
scalethe scale factor
Returns
prim reference
Examples
HelloWorld3D.cpp, and RollingPin.cpp.

◆ step_divide()

prim & coat::prim::step_divide ( float step)

set the step devide

Parameters
stepthe step divide factor
Returns
primitive reference

◆ subtract()

void coat::prim::subtract ( Volume & v)

subtract the prim from scene

Parameters
vthe scene volume reference
Examples
DoorStop.cpp, csg_surface.cpp, csg_voxels.cpp, and cup.cpp.

◆ to_cast_this()

template<class T >
T & coat::prim::to_cast_this ( )
inlineprotected

cast this prim to the obj type T

Returns
obj type T reference

◆ transform() [1/2]

mat4 coat::prim::transform ( ) const

get the transform matrix

Returns
matrix

◆ transform() [2/2]

prim & coat::prim::transform ( const mat4 & t)

set the transform matrix

Parameters
tthe matrix
Returns
prim reference
Examples
DoorStop.cpp, Dumbbell.cpp, RollingPin.cpp, and WindRose.cpp.

◆ translate() [1/3]

vec3 coat::prim::translate ( ) const

get the primitive translation

Returns
primitive translation

◆ translate() [2/3]

prim & coat::prim::translate ( const vec3 & _pos)

Set the primitive translation.

Parameters
_posthe new primitive position
Returns
this primitive reference
Examples
BrickWall.cpp, Dumbbell.cpp, HoneyComb.cpp, RollingPin.cpp, ellipses.cpp, ffBlob.cpp, and spheres.cpp.

◆ translate() [3/3]

prim & coat::prim::translate ( float x,
float y,
float z )

Set the primitive translation.

Parameters
xthe new x primitive position
ythe new y primitive position
zthe new z primitive position
Returns
this primitive reference

◆ x()

prim & coat::prim::x ( float x)

shift the primitive along the x - axis

Parameters
xthe x value
Returns
this primitive reference
Examples
boltheads.cpp, and washer.cpp.

◆ y()

prim & coat::prim::y ( float y)

shift the primitive along the y - axis

Parameters
ythe y value
Returns
this primitive reference
Examples
DoorStop.cpp, bolt_binary.cpp, csg_surface.cpp, csg_voxels.cpp, and cup.cpp.

◆ z()

prim & coat::prim::z ( float z)

shift the primitive along the z - axis

Parameters
zthe z value
Returns
this primitive reference
Examples
DoorStop.cpp, boltheads.cpp, and washer.cpp.

The documentation for this class was generated from the following file: