Home | History | Annotate | Download | only in dom
      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_scene.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_scene::create(DAE& dae)
     21 {
     22 	domPhysics_sceneRef ref = new domPhysics_scene(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domPhysics_scene::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_scene" );
     36 	meta->registerClass(domPhysics_scene::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_scene,elemAsset) );
     45 	mea->setElementType( domAsset::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 );
     49 	mea->setName( "instance_force_field" );
     50 	mea->setOffset( daeOffsetOf(domPhysics_scene,elemInstance_force_field_array) );
     51 	mea->setElementType( domInstance_force_field::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
     55 	mea->setName( "instance_physics_model" );
     56 	mea->setOffset( daeOffsetOf(domPhysics_scene,elemInstance_physics_model_array) );
     57 	mea->setElementType( domInstance_physics_model::registerElement(dae) );
     58 	cm->appendChild( mea );
     59 
     60 	mea = new daeMetaElementAttribute( meta, cm, 3, 1, 1 );
     61 	mea->setName( "technique_common" );
     62 	mea->setOffset( daeOffsetOf(domPhysics_scene,elemTechnique_common) );
     63 	mea->setElementType( domPhysics_scene::domTechnique_common::registerElement(dae) );
     64 	cm->appendChild( mea );
     65 
     66 	mea = new daeMetaElementArrayAttribute( meta, cm, 4, 0, -1 );
     67 	mea->setName( "technique" );
     68 	mea->setOffset( daeOffsetOf(domPhysics_scene,elemTechnique_array) );
     69 	mea->setElementType( domTechnique::registerElement(dae) );
     70 	cm->appendChild( mea );
     71 
     72 	mea = new daeMetaElementArrayAttribute( meta, cm, 5, 0, -1 );
     73 	mea->setName( "extra" );
     74 	mea->setOffset( daeOffsetOf(domPhysics_scene,elemExtra_array) );
     75 	mea->setElementType( domExtra::registerElement(dae) );
     76 	cm->appendChild( mea );
     77 
     78 	cm->setMaxOrdinal( 5 );
     79 	meta->setCMRoot( cm );
     80 
     81 	//	Add attribute: id
     82 	{
     83 		daeMetaAttribute *ma = new daeMetaAttribute;
     84 		ma->setName( "id" );
     85 		ma->setType( dae.getAtomicTypes().get("xsID"));
     86 		ma->setOffset( daeOffsetOf( domPhysics_scene , attrId ));
     87 		ma->setContainer( meta );
     88 
     89 		meta->appendAttribute(ma);
     90 	}
     91 
     92 	//	Add attribute: name
     93 	{
     94 		daeMetaAttribute *ma = new daeMetaAttribute;
     95 		ma->setName( "name" );
     96 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
     97 		ma->setOffset( daeOffsetOf( domPhysics_scene , attrName ));
     98 		ma->setContainer( meta );
     99 
    100 		meta->appendAttribute(ma);
    101 	}
    102 
    103 	meta->setElementSize(sizeof(domPhysics_scene));
    104 	meta->validate();
    105 
    106 	return meta;
    107 }
    108 
    109 daeElementRef
    110 domPhysics_scene::domTechnique_common::create(DAE& dae)
    111 {
    112 	domPhysics_scene::domTechnique_commonRef ref = new domPhysics_scene::domTechnique_common(dae);
    113 	return ref;
    114 }
    115 
    116 
    117 daeMetaElement *
    118 domPhysics_scene::domTechnique_common::registerElement(DAE& dae)
    119 {
    120 	daeMetaElement* meta = dae.getMeta(ID());
    121 	if ( meta != NULL ) return meta;
    122 
    123 	meta = new daeMetaElement(dae);
    124 	dae.setMeta(ID(), *meta);
    125 	meta->setName( "technique_common" );
    126 	meta->registerClass(domPhysics_scene::domTechnique_common::create);
    127 
    128 	meta->setIsInnerClass( true );
    129 	daeMetaCMPolicy *cm = NULL;
    130 	daeMetaElementAttribute *mea = NULL;
    131 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
    132 
    133 	mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
    134 	mea->setName( "gravity" );
    135 	mea->setOffset( daeOffsetOf(domPhysics_scene::domTechnique_common,elemGravity) );
    136 	mea->setElementType( domTargetableFloat3::registerElement(dae) );
    137 	cm->appendChild( mea );
    138 
    139 	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
    140 	mea->setName( "time_step" );
    141 	mea->setOffset( daeOffsetOf(domPhysics_scene::domTechnique_common,elemTime_step) );
    142 	mea->setElementType( domTargetableFloat::registerElement(dae) );
    143 	cm->appendChild( mea );
    144 
    145 	cm->setMaxOrdinal( 1 );
    146 	meta->setCMRoot( cm );
    147 
    148 	meta->setElementSize(sizeof(domPhysics_scene::domTechnique_common));
    149 	meta->validate();
    150 
    151 	return meta;
    152 }
    153 
    154