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

Method translateGpuProgram

OgreMain/src/OgreScriptTranslator.cpp:4701–4817  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

4699 }
4700 //-------------------------------------------------------------------------
4701 void GpuProgramTranslator::translateGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj)
4702 {
4703 list<std::pair<String,String> >::type customParameters;
4704 String syntax, source;
4705 AbstractNodePtr params;
4706 for(AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i)
4707 {
4708 if((*i)->type == ANT_PROPERTY)
4709 {
4710 PropertyAbstractNode *prop = (PropertyAbstractNode*)(*i).get();
4711 if(prop->id == ID_SOURCE)
4712 {
4713 if(!prop->values.empty())
4714 {
4715 if(prop->values.front()->type == ANT_ATOM)
4716 source = ((AtomAbstractNode*)prop->values.front().get())->value;
4717 else
4718 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
4719 "source file expected");
4720 }
4721 else
4722 {
4723 compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line,
4724 "source file expected");
4725 }
4726 }
4727 else if(prop->id == ID_SYNTAX)
4728 {
4729 if(!prop->values.empty())
4730 {
4731 if(prop->values.front()->type == ANT_ATOM)
4732 syntax = ((AtomAbstractNode*)prop->values.front().get())->value;
4733 else
4734 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
4735 "syntax string expected");
4736 }
4737 else
4738 {
4739 compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line,
4740 "syntax string expected");
4741 }
4742 }
4743 else
4744 {
4745 String name = prop->name, value;
4746 bool first = true;
4747 for(AbstractNodeList::iterator it = prop->values.begin(); it != prop->values.end(); ++it)
4748 {
4749 if((*it)->type == ANT_ATOM)
4750 {
4751 if(!first)
4752 value += " ";
4753 else
4754 first = false;
4755 value += ((AtomAbstractNode*)(*it).get())->value;
4756 }
4757 }
4758 customParameters.emplace_back( name, value );

Callers

nothing calls this directly

Calls 15

addErrorMethod · 0.80
isSyntaxSupportedMethod · 0.80
getResourceGroupMethod · 0.80
_fireEventMethod · 0.80
AnyFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected