MCPcopy Create free account
hub / github.com/OGRECave/ogre / addControl

Method addControl

Samples/OceanDemo/src/MaterialControls.cpp:29–65  ·  view source on GitHub ↗

MaterialControls Methods *********************************************************************************/

Source from the content-addressed store, hash-verified

27 MaterialControls Methods
28*********************************************************************************/
29void MaterialControls::addControl(const Ogre::String& params)
30{
31 // params is a string containing using the following format:
32 // "<Control Name>, <Shader parameter name>, <Parameter Type>, <Min Val>, <Max Val>, <Parameter Sub Index>"
33
34 // break up long string into components
35 Ogre::StringVector vecparams = Ogre::StringUtil::split(params, ",");
36
37 // if there are not five elements then log error and move on
38 if (vecparams.size() != 6)
39 {
40 Ogre::LogManager::getSingleton().logMessage(
41 "Incorrect number of parameters passed in params string for MaterialControls::addControl()", Ogre::LML_CRITICAL);
42
43 return;
44 }
45
46 ShaderControl newControl;
47 Ogre::StringUtil::trim(vecparams[0]);
48 newControl.Name = vecparams[0];
49
50 Ogre::StringUtil::trim(vecparams[1]);
51 newControl.ParamName = vecparams[1];
52
53 Ogre::StringUtil::trim(vecparams[2]);
54 if (vecparams[2] == "GPU_VERTEX")
55 newControl.ValType = GPU_VERTEX;
56 else if (vecparams[2] == "GPU_FRAGMENT")
57 newControl.ValType = GPU_FRAGMENT;
58
59 newControl.MinVal = Ogre::StringConverter::parseReal(vecparams[3]);
60 newControl.MaxVal = Ogre::StringConverter::parseReal(vecparams[4]);
61 newControl.ElementIndex = Ogre::StringConverter::parseInt(vecparams[5]);
62
63 mShaderControlsContainer.push_back(newControl);
64
65}
66
67void loadMaterialControlsFile(MaterialControlsContainer& controlsContainer, const Ogre::String& filename)
68{

Callers 1

loadMaterialControlsFileFunction · 0.80

Calls 5

parseRealFunction · 0.85
parseIntFunction · 0.85
sizeMethod · 0.45
logMessageMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected