MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / parseProgramParameterDimensions

Function parseProgramParameterDimensions

OgreMain/src/OgreScriptTranslator.cpp:5021–5051  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

5019 }
5020 //-------------------------------------------------------------------------
5021 uint32 parseProgramParameterDimensions(String& declarator, String type)
5022 {
5023 // Assume 1 unless otherwise specified
5024 uint32 dimensions = 1;
5025
5026 size_t start = declarator.find_first_not_of(type);
5027
5028 if (start != String::npos)
5029 {
5030 size_t end = declarator.find_first_of("[", start);
5031
5032 // int1, int2, etc.
5033 if (end != start)
5034 {
5035 dimensions *= StringConverter::parseUnsignedInt(
5036 declarator.substr(start, end - start));
5037 start = end;
5038 }
5039
5040 // C-style array
5041 while (start != String::npos)
5042 {
5043 end = declarator.find_first_of("]", start);
5044 dimensions *= StringConverter::parseUnsignedInt(
5045 declarator.substr(start + 1, end - start - 1));
5046 start = declarator.find_first_of("[", end);
5047 }
5048 }
5049
5050 return dimensions;
5051 }
5052 //-------------------------------------------------------------------------
5053 void GpuProgramTranslator::translateProgramParameters(ScriptCompiler *compiler, GpuProgramParametersSharedPtr params, ObjectAbstractNode *obj)
5054 {

Callers 1

Calls 3

find_first_not_ofMethod · 0.80
find_first_ofMethod · 0.80
substrMethod · 0.45

Tested by

no test coverage detected