OpenLexocad
28.0
|
#include <Builder3D.h>
Public Member Functions | |
InventorBuilder (std::ostream &str) | |
Construction of an InventorBuilder instance. This automatically opens a separator node. More... | |
virtual | ~InventorBuilder () |
Destruction of an InventorBuilder instance. More... | |
void | close () |
If needed closes the first opened separator node. This method must not be used more than one time for an instance. More... | |
void | beginSeparator () |
Sets a separator node. More... | |
void | endSeparator () |
Closes the last added separator node. More... | |
void | addInfo (const char *str) |
Sets an info node. More... | |
void | addLabel (const char *str) |
Sets a label node. More... | |
Appearance handling | |
void | addBaseColor (float color_r, float color_g, float color_b) |
Sets a base color node. The colors are in the range [0, 1]. More... | |
void | addMaterial (float color_r, float color_g, float color_b, float color_a=0) |
Sets a material node. The colors are in the range [0, 1]. More... | |
void | beginMaterial () |
Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor(). More... | |
void | endMaterial () |
Closes a material node. More... | |
void | addColor (float color_r, float color_g, float color_b) |
Adds a color to a material node. The colors are in the range [0, 1]. More... | |
void | addMaterialBinding (const char *binding="OVERALL") |
Sets a material binding node. More... | |
void | addDrawStyle (short pointSize, short lineWidth, unsigned short linePattern=0xffff, const char *style="FILLED") |
Sets a draw style node. More... | |
void | addShapeHints (float crease=0.0f) |
Sets a shape hints node. More... | |
void | addPolygonOffset (float factor=1.0f, float units=1.0f, const char *styles="FILLED", bool on=true) |
Sets a polygon offset node. More... | |
Add coordinates | |
void | addPoint (float x, float y, float z) |
add a single point More... | |
void | addPoint (const Vector3f &vec) |
add a single point More... | |
void | addPoints (const std::vector< Vector3f > &vec) |
add a list of points More... | |
Point set handling | |
void | beginPoints () |
starts a point set More... | |
void | endPoints () |
ends the points set operation More... | |
void | addPointSet () |
add an SoPointSet node More... | |
Normal handling | |
void | beginNormal () |
starts a point set More... | |
void | endNormal () |
ends the points set operation More... | |
void | addNormalBinding (const char *) |
add normal binding node More... | |
Line/Direction handling | |
void | addSingleLine (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff) |
add a line defined by 2 Vector3D More... | |
void | addSingleArrow (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff) |
add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2. More... | |
void | addLineSet (const std::vector< Vector3f > &points, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff) |
add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line. More... | |
void | addLineSet () |
add an SoLineSet node More... | |
Triangle handling | |
void | addSingleTriangle (const Vector3f &pt0, const Vector3f &pt1, const Vector3f &pt2, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0) |
add a (filled) triangle defined by 3 vectors More... | |
void | addSinglePlane (const Vector3f &base, const Vector3f &eX, const Vector3f &eY, float length, float width, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0) |
void | addIndexedFaceSet (const std::vector< int > &indices) |
void | addFaceSet (const std::vector< int > &vertices) |
Surface handling | |
void | addNurbsSurface (const std::vector< Base::Vector3f > &controlPoints, int numUControlPoints, int numVControlPoints, const std::vector< float > &uKnots, const std::vector< float > &vKnots) |
void | addCylinder (float radius, float height) |
void | addSphere (float radius) |
Bounding Box handling | |
void | addBoundingBox (const Vector3f &pt1, const Vector3f &pt2, short lineWidth=2, float color_r=1.0, float color_g=1.0, float color_b=1.0) |
Transformation | |
void | addTransformation (const Matrix4D &) |
adds a transformation More... | |
void | addTransformation (const Vector3f &translation, const Vector3f &rotationaxis, float fAngle) |
Text handling | |
void | addText (float pos_x, float pos_y, float pos_z, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0) |
add a text More... | |
void | addText (const Vector3f &vec, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0) |
add a text More... | |
This class does basically the same as Builder3D except that it writes the data directly into a given stream without buffering the output data in a string stream. Compared to file streams, string streams are quite slow when writing data with more than a few hundred lines. Due to performance reasons the user should use a file stream in this case.
Base::InventorBuilder::InventorBuilder | ( | std::ostream & | str | ) |
Construction of an InventorBuilder instance. This automatically opens a separator node.
str | - stream to write the content into |
|
virtual |
Destruction of an InventorBuilder instance.
void Base::InventorBuilder::addBaseColor | ( | float | color_r, |
float | color_g, | ||
float | color_b | ||
) |
Sets a base color node. The colors are in the range [0, 1].
color_r | - red color |
color_g | - green color |
color_b | - blue color |
void Base::InventorBuilder::addBoundingBox | ( | const Vector3f & | pt1, |
const Vector3f & | pt2, | ||
short | lineWidth = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 |
||
) |
void Base::InventorBuilder::addColor | ( | float | color_r, |
float | color_g, | ||
float | color_b | ||
) |
Adds a color to a material node. The colors are in the range [0, 1].
color_r | - red color |
color_g | - green color |
color_b | - blue color |
void Base::InventorBuilder::addCylinder | ( | float | radius, |
float | height | ||
) |
void Base::InventorBuilder::addDrawStyle | ( | short | pointSize, |
short | lineWidth, | ||
unsigned short | linePattern = 0xffff , |
||
const char * | style = "FILLED" |
||
) |
Sets a draw style node.
pointSize | - the point size |
lineWidth | - the line width |
linePattern | - the line pattern |
style | - the draw style |
void Base::InventorBuilder::addFaceSet | ( | const std::vector< int > & | vertices | ) |
void Base::InventorBuilder::addIndexedFaceSet | ( | const std::vector< int > & | indices | ) |
void Base::InventorBuilder::addInfo | ( | const char * | str | ) |
Sets an info node.
str | - text set to the info node |
void Base::InventorBuilder::addLabel | ( | const char * | str | ) |
Sets a label node.
str | - text set to the label node |
void Base::InventorBuilder::addLineSet | ( | ) |
add an SoLineSet node
void Base::InventorBuilder::addLineSet | ( | const std::vector< Vector3f > & | points, |
short | lineSize = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 , |
||
unsigned short | linePattern = 0xffff |
||
) |
add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line.
void Base::InventorBuilder::addMaterial | ( | float | color_r, |
float | color_g, | ||
float | color_b, | ||
float | color_a = 0 |
||
) |
Sets a material node. The colors are in the range [0, 1].
color_r | - red color |
color_g | - green color |
color_b | - blue color |
color_a | - transparency |
void Base::InventorBuilder::addMaterialBinding | ( | const char * | binding = "OVERALL" | ) |
Sets a material binding node.
binding | - binding of the material. Allowed values are: OVERALL, PER_PART, PER_PART_INDEXED, PER_FACE, PER_FACE_INDEXED, PER_VERTEX, PER_VERTEX_INDEXED and DEFAULT. |
void Base::InventorBuilder::addNormalBinding | ( | const char * | ) |
add normal binding node
void Base::InventorBuilder::addNurbsSurface | ( | const std::vector< Base::Vector3f > & | controlPoints, |
int | numUControlPoints, | ||
int | numVControlPoints, | ||
const std::vector< float > & | uKnots, | ||
const std::vector< float > & | vKnots | ||
) |
void Base::InventorBuilder::addPoint | ( | const Vector3f & | vec | ) |
add a single point
void Base::InventorBuilder::addPoint | ( | float | x, |
float | y, | ||
float | z | ||
) |
add a single point
void Base::InventorBuilder::addPoints | ( | const std::vector< Vector3f > & | vec | ) |
add a list of points
void Base::InventorBuilder::addPointSet | ( | ) |
add an SoPointSet node
void Base::InventorBuilder::addPolygonOffset | ( | float | factor = 1.0f , |
float | units = 1.0f , |
||
const char * | styles = "FILLED" , |
||
bool | on = true |
||
) |
Sets a polygon offset node.
factor | - Offset multiplication factor. |
units | - Offset translation multiplication factor. |
styles | - Can be FILLED, LINES or POINTS. |
on | - Whether the offset is on or off. |
void Base::InventorBuilder::addShapeHints | ( | float | crease = 0.0f | ) |
Sets a shape hints node.
crease | - the crease angle in radians |
void Base::InventorBuilder::addSingleArrow | ( | const Vector3f & | pt1, |
const Vector3f & | pt2, | ||
short | lineSize = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 , |
||
unsigned short | linePattern = 0xffff |
||
) |
add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2.
void Base::InventorBuilder::addSingleLine | ( | const Vector3f & | pt1, |
const Vector3f & | pt2, | ||
short | lineSize = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 , |
||
unsigned short | linePattern = 0xffff |
||
) |
add a line defined by 2 Vector3D
void Base::InventorBuilder::addSinglePlane | ( | const Vector3f & | base, |
const Vector3f & | eX, | ||
const Vector3f & | eY, | ||
float | length, | ||
float | width, | ||
bool | filled = true , |
||
short | lineSize = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 |
||
) |
void Base::InventorBuilder::addSingleTriangle | ( | const Vector3f & | pt0, |
const Vector3f & | pt1, | ||
const Vector3f & | pt2, | ||
bool | filled = true , |
||
short | lineSize = 2 , |
||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 |
||
) |
add a (filled) triangle defined by 3 vectors
void Base::InventorBuilder::addSphere | ( | float | radius | ) |
void Base::InventorBuilder::addText | ( | const Vector3f & | vec, |
const char * | text, | ||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 |
||
) |
add a text
void Base::InventorBuilder::addText | ( | float | pos_x, |
float | pos_y, | ||
float | pos_z, | ||
const char * | text, | ||
float | color_r = 1.0 , |
||
float | color_g = 1.0 , |
||
float | color_b = 1.0 |
||
) |
add a text
void Base::InventorBuilder::addTransformation | ( | const Matrix4D & | ) |
adds a transformation
void Base::InventorBuilder::addTransformation | ( | const Vector3f & | translation, |
const Vector3f & | rotationaxis, | ||
float | fAngle | ||
) |
void Base::InventorBuilder::beginMaterial | ( | ) |
Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor().
void Base::InventorBuilder::beginNormal | ( | ) |
starts a point set
void Base::InventorBuilder::beginPoints | ( | ) |
starts a point set
void Base::InventorBuilder::beginSeparator | ( | ) |
Sets a separator node.
void Base::InventorBuilder::close | ( | ) |
If needed closes the first opened separator node. This method must not be used more than one time for an instance.
void Base::InventorBuilder::endMaterial | ( | ) |
Closes a material node.
void Base::InventorBuilder::endNormal | ( | ) |
ends the points set operation
void Base::InventorBuilder::endPoints | ( | ) |
ends the points set operation
void Base::InventorBuilder::endSeparator | ( | ) |
Closes the last added separator node.