1 /* 2 * Copyright 2006 Sony Computer Entertainment Inc. 3 * 4 * Licensed under the MIT Open Source License, for details please see license.txt or the website 5 * http://www.opensource.org/licenses/mit-license.php 6 * 7 */ 8 9 #include <dae.h> 10 #include <dae/daeDom.h> 11 #include <dom/domGlsl_setparam.h> 12 #include <dae/daeMetaCMPolicy.h> 13 #include <dae/daeMetaSequence.h> 14 #include <dae/daeMetaChoice.h> 15 #include <dae/daeMetaGroup.h> 16 #include <dae/daeMetaAny.h> 17 #include <dae/daeMetaElementAttribute.h> 18 19 daeElementRef 20 domGlsl_setparam::create(DAE& dae) 21 { 22 domGlsl_setparamRef ref = new domGlsl_setparam(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domGlsl_setparam::registerElement(DAE& dae) 29 { 30 daeMetaElement* meta = dae.getMeta(ID()); 31 if ( meta != NULL ) return meta; 32 33 meta = new daeMetaElement(dae); 34 dae.setMeta(ID(), *meta); 35 meta->setName( "glsl_setparam" ); 36 meta->registerClass(domGlsl_setparam::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 41 42 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 ); 43 mea->setName( "annotate" ); 44 mea->setOffset( daeOffsetOf(domGlsl_setparam,elemAnnotate_array) ); 45 mea->setElementType( domFx_annotate_common::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 cm = new daeMetaChoice( meta, cm, 0, 1, 1, 1 ); 49 50 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 51 mea->setName( "glsl_param_type" ); 52 mea->setOffset( daeOffsetOf(domGlsl_setparam,elemGlsl_param_type) ); 53 mea->setElementType( domGlsl_param_type::registerElement(dae) ); 54 cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) ); 55 56 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 57 mea->setName( "array" ); 58 mea->setOffset( daeOffsetOf(domGlsl_setparam,elemArray) ); 59 mea->setElementType( domGlsl_setarray_type::registerElement(dae) ); 60 cm->appendChild( mea ); 61 62 cm->setMaxOrdinal( 0 ); 63 cm->getParent()->appendChild( cm ); 64 cm = cm->getParent(); 65 66 cm->setMaxOrdinal( 1 ); 67 meta->setCMRoot( cm ); 68 // Ordered list of sub-elements 69 meta->addContents(daeOffsetOf(domGlsl_setparam,_contents)); 70 meta->addContentsOrder(daeOffsetOf(domGlsl_setparam,_contentsOrder)); 71 72 meta->addCMDataArray(daeOffsetOf(domGlsl_setparam,_CMData), 1); 73 // Add attribute: ref 74 { 75 daeMetaAttribute *ma = new daeMetaAttribute; 76 ma->setName( "ref" ); 77 ma->setType( dae.getAtomicTypes().get("Glsl_identifier")); 78 ma->setOffset( daeOffsetOf( domGlsl_setparam , attrRef )); 79 ma->setContainer( meta ); 80 ma->setIsRequired( true ); 81 82 meta->appendAttribute(ma); 83 } 84 85 // Add attribute: program 86 { 87 daeMetaAttribute *ma = new daeMetaAttribute; 88 ma->setName( "program" ); 89 ma->setType( dae.getAtomicTypes().get("xsNCName")); 90 ma->setOffset( daeOffsetOf( domGlsl_setparam , attrProgram )); 91 ma->setContainer( meta ); 92 93 meta->appendAttribute(ma); 94 } 95 96 meta->setElementSize(sizeof(domGlsl_setparam)); 97 meta->validate(); 98 99 return meta; 100 } 101 102