Commit ca452547 authored by Jan Möbius's avatar Jan Möbius
Browse files

Empty Scripting slots for setting shaders

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4945 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4eaf0357
......@@ -760,6 +760,48 @@ void ViewControlPlugin::slotSetShader(){
emit updateView();
}
void ViewControlPlugin::setShader(int _id, QString _drawMode, QString _vertexShader, QString _fragmentShader ){
std::cerr << "Todo : Scripting to set Shader" << std::endl;
// if ( OpenFlipper::Options::nogui() )
// return;
//
// BaseObjectData* object = 0;
// PluginFunctions::getObject( _id, object );
//
// if ( object && object->shaderNode() ){
// object->shaderNode()->setShader( descriptionsToDrawMode(_drawMode), _vertexShader.toStdString() , _fragmentShader.toStdString());
// }
}
void ViewControlPlugin::setShader(int _id, QString _drawMode, QString _name ){
if ( OpenFlipper::Options::nogui() )
return;
//get current shader index
int index = -1;
for ( int i = 0 ; i < (int)shaderList_.size(); ++i) {
if ( shaderList_[i].name == _name ) {
index = i;
break;
}
}
if ( index == -1 ) {
std::cerr << "Error: Shader not found! " << std::endl;
return;
}
BaseObjectData* object = 0;
PluginFunctions::getObject( _id, object );
if ( object && object->shaderNode() ){
std::cerr << "TODO : Get right shader from list, set uniforms as stored in the list" << std::endl;
}
}
Q_EXPORT_PLUGIN2( viewcontrolplugin , ViewControlPlugin );
......@@ -134,6 +134,19 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
/// Allows to enable/disable visualization of the objects modeling area for meshes
void showModelingAreas( int _id , bool _state );
/** Sets a shader for the object and the given drawMode( can be a combination of draw modes )
* @param _id Object Id
* @param _drawMode ; seperated list of drawmodes used by the shader
* @param _vertexShader File with the vertex shader code
* @param _fragmentShader File with the fragment shader code
*/
void setShader(int _id, QString _drawMode, QString _vertexShader, QString _fragmentShader );
/** Sets a Shader from the Shader directory of OpenFlipper ( Name of the one given inside the ini file )
*
*/
void setShader(int _id, QString _drawMode, QString _name );
};
#endif //ViewControlPlugin_HH
Supports Markdown
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