+ extend Inventor builder to support material nodes

This commit is contained in:
wmayer 2015-12-16 16:09:31 +01:00
parent 2669aa6206
commit 9a3211c343
2 changed files with 40 additions and 0 deletions

View File

@ -393,6 +393,27 @@ void InventorBuilder::addMaterial(float color_r,float color_g,float color_b)
result << Base::blanks(indent) << "} " << std::endl;
}
void InventorBuilder::beginMaterial()
{
result << Base::blanks(indent) << "Material { " << std::endl;
indent +=2;
result << Base::blanks(indent) << "diffuseColor [" << std::endl;
indent +=2;
}
void InventorBuilder::endMaterial()
{
indent -=2;
result << Base::blanks(indent) << "]" << std::endl;
indent -=2;
result << Base::blanks(indent) << "}" << std::endl;
}
void InventorBuilder::addColor(float color_r,float color_g,float color_b)
{
result << color_r << " " << color_g << " " << color_b << std::endl;
}
void InventorBuilder::addMaterialBinding(const char* bind)
{
result << Base::blanks(indent) << "MaterialBinding { value "

View File

@ -175,6 +175,8 @@ public:
* \param str - text set to the label node
*/
void addLabel(const char* str);
/** @name Appearance handling */
//@{
/*!
* \brief Sets a base color node. The colors are in the range [0, 1].
* \param color_r - red color
@ -189,6 +191,22 @@ public:
* \param color_b - blue color
*/
void addMaterial(float color_r,float color_g,float color_b);
/*!
* \brief Starts a material node. The node must be closed with \ref endMaterial
* and the colors must be added with \ref addColor().
*/
void beginMaterial();
/*!
* \brief Closes a material node.
*/
void endMaterial();
/*!
* \brief Adds a color to a material node. The colors are in the range [0, 1].
* \param color_r - red color
* \param color_g - green color
* \param color_b - blue color
*/
void addColor(float color_r,float color_g,float color_b);
/*!
* \brief Sets a material binding node.
* \param binding - binding of the material. Allowed values are:
@ -210,6 +228,7 @@ public:
* \param crease - the crease angle in radians
*/
void addShapeHints(float crease=0.0f);
//@}
/** @name Add coordinates */
//@{