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

Method translateHighLevelGpuProgram

OgreMain/src/OgreScriptTranslator.cpp:4904–5019  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

4902 }
4903 //-------------------------------------------------------------------------
4904 void GpuProgramTranslator::translateHighLevelGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj)
4905 {
4906 if(obj->values.empty())
4907 {
4908 compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, obj->file, obj->line);
4909 return;
4910 }
4911 String language;
4912 if(!getString(obj->values.front(), &language))
4913 {
4914 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, obj->file, obj->line);
4915 return;
4916 }
4917
4918 list<std::pair<String,String> >::type customParameters;
4919 String source;
4920 AbstractNodePtr params;
4921 for(AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
4922 {
4923 if((*i)->type == ANT_PROPERTY)
4924 {
4925 PropertyAbstractNode *prop = (PropertyAbstractNode*)(*i).get();
4926 if(prop->id == ID_SOURCE)
4927 {
4928 if(!prop->values.empty())
4929 {
4930 if(prop->values.front()->type == ANT_ATOM)
4931 source = ((AtomAbstractNode*)prop->values.front().get())->value;
4932 else
4933 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
4934 "source file expected");
4935 }
4936 else
4937 {
4938 compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line,
4939 "source file expected");
4940 }
4941 }
4942 else
4943 {
4944 String name = prop->name, value;
4945 bool first = true;
4946 for(AbstractNodeList::iterator it = prop->values.begin(); it != prop->values.end(); ++it)
4947 {
4948 if((*it)->type == ANT_ATOM)
4949 {
4950 if(!first)
4951 value += " ";
4952 else
4953 first = false;
4954
4955 if(prop->name == "attach")
4956 {
4957 ProcessResourceNameScriptCompilerEvent evt(ProcessResourceNameScriptCompilerEvent::GPU_PROGRAM, ((AtomAbstractNode*)(*it).get())->value);
4958 compiler->_fireEvent(&evt, 0);
4959 value += evt.mName;
4960 }
4961 else

Callers

nothing calls this directly

Calls 15

addErrorMethod · 0.80
_fireEventMethod · 0.80
getResourceGroupMethod · 0.80
setSourceFileMethod · 0.80
setPrefabRootLayoutMethod · 0.80
AnyFunction · 0.50
emptyMethod · 0.45
frontMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected