| 654 | }*/ |
| 655 | |
| 656 | void HlmsTranslator::translate(ScriptCompiler *compiler, const AbstractNodePtr &node) |
| 657 | { |
| 658 | ObjectAbstractNode *obj = reinterpret_cast<ObjectAbstractNode*>(node.get()); |
| 659 | if(obj->name.empty()) |
| 660 | { |
| 661 | compiler->addError(ScriptCompiler::CE_OBJECTNAMEEXPECTED, obj->file, obj->line); |
| 662 | return; |
| 663 | } |
| 664 | |
| 665 | // Must have an HLMS type |
| 666 | if(obj->values.empty()) |
| 667 | { |
| 668 | compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, obj->file, obj->line, |
| 669 | "HLMS materials require type declaration. i.e. 'hlms myMaterial pbs'."); |
| 670 | return; |
| 671 | } |
| 672 | |
| 673 | // Get the type |
| 674 | String type; |
| 675 | if( !getString(obj->values.front(), &type) ) |
| 676 | { |
| 677 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, obj->file, obj->line); |
| 678 | return; |
| 679 | } |
| 680 | |
| 681 | HlmsManager *hlmsManager = Root::getSingleton().getHlmsManager(); |
| 682 | Hlms *hlms = 0; |
| 683 | // We need a map to deal with materials that define the same setting multiple times. |
| 684 | // The last defined version must win. |
| 685 | map<IdString, String>::type paramMap; |
| 686 | |
| 687 | const IdString idType( type ); |
| 688 | for( size_t i=0; i<HLMS_MAX && !hlms; ++i ) |
| 689 | { |
| 690 | hlms = hlmsManager->getHlms( static_cast<HlmsTypes>( i ) ); |
| 691 | |
| 692 | if( hlms && idType != hlms->getTypeName() ) |
| 693 | hlms = 0; //This one isn't, keep looking |
| 694 | } |
| 695 | |
| 696 | if( !hlms ) |
| 697 | { |
| 698 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, node->file, node->line, |
| 699 | type + " is not a valid hlms type"); |
| 700 | return; |
| 701 | } |
| 702 | |
| 703 | HlmsMacroblock macroblock; |
| 704 | HlmsBlendblock blendblock; |
| 705 | //obj->values |
| 706 | |
| 707 | // Create the workspace definition*/ |
| 708 | /*CreateCompositorScriptCompilerEvent evt(obj->file, obj->name, compiler->getResourceGroup()); |
| 709 | bool processed = compiler->_fireEvent(&evt, (void*)&mWorkspaceDef); |
| 710 | |
| 711 | if(!processed) |
| 712 | { |
| 713 | CompositorManager2 *compositorMgr = Root::getSingleton().getCompositorManager2(); |
no test coverage detected