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/domCommon_transparent_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 domCommon_transparent_type::create(DAE& dae) 21 { 22 domCommon_transparent_typeRef ref = new domCommon_transparent_type(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domCommon_transparent_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( "common_transparent_type" ); 36 meta->registerClass(domCommon_transparent_type::create); 37 38 daeMetaCMPolicy *cm = NULL; 39 daeMetaElementAttribute *mea = NULL; 40 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 41 42 cm = new daeMetaChoice( meta, cm, 0, 0, 1, 1 ); 43 44 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 45 mea->setName( "color" ); 46 mea->setOffset( daeOffsetOf(domCommon_transparent_type,elemColor) ); 47 mea->setElementType( domColor::registerElement(dae) ); 48 cm->appendChild( mea ); 49 50 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 51 mea->setName( "param" ); 52 mea->setOffset( daeOffsetOf(domCommon_transparent_type,elemParam) ); 53 mea->setElementType( domParam::registerElement(dae) ); 54 cm->appendChild( mea ); 55 56 mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 ); 57 mea->setName( "texture" ); 58 mea->setOffset( daeOffsetOf(domCommon_transparent_type,elemTexture) ); 59 mea->setElementType( domTexture::registerElement(dae) ); 60 cm->appendChild( mea ); 61 62 cm->setMaxOrdinal( 0 ); 63 cm->getParent()->appendChild( cm ); 64 cm = cm->getParent(); 65 66 cm->setMaxOrdinal( 0 ); 67 meta->setCMRoot( cm ); 68 // Ordered list of sub-elements 69 meta->addContents(daeOffsetOf(domCommon_transparent_type,_contents)); 70 meta->addContentsOrder(daeOffsetOf(domCommon_transparent_type,_contentsOrder)); 71 72 meta->addCMDataArray(daeOffsetOf(domCommon_transparent_type,_CMData), 1); 73 // Add attribute: opaque 74 { 75 daeMetaAttribute *ma = new daeMetaAttribute; 76 ma->setName( "opaque" ); 77 ma->setType( dae.getAtomicTypes().get("Fx_opaque_enum")); 78 ma->setOffset( daeOffsetOf( domCommon_transparent_type , attrOpaque )); 79 ma->setContainer( meta ); 80 ma->setDefaultString( "A_ONE"); 81 82 meta->appendAttribute(ma); 83 } 84 85 meta->setElementSize(sizeof(domCommon_transparent_type)); 86 meta->validate(); 87 88 return meta; 89 } 90 91