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_setarray_type.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_setarray_type::create(DAE& dae) 21 { 22 domGlsl_setarray_typeRef ref = new domGlsl_setarray_type(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domGlsl_setarray_type::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_setarray_type" ); 36 meta->registerClass(domGlsl_setarray_type::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaChoice( meta, cm, 0, 0, 0, -1 ); 41 42 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 43 mea->setName( "glsl_param_type" ); 44 mea->setOffset( daeOffsetOf(domGlsl_setarray_type,elemGlsl_param_type_array) ); 45 mea->setElementType( domGlsl_param_type::registerElement(dae) ); 46 cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 49 mea->setName( "array" ); 50 mea->setOffset( daeOffsetOf(domGlsl_setarray_type,elemArray_array) ); 51 mea->setElementType( domGlsl_setarray_type::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 cm->setMaxOrdinal( 3000 ); 55 meta->setCMRoot( cm ); 56 // Ordered list of sub-elements 57 meta->addContents(daeOffsetOf(domGlsl_setarray_type,_contents)); 58 meta->addContentsOrder(daeOffsetOf(domGlsl_setarray_type,_contentsOrder)); 59 60 meta->addCMDataArray(daeOffsetOf(domGlsl_setarray_type,_CMData), 1); 61 // Add attribute: length 62 { 63 daeMetaAttribute *ma = new daeMetaAttribute; 64 ma->setName( "length" ); 65 ma->setType( dae.getAtomicTypes().get("xsPositiveInteger")); 66 ma->setOffset( daeOffsetOf( domGlsl_setarray_type , attrLength )); 67 ma->setContainer( meta ); 68 ma->setIsRequired( false ); 69 70 meta->appendAttribute(ma); 71 } 72 73 meta->setElementSize(sizeof(domGlsl_setarray_type)); 74 meta->validate(); 75 76 return meta; 77 } 78 79