Commit ee9957ab authored by Jan Möbius's avatar Jan Möbius

Scripting functions to set object color

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16502 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0a1711ad
......@@ -310,6 +310,57 @@ void ColorPlugin::setObjectEmissiveColor(int _objectId , Vector4 _color) {
//-----------------------------------------------------------------------------
/** Sets the ambient color of an object
*
* @param _objectId Id of an Object
* @param _color Color to be set
*/
void ColorPlugin::setObjectAmbientColor(int _objectId , Vector4 _color) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
return;
}
OpenMesh::Vec4f tmp = OpenMesh::Vec4f(_color);
object->materialNode()->set_ambient_color(tmp);
}
//-----------------------------------------------------------------------------
/** Sets the diffuse color of an object
*
* @param _objectId Id of an Object
* @param _color Color to be set
*/
void ColorPlugin::setObjectDiffuseColor(int _objectId , Vector4 _color) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
return;
}
OpenMesh::Vec4f tmp = OpenMesh::Vec4f(_color);
object->materialNode()->set_diffuse_color(tmp);
}
//-----------------------------------------------------------------------------
/** Sets the specular color of an object
*
* @param _objectId Id of an Object
* @param _color Color to be set
*/
void ColorPlugin::setObjectSpecularColor(int _objectId , Vector4 _color) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
return;
}
OpenMesh::Vec4f tmp = OpenMesh::Vec4f(_color);
object->materialNode()->set_specular_color(tmp);
}
//-----------------------------------------------------------------------------
/** \brief Generate an icon with given color
*
* @param _color a color vector
......
......@@ -186,6 +186,21 @@ class ColorPlugin : public QObject, BaseInterface, MenuInterface, ScriptInterfac
*/
void setObjectEmissiveColor(int _objectId , Vector4 _color);
/**
* Sets the ambient color of an object
*/
void setObjectAmbientColor(int _objectId , Vector4 _color);
/**
* Sets the diffuse color of an object
*/
void setObjectDiffuseColor(int _objectId , Vector4 _color);
/**
* Sets the specular color of an object
*/
void setObjectSpecularColor(int _objectId , Vector4 _color);
/** @} */
//===========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment