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/domPhysics_model.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 19daeElementRef 20domPhysics_model::create(DAE& dae) 21{ 22 domPhysics_modelRef ref = new domPhysics_model(dae); 23 return ref; 24} 25 26 27daeMetaElement * 28domPhysics_model::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( "physics_model" ); 36 meta->registerClass(domPhysics_model::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( "asset" ); 44 mea->setOffset( daeOffsetOf(domPhysics_model,elemAsset) ); 45 mea->setElementType( domAsset::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 ); 49 mea->setName( "rigid_body" ); 50 mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_body_array) ); 51 mea->setElementType( domRigid_body::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); 55 mea->setName( "rigid_constraint" ); 56 mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_constraint_array) ); 57 mea->setElementType( domRigid_constraint::registerElement(dae) ); 58 cm->appendChild( mea ); 59 60 mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 ); 61 mea->setName( "instance_physics_model" ); 62 mea->setOffset( daeOffsetOf(domPhysics_model,elemInstance_physics_model_array) ); 63 mea->setElementType( domInstance_physics_model::registerElement(dae) ); 64 cm->appendChild( mea ); 65 66 mea = new daeMetaElementArrayAttribute( meta, cm, 4, 0, -1 ); 67 mea->setName( "extra" ); 68 mea->setOffset( daeOffsetOf(domPhysics_model,elemExtra_array) ); 69 mea->setElementType( domExtra::registerElement(dae) ); 70 cm->appendChild( mea ); 71 72 cm->setMaxOrdinal( 4 ); 73 meta->setCMRoot( cm ); 74 75 // Add attribute: id 76 { 77 daeMetaAttribute *ma = new daeMetaAttribute; 78 ma->setName( "id" ); 79 ma->setType( dae.getAtomicTypes().get("xsID")); 80 ma->setOffset( daeOffsetOf( domPhysics_model , attrId )); 81 ma->setContainer( meta ); 82 83 meta->appendAttribute(ma); 84 } 85 86 // Add attribute: name 87 { 88 daeMetaAttribute *ma = new daeMetaAttribute; 89 ma->setName( "name" ); 90 ma->setType( dae.getAtomicTypes().get("xsNCName")); 91 ma->setOffset( daeOffsetOf( domPhysics_model , attrName )); 92 ma->setContainer( meta ); 93 94 meta->appendAttribute(ma); 95 } 96 97 meta->setElementSize(sizeof(domPhysics_model)); 98 meta->validate(); 99 100 return meta; 101} 102 103