Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions source/lib/ffglquickstart/FFGLPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,29 +261,31 @@ void Plugin::SetFragmentShader( std::string base )
fragmentShaderBase = base;
}

void Plugin::AddParam( std::shared_ptr< Param > param )
unsigned int Plugin::AddParam( std::shared_ptr< Param > param )
{
unsigned int new_index = (unsigned int)params.size();
SetParamInfo( new_index, param->GetName().c_str(), param->GetType(), param->GetValue() );
params.push_back( param );
return new_index;
}

void Plugin::AddParam( std::shared_ptr< ParamRange > param )
unsigned int Plugin::AddParam( std::shared_ptr< ParamRange > param )
{
unsigned int new_index = (unsigned int)params.size();
SetParamInfo( new_index, param->GetName().c_str(), param->GetType(), param->GetValue() );
//In FFGLPluginManager.cpp, line 274, SetParamInfo clamps the default value to 0...1 in case of FF_TYPE_STANDARD
//In FFGLPluginManager.cpp, line 274, SetParamInfo clamps the default value to 0...1 in case of FF_TYPE_STANDARD
if( param->GetValue() < 0.0f || param->GetValue() > 1.0f )
{
ParamInfo* paramInfo = FindParamInfo( new_index );
if ( paramInfo != nullptr )
if ( paramInfo != nullptr )
paramInfo->defaultFloatVal = param->GetValue();
}
SetParamRange( new_index, param->GetRange().min, param->GetRange().max );
params.push_back( param );
return new_index;
}

void Plugin::AddParam( std::shared_ptr< ParamOption > param )
unsigned int Plugin::AddParam( std::shared_ptr< ParamOption > param )
{
unsigned int new_index = (unsigned int)params.size();
SetOptionParamInfo( new_index, param->GetName().c_str(), (unsigned int)param->options.size(), param->GetValue() );
Expand All @@ -293,14 +295,16 @@ void Plugin::AddParam( std::shared_ptr< ParamOption > param )
SetParamElementInfo( new_index, i, param->options[ i ].name.c_str(), (float)i );
}
params.push_back( param );
return new_index;
}

void Plugin::AddParam( std::shared_ptr< ParamFFT > param )
unsigned int Plugin::AddParam( std::shared_ptr< ParamFFT > param )
{
audioParams[ param ] = Audio();
param->index = (unsigned int)params.size();
SetBufferParamInfo( param->index, param->GetName().c_str(), static_cast< unsigned int >( param->fftData.size() ), FF_USAGE_FFT );
params.push_back( param );
return param->index;
}

void Plugin::AddHueColorParam( std::string name )
Expand Down
12 changes: 8 additions & 4 deletions source/lib/ffglquickstart/FFGLPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,21 @@ class Plugin : public CFFGLPlugin
/// It also allows the plugin to automatically pass the current value of each parameters to the
/// shader before drawing.
/// \param param The parameter to add
void AddParam( std::shared_ptr< Param > param );
/// \return The index the param was added at.
unsigned int AddParam( std::shared_ptr< Param > param );
/// This function handle the special case where the parameter is a ParamRange
/// \param param The parameter to add
void AddParam( std::shared_ptr< ParamRange > param );
/// \return The index the param was added at.
unsigned int AddParam( std::shared_ptr< ParamRange > param );
/// This function handle the special case where the parameter is a ParamOption (When you have the
/// choice between different option).
/// \param param The parameter to add
void AddParam( std::shared_ptr< ParamOption > param );
/// \return The index the param was added at.
unsigned int AddParam( std::shared_ptr< ParamOption > param );
/// This function handle the special case where the parameter is a ParamFFT
/// \param param The parameter to add
void AddParam( std::shared_ptr< ParamFFT > fft );
/// \return The index the param was added at.
unsigned int AddParam( std::shared_ptr< ParamFFT > fft );
/// This function allows to create a Hue color param, for exemple in Resolume this will display a
/// color picker, which is very handy to choose your color.
/// \param name The name of the parameter to add
Expand Down