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/domInstance_geometry.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 domInstance_geometry::create(DAE& dae) 21 { 22 domInstance_geometryRef ref = new domInstance_geometry(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domInstance_geometry::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( "instance_geometry" ); 36 meta->registerClass(domInstance_geometry::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 41 42 mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 ); 43 mea->setName( "bind_material" ); 44 mea->setOffset( daeOffsetOf(domInstance_geometry,elemBind_material) ); 45 mea->setElementType( domBind_material::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); 49 mea->setName( "extra" ); 50 mea->setOffset( daeOffsetOf(domInstance_geometry,elemExtra_array) ); 51 mea->setElementType( domExtra::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 cm->setMaxOrdinal( 1 ); 55 meta->setCMRoot( cm ); 56 57 // Add attribute: url 58 { 59 daeMetaAttribute *ma = new daeMetaAttribute; 60 ma->setName( "url" ); 61 ma->setType( dae.getAtomicTypes().get("xsAnyURI")); 62 ma->setOffset( daeOffsetOf( domInstance_geometry , attrUrl )); 63 ma->setContainer( meta ); 64 ma->setIsRequired( true ); 65 66 meta->appendAttribute(ma); 67 } 68 69 // Add attribute: sid 70 { 71 daeMetaAttribute *ma = new daeMetaAttribute; 72 ma->setName( "sid" ); 73 ma->setType( dae.getAtomicTypes().get("xsNCName")); 74 ma->setOffset( daeOffsetOf( domInstance_geometry , attrSid )); 75 ma->setContainer( meta ); 76 77 meta->appendAttribute(ma); 78 } 79 80 // Add attribute: name 81 { 82 daeMetaAttribute *ma = new daeMetaAttribute; 83 ma->setName( "name" ); 84 ma->setType( dae.getAtomicTypes().get("xsNCName")); 85 ma->setOffset( daeOffsetOf( domInstance_geometry , attrName )); 86 ma->setContainer( meta ); 87 88 meta->appendAttribute(ma); 89 } 90 91 meta->setElementSize(sizeof(domInstance_geometry)); 92 meta->validate(); 93 94 return meta; 95 } 96 97