## Introduction¶

Editing a SDK object with a parameter

You may add parameters to your type plugins, which are fully integrated in the graphical user interface and in the file formats, so that the user may change the node properties.

This is done by overloading the functions getParameters and getParameter in your node class, using the IParamList and IParamValue interfaces.

## Example¶

We will show how to add a parameter to our Environment plugin example. The blue and orange hemispheres were aligned on the X axis, we would like the user to freely choose the axis.

We start from the previous plugin code, copying the files to test2environmnent.cpp, test2environment.h, and the class to Test2Environment.

## Implementation¶

In IEnvironmentPlugin::addRadianceValues(), instead of checking the sign of direction[0], we check the sign of its dot product with axis:

float l = direction.dotProduct(axis);
if(l>0.0f && wl>500E-9f || l<0.0f && wl<500E-9f)
{
sptr[0][i] += 0.5E9f;
}


No change is required to sampling and pdf functions as we still sample uniformly.

We then implement IEnvironmentPlugin::getParameters to declare the axis, as a vector parameter which is normalized (see IParamList::addUnitVector)

void Test2Environment::getParameters(Ocean::Sdk::IParamList * iParamList)
{
}


We then implement IEnvironmentPlugin::setParameter to so that Ocean may ask the plugin to update the axis value, when a scene is loaded or when the user changes it:

bool Test2Environment::setParameter(const char * parameterName,
const Ocean::Sdk::IParamValue & value)
{
std::string name(parameterName);

if(name=="axis")
{
axis = value.toVec3();
}
else
{
//We do not recognize the parameter name
return false;
}
}


## Result¶

The image shows the result with a tilted axis:

Example of a procedural environment plugin

Environment definition:

<environment type="sdktest/test2" name="studio" axis="-0.714143 0.7 0"/>