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/domPolygons.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 domPolygons::create(DAE& dae) 21 { 22 domPolygonsRef ref = new domPolygons(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domPolygons::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( "polygons" ); 36 meta->registerClass(domPolygons::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( "input" ); 44 mea->setOffset( daeOffsetOf(domPolygons,elemInput_array) ); 45 mea->setElementType( domInputLocalOffset::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 cm = new daeMetaChoice( meta, cm, 0, 1, 0, -1 ); 49 50 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 51 mea->setName( "p" ); 52 mea->setOffset( daeOffsetOf(domPolygons,elemP_array) ); 53 mea->setElementType( domP::registerElement(dae) ); 54 cm->appendChild( mea ); 55 56 mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 ); 57 mea->setName( "ph" ); 58 mea->setOffset( daeOffsetOf(domPolygons,elemPh_array) ); 59 mea->setElementType( domPolygons::domPh::registerElement(dae) ); 60 cm->appendChild( mea ); 61 62 cm->setMaxOrdinal( 0 ); 63 cm->getParent()->appendChild( cm ); 64 cm = cm->getParent(); 65 66 mea = new daeMetaElementArrayAttribute( meta, cm, 3002, 0, -1 ); 67 mea->setName( "extra" ); 68 mea->setOffset( daeOffsetOf(domPolygons,elemExtra_array) ); 69 mea->setElementType( domExtra::registerElement(dae) ); 70 cm->appendChild( mea ); 71 72 cm->setMaxOrdinal( 3002 ); 73 meta->setCMRoot( cm ); 74 // Ordered list of sub-elements 75 meta->addContents(daeOffsetOf(domPolygons,_contents)); 76 meta->addContentsOrder(daeOffsetOf(domPolygons,_contentsOrder)); 77 78 meta->addCMDataArray(daeOffsetOf(domPolygons,_CMData), 1); 79 // Add attribute: name 80 { 81 daeMetaAttribute *ma = new daeMetaAttribute; 82 ma->setName( "name" ); 83 ma->setType( dae.getAtomicTypes().get("xsNCName")); 84 ma->setOffset( daeOffsetOf( domPolygons , attrName )); 85 ma->setContainer( meta ); 86 87 meta->appendAttribute(ma); 88 } 89 90 // Add attribute: count 91 { 92 daeMetaAttribute *ma = new daeMetaAttribute; 93 ma->setName( "count" ); 94 ma->setType( dae.getAtomicTypes().get("Uint")); 95 ma->setOffset( daeOffsetOf( domPolygons , attrCount )); 96 ma->setContainer( meta ); 97 ma->setIsRequired( true ); 98 99 meta->appendAttribute(ma); 100 } 101 102 // Add attribute: material 103 { 104 daeMetaAttribute *ma = new daeMetaAttribute; 105 ma->setName( "material" ); 106 ma->setType( dae.getAtomicTypes().get("xsNCName")); 107 ma->setOffset( daeOffsetOf( domPolygons , attrMaterial )); 108 ma->setContainer( meta ); 109 110 meta->appendAttribute(ma); 111 } 112 113 meta->setElementSize(sizeof(domPolygons)); 114 meta->validate(); 115 116 return meta; 117 } 118 119 daeElementRef 120 domPolygons::domPh::create(DAE& dae) 121 { 122 domPolygons::domPhRef ref = new domPolygons::domPh(dae); 123 return ref; 124 } 125 126 127 daeMetaElement * 128 domPolygons::domPh::registerElement(DAE& dae) 129 { 130 daeMetaElement* meta = dae.getMeta(ID()); 131 if ( meta != NULL ) return meta; 132 133 meta = new daeMetaElement(dae); 134 dae.setMeta(ID(), *meta); 135 meta->setName( "ph" ); 136 meta->registerClass(domPolygons::domPh::create); 137 138 meta->setIsInnerClass( true ); 139 daeMetaCMPolicy *cm = NULL; 140 daeMetaElementAttribute *mea = NULL; 141 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 142 143 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 144 mea->setName( "p" ); 145 mea->setOffset( daeOffsetOf(domPolygons::domPh,elemP) ); 146 mea->setElementType( domP::registerElement(dae) ); 147 cm->appendChild( mea ); 148 149 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 ); 150 mea->setName( "h" ); 151 mea->setOffset( daeOffsetOf(domPolygons::domPh,elemH_array) ); 152 mea->setElementType( domPolygons::domPh::domH::registerElement(dae) ); 153 cm->appendChild( mea ); 154 155 cm->setMaxOrdinal( 1 ); 156 meta->setCMRoot( cm ); 157 158 meta->setElementSize(sizeof(domPolygons::domPh)); 159 meta->validate(); 160 161 return meta; 162 } 163 164 daeElementRef 165 domPolygons::domPh::domH::create(DAE& dae) 166 { 167 domPolygons::domPh::domHRef ref = new domPolygons::domPh::domH(dae); 168 return ref; 169 } 170 171 172 daeMetaElement * 173 domPolygons::domPh::domH::registerElement(DAE& dae) 174 { 175 daeMetaElement* meta = dae.getMeta(ID()); 176 if ( meta != NULL ) return meta; 177 178 meta = new daeMetaElement(dae); 179 dae.setMeta(ID(), *meta); 180 meta->setName( "h" ); 181 meta->registerClass(domPolygons::domPh::domH::create); 182 183 meta->setIsInnerClass( true ); 184 // Add attribute: _value 185 { 186 daeMetaAttribute *ma = new daeMetaArrayAttribute; 187 ma->setName( "_value" ); 188 ma->setType( dae.getAtomicTypes().get("ListOfUInts")); 189 ma->setOffset( daeOffsetOf( domPolygons::domPh::domH , _value )); 190 ma->setContainer( meta ); 191 meta->appendAttribute(ma); 192 } 193 194 meta->setElementSize(sizeof(domPolygons::domPh::domH)); 195 meta->validate(); 196 197 return meta; 198 } 199 200