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/domPlane.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 domPlane::create(DAE& dae) 21 { 22 domPlaneRef ref = new domPlane(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domPlane::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( "plane" ); 36 meta->registerClass(domPlane::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, 1, 1 ); 43 mea->setName( "equation" ); 44 mea->setOffset( daeOffsetOf(domPlane,elemEquation) ); 45 mea->setElementType( domPlane::domEquation::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); 49 mea->setName( "extra" ); 50 mea->setOffset( daeOffsetOf(domPlane,elemExtra_array) ); 51 mea->setElementType( domExtra::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 cm->setMaxOrdinal( 1 ); 55 meta->setCMRoot( cm ); 56 57 meta->setElementSize(sizeof(domPlane)); 58 meta->validate(); 59 60 return meta; 61 } 62 63 daeElementRef 64 domPlane::domEquation::create(DAE& dae) 65 { 66 domPlane::domEquationRef ref = new domPlane::domEquation(dae); 67 return ref; 68 } 69 70 71 daeMetaElement * 72 domPlane::domEquation::registerElement(DAE& dae) 73 { 74 daeMetaElement* meta = dae.getMeta(ID()); 75 if ( meta != NULL ) return meta; 76 77 meta = new daeMetaElement(dae); 78 dae.setMeta(ID(), *meta); 79 meta->setName( "equation" ); 80 meta->registerClass(domPlane::domEquation::create); 81 82 meta->setIsInnerClass( true ); 83 // Add attribute: _value 84 { 85 daeMetaAttribute *ma = new daeMetaArrayAttribute; 86 ma->setName( "_value" ); 87 ma->setType( dae.getAtomicTypes().get("Float4")); 88 ma->setOffset( daeOffsetOf( domPlane::domEquation , _value )); 89 ma->setContainer( meta ); 90 meta->appendAttribute(ma); 91 } 92 93 meta->setElementSize(sizeof(domPlane::domEquation)); 94 meta->validate(); 95 96 return meta; 97 } 98 99