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/domSkin.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 domSkin::create(DAE& dae)
     21 {
     22 	domSkinRef ref = new domSkin(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domSkin::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( "skin" );
     36 	meta->registerClass(domSkin::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( "bind_shape_matrix" );
     44 	mea->setOffset( daeOffsetOf(domSkin,elemBind_shape_matrix) );
     45 	mea->setElementType( domSkin::domBind_shape_matrix::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 3, -1 );
     49 	mea->setName( "source" );
     50 	mea->setOffset( daeOffsetOf(domSkin,elemSource_array) );
     51 	mea->setElementType( domSource::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementAttribute( meta, cm, 2, 1, 1 );
     55 	mea->setName( "joints" );
     56 	mea->setOffset( daeOffsetOf(domSkin,elemJoints) );
     57 	mea->setElementType( domSkin::domJoints::registerElement(dae) );
     58 	cm->appendChild( mea );
     59 
     60 	mea = new daeMetaElementAttribute( meta, cm, 3, 1, 1 );
     61 	mea->setName( "vertex_weights" );
     62 	mea->setOffset( daeOffsetOf(domSkin,elemVertex_weights) );
     63 	mea->setElementType( domSkin::domVertex_weights::registerElement(dae) );
     64 	cm->appendChild( mea );
     65 
     66 	mea = new daeMetaElementArrayAttribute( meta, cm, 4, 0, -1 );
     67 	mea->setName( "extra" );
     68 	mea->setOffset( daeOffsetOf(domSkin,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: source
     76 	{
     77 		daeMetaAttribute *ma = new daeMetaAttribute;
     78 		ma->setName( "source" );
     79 		ma->setType( dae.getAtomicTypes().get("xsAnyURI"));
     80 		ma->setOffset( daeOffsetOf( domSkin , attrSource ));
     81 		ma->setContainer( meta );
     82 		ma->setIsRequired( true );
     83 
     84 		meta->appendAttribute(ma);
     85 	}
     86 
     87 	meta->setElementSize(sizeof(domSkin));
     88 	meta->validate();
     89 
     90 	return meta;
     91 }
     92 
     93 daeElementRef
     94 domSkin::domBind_shape_matrix::create(DAE& dae)
     95 {
     96 	domSkin::domBind_shape_matrixRef ref = new domSkin::domBind_shape_matrix(dae);
     97 	return ref;
     98 }
     99 
    100 
    101 daeMetaElement *
    102 domSkin::domBind_shape_matrix::registerElement(DAE& dae)
    103 {
    104 	daeMetaElement* meta = dae.getMeta(ID());
    105 	if ( meta != NULL ) return meta;
    106 
    107 	meta = new daeMetaElement(dae);
    108 	dae.setMeta(ID(), *meta);
    109 	meta->setName( "bind_shape_matrix" );
    110 	meta->registerClass(domSkin::domBind_shape_matrix::create);
    111 
    112 	meta->setIsInnerClass( true );
    113 	//	Add attribute: _value
    114 	{
    115 		daeMetaAttribute *ma = new daeMetaArrayAttribute;
    116 		ma->setName( "_value" );
    117 		ma->setType( dae.getAtomicTypes().get("Float4x4"));
    118 		ma->setOffset( daeOffsetOf( domSkin::domBind_shape_matrix , _value ));
    119 		ma->setContainer( meta );
    120 		meta->appendAttribute(ma);
    121 	}
    122 
    123 	meta->setElementSize(sizeof(domSkin::domBind_shape_matrix));
    124 	meta->validate();
    125 
    126 	return meta;
    127 }
    128 
    129 daeElementRef
    130 domSkin::domJoints::create(DAE& dae)
    131 {
    132 	domSkin::domJointsRef ref = new domSkin::domJoints(dae);
    133 	return ref;
    134 }
    135 
    136 
    137 daeMetaElement *
    138 domSkin::domJoints::registerElement(DAE& dae)
    139 {
    140 	daeMetaElement* meta = dae.getMeta(ID());
    141 	if ( meta != NULL ) return meta;
    142 
    143 	meta = new daeMetaElement(dae);
    144 	dae.setMeta(ID(), *meta);
    145 	meta->setName( "joints" );
    146 	meta->registerClass(domSkin::domJoints::create);
    147 
    148 	meta->setIsInnerClass( true );
    149 	daeMetaCMPolicy *cm = NULL;
    150 	daeMetaElementAttribute *mea = NULL;
    151 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
    152 
    153 	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 2, -1 );
    154 	mea->setName( "input" );
    155 	mea->setOffset( daeOffsetOf(domSkin::domJoints,elemInput_array) );
    156 	mea->setElementType( domInputLocal::registerElement(dae) );
    157 	cm->appendChild( mea );
    158 
    159 	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 );
    160 	mea->setName( "extra" );
    161 	mea->setOffset( daeOffsetOf(domSkin::domJoints,elemExtra_array) );
    162 	mea->setElementType( domExtra::registerElement(dae) );
    163 	cm->appendChild( mea );
    164 
    165 	cm->setMaxOrdinal( 1 );
    166 	meta->setCMRoot( cm );
    167 
    168 	meta->setElementSize(sizeof(domSkin::domJoints));
    169 	meta->validate();
    170 
    171 	return meta;
    172 }
    173 
    174 daeElementRef
    175 domSkin::domVertex_weights::create(DAE& dae)
    176 {
    177 	domSkin::domVertex_weightsRef ref = new domSkin::domVertex_weights(dae);
    178 	return ref;
    179 }
    180 
    181 
    182 daeMetaElement *
    183 domSkin::domVertex_weights::registerElement(DAE& dae)
    184 {
    185 	daeMetaElement* meta = dae.getMeta(ID());
    186 	if ( meta != NULL ) return meta;
    187 
    188 	meta = new daeMetaElement(dae);
    189 	dae.setMeta(ID(), *meta);
    190 	meta->setName( "vertex_weights" );
    191 	meta->registerClass(domSkin::domVertex_weights::create);
    192 
    193 	meta->setIsInnerClass( true );
    194 	daeMetaCMPolicy *cm = NULL;
    195 	daeMetaElementAttribute *mea = NULL;
    196 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
    197 
    198 	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 2, -1 );
    199 	mea->setName( "input" );
    200 	mea->setOffset( daeOffsetOf(domSkin::domVertex_weights,elemInput_array) );
    201 	mea->setElementType( domInputLocalOffset::registerElement(dae) );
    202 	cm->appendChild( mea );
    203 
    204 	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
    205 	mea->setName( "vcount" );
    206 	mea->setOffset( daeOffsetOf(domSkin::domVertex_weights,elemVcount) );
    207 	mea->setElementType( domSkin::domVertex_weights::domVcount::registerElement(dae) );
    208 	cm->appendChild( mea );
    209 
    210 	mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 );
    211 	mea->setName( "v" );
    212 	mea->setOffset( daeOffsetOf(domSkin::domVertex_weights,elemV) );
    213 	mea->setElementType( domSkin::domVertex_weights::domV::registerElement(dae) );
    214 	cm->appendChild( mea );
    215 
    216 	mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 );
    217 	mea->setName( "extra" );
    218 	mea->setOffset( daeOffsetOf(domSkin::domVertex_weights,elemExtra_array) );
    219 	mea->setElementType( domExtra::registerElement(dae) );
    220 	cm->appendChild( mea );
    221 
    222 	cm->setMaxOrdinal( 3 );
    223 	meta->setCMRoot( cm );
    224 
    225 	//	Add attribute: count
    226 	{
    227 		daeMetaAttribute *ma = new daeMetaAttribute;
    228 		ma->setName( "count" );
    229 		ma->setType( dae.getAtomicTypes().get("Uint"));
    230 		ma->setOffset( daeOffsetOf( domSkin::domVertex_weights , attrCount ));
    231 		ma->setContainer( meta );
    232 		ma->setIsRequired( true );
    233 
    234 		meta->appendAttribute(ma);
    235 	}
    236 
    237 	meta->setElementSize(sizeof(domSkin::domVertex_weights));
    238 	meta->validate();
    239 
    240 	return meta;
    241 }
    242 
    243 daeElementRef
    244 domSkin::domVertex_weights::domVcount::create(DAE& dae)
    245 {
    246 	domSkin::domVertex_weights::domVcountRef ref = new domSkin::domVertex_weights::domVcount(dae);
    247 	return ref;
    248 }
    249 
    250 
    251 daeMetaElement *
    252 domSkin::domVertex_weights::domVcount::registerElement(DAE& dae)
    253 {
    254 	daeMetaElement* meta = dae.getMeta(ID());
    255 	if ( meta != NULL ) return meta;
    256 
    257 	meta = new daeMetaElement(dae);
    258 	dae.setMeta(ID(), *meta);
    259 	meta->setName( "vcount" );
    260 	meta->registerClass(domSkin::domVertex_weights::domVcount::create);
    261 
    262 	meta->setIsInnerClass( true );
    263 	//	Add attribute: _value
    264 	{
    265 		daeMetaAttribute *ma = new daeMetaArrayAttribute;
    266 		ma->setName( "_value" );
    267 		ma->setType( dae.getAtomicTypes().get("ListOfUInts"));
    268 		ma->setOffset( daeOffsetOf( domSkin::domVertex_weights::domVcount , _value ));
    269 		ma->setContainer( meta );
    270 		meta->appendAttribute(ma);
    271 	}
    272 
    273 	meta->setElementSize(sizeof(domSkin::domVertex_weights::domVcount));
    274 	meta->validate();
    275 
    276 	return meta;
    277 }
    278 
    279 daeElementRef
    280 domSkin::domVertex_weights::domV::create(DAE& dae)
    281 {
    282 	domSkin::domVertex_weights::domVRef ref = new domSkin::domVertex_weights::domV(dae);
    283 	return ref;
    284 }
    285 
    286 
    287 daeMetaElement *
    288 domSkin::domVertex_weights::domV::registerElement(DAE& dae)
    289 {
    290 	daeMetaElement* meta = dae.getMeta(ID());
    291 	if ( meta != NULL ) return meta;
    292 
    293 	meta = new daeMetaElement(dae);
    294 	dae.setMeta(ID(), *meta);
    295 	meta->setName( "v" );
    296 	meta->registerClass(domSkin::domVertex_weights::domV::create);
    297 
    298 	meta->setIsInnerClass( true );
    299 	//	Add attribute: _value
    300 	{
    301 		daeMetaAttribute *ma = new daeMetaArrayAttribute;
    302 		ma->setName( "_value" );
    303 		ma->setType( dae.getAtomicTypes().get("ListOfInts"));
    304 		ma->setOffset( daeOffsetOf( domSkin::domVertex_weights::domV , _value ));
    305 		ma->setContainer( meta );
    306 		meta->appendAttribute(ma);
    307 	}
    308 
    309 	meta->setElementSize(sizeof(domSkin::domVertex_weights::domV));
    310 	meta->validate();
    311 
    312 	return meta;
    313 }
    314 
    315