User guide
148
for (int i = 0; i < 4; ++i)
{
csValues[i][0] = 1.0f;
csValues[i][1] = 0.0f;
csValues[i][2] = 0.0f;
}
//tokenize input string
std::vector<char *> tokens;
//copy the paramstr because strtok wants to mark it up
char * inputParamStr = strdup(paramstr);
char * separator = const_cast<char *>(" ");
char * inputSource = inputParamStr, * cursor;
while ((cursor = strtok(inputSource, separator)))
{
inputSource = NULL;
tokens.push_back(cursor);
}
for (unsigned int i = 0; i < tokens.size(); ++i)
{
if (!strcmp(tokens[i], "-color"))
{
++i;
if (i+2 < tokens.size())
{
for (unsigned int j = 0; j < 3; ++j, ++i)
{
float value = atof(tokens[i]);
for (int k = 0; k < 4; ++k)
{
csValues[k][j] = value;
}
}
--i;
}
}
else if (!strcmp(tokens[i], "-radius"))
20 ARGS FILES IN SHADERS | EDIT SHADER INTERFACE INTERACTIVELY IN THE UI