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_material.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 domPhysics_material::create(DAE& dae) 21 { 22 domPhysics_materialRef ref = new domPhysics_material(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domPhysics_material::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_material" ); 36 meta->registerClass(domPhysics_material::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_material,elemAsset) ); 45 mea->setElementType( domAsset::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 ); 49 mea->setName( "technique_common" ); 50 mea->setOffset( daeOffsetOf(domPhysics_material,elemTechnique_common) ); 51 mea->setElementType( domPhysics_material::domTechnique_common::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); 55 mea->setName( "technique" ); 56 mea->setOffset( daeOffsetOf(domPhysics_material,elemTechnique_array) ); 57 mea->setElementType( domTechnique::registerElement(dae) ); 58 cm->appendChild( mea ); 59 60 mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 ); 61 mea->setName( "extra" ); 62 mea->setOffset( daeOffsetOf(domPhysics_material,elemExtra_array) ); 63 mea->setElementType( domExtra::registerElement(dae) ); 64 cm->appendChild( mea ); 65 66 cm->setMaxOrdinal( 3 ); 67 meta->setCMRoot( cm ); 68 69 // Add attribute: id 70 { 71 daeMetaAttribute *ma = new daeMetaAttribute; 72 ma->setName( "id" ); 73 ma->setType( dae.getAtomicTypes().get("xsID")); 74 ma->setOffset( daeOffsetOf( domPhysics_material , attrId )); 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( domPhysics_material , attrName )); 86 ma->setContainer( meta ); 87 88 meta->appendAttribute(ma); 89 } 90 91 meta->setElementSize(sizeof(domPhysics_material)); 92 meta->validate(); 93 94 return meta; 95 } 96 97 daeElementRef 98 domPhysics_material::domTechnique_common::create(DAE& dae) 99 { 100 domPhysics_material::domTechnique_commonRef ref = new domPhysics_material::domTechnique_common(dae); 101 return ref; 102 } 103 104 105 daeMetaElement * 106 domPhysics_material::domTechnique_common::registerElement(DAE& dae) 107 { 108 daeMetaElement* meta = dae.getMeta(ID()); 109 if ( meta != NULL ) return meta; 110 111 meta = new daeMetaElement(dae); 112 dae.setMeta(ID(), *meta); 113 meta->setName( "technique_common" ); 114 meta->registerClass(domPhysics_material::domTechnique_common::create); 115 116 meta->setIsInnerClass( true ); 117 daeMetaCMPolicy *cm = NULL; 118 daeMetaElementAttribute *mea = NULL; 119 cm = new daeMetaSequence( meta, cm, 0, 1, 1 ); 120 121 mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 ); 122 mea->setName( "dynamic_friction" ); 123 mea->setOffset( daeOffsetOf(domPhysics_material::domTechnique_common,elemDynamic_friction) ); 124 mea->setElementType( domTargetableFloat::registerElement(dae) ); 125 cm->appendChild( mea ); 126 127 mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 ); 128 mea->setName( "restitution" ); 129 mea->setOffset( daeOffsetOf(domPhysics_material::domTechnique_common,elemRestitution) ); 130 mea->setElementType( domTargetableFloat::registerElement(dae) ); 131 cm->appendChild( mea ); 132 133 mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 ); 134 mea->setName( "static_friction" ); 135 mea->setOffset( daeOffsetOf(domPhysics_material::domTechnique_common,elemStatic_friction) ); 136 mea->setElementType( domTargetableFloat::registerElement(dae) ); 137 cm->appendChild( mea ); 138 139 cm->setMaxOrdinal( 2 ); 140 meta->setCMRoot( cm ); 141 142 meta->setElementSize(sizeof(domPhysics_material::domTechnique_common)); 143 meta->validate(); 144 145 return meta; 146 } 147 148