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/domGlsl_newparam.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 domGlsl_newparam::create(DAE& dae)
     21 {
     22 	domGlsl_newparamRef ref = new domGlsl_newparam(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domGlsl_newparam::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( "glsl_newparam" );
     36 	meta->registerClass(domGlsl_newparam::create);
     37 
     38 	daeMetaCMPolicy *cm = NULL;
     39 	daeMetaElementAttribute *mea = NULL;
     40 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
     41 
     42 	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 );
     43 	mea->setName( "annotate" );
     44 	mea->setOffset( daeOffsetOf(domGlsl_newparam,elemAnnotate_array) );
     45 	mea->setElementType( domFx_annotate_common::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
     49 	mea->setName( "semantic" );
     50 	mea->setOffset( daeOffsetOf(domGlsl_newparam,elemSemantic) );
     51 	mea->setElementType( domGlsl_newparam::domSemantic::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 );
     55 	mea->setName( "modifier" );
     56 	mea->setOffset( daeOffsetOf(domGlsl_newparam,elemModifier) );
     57 	mea->setElementType( domGlsl_newparam::domModifier::registerElement(dae) );
     58 	cm->appendChild( mea );
     59 
     60 	cm = new daeMetaChoice( meta, cm, 0, 3, 1, 1 );
     61 
     62 	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
     63 	mea->setName( "glsl_param_type" );
     64 	mea->setOffset( daeOffsetOf(domGlsl_newparam,elemGlsl_param_type) );
     65 	mea->setElementType( domGlsl_param_type::registerElement(dae) );
     66 	cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) );
     67 
     68 	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
     69 	mea->setName( "array" );
     70 	mea->setOffset( daeOffsetOf(domGlsl_newparam,elemArray) );
     71 	mea->setElementType( domGlsl_newarray_type::registerElement(dae) );
     72 	cm->appendChild( mea );
     73 
     74 	cm->setMaxOrdinal( 0 );
     75 	cm->getParent()->appendChild( cm );
     76 	cm = cm->getParent();
     77 
     78 	cm->setMaxOrdinal( 3 );
     79 	meta->setCMRoot( cm );
     80 	// Ordered list of sub-elements
     81 	meta->addContents(daeOffsetOf(domGlsl_newparam,_contents));
     82 	meta->addContentsOrder(daeOffsetOf(domGlsl_newparam,_contentsOrder));
     83 
     84 	meta->addCMDataArray(daeOffsetOf(domGlsl_newparam,_CMData), 1);
     85 	//	Add attribute: sid
     86 	{
     87 		daeMetaAttribute *ma = new daeMetaAttribute;
     88 		ma->setName( "sid" );
     89 		ma->setType( dae.getAtomicTypes().get("Glsl_identifier"));
     90 		ma->setOffset( daeOffsetOf( domGlsl_newparam , attrSid ));
     91 		ma->setContainer( meta );
     92 		ma->setIsRequired( true );
     93 
     94 		meta->appendAttribute(ma);
     95 	}
     96 
     97 	meta->setElementSize(sizeof(domGlsl_newparam));
     98 	meta->validate();
     99 
    100 	return meta;
    101 }
    102 
    103 daeElementRef
    104 domGlsl_newparam::domSemantic::create(DAE& dae)
    105 {
    106 	domGlsl_newparam::domSemanticRef ref = new domGlsl_newparam::domSemantic(dae);
    107 	return ref;
    108 }
    109 
    110 
    111 daeMetaElement *
    112 domGlsl_newparam::domSemantic::registerElement(DAE& dae)
    113 {
    114 	daeMetaElement* meta = dae.getMeta(ID());
    115 	if ( meta != NULL ) return meta;
    116 
    117 	meta = new daeMetaElement(dae);
    118 	dae.setMeta(ID(), *meta);
    119 	meta->setName( "semantic" );
    120 	meta->registerClass(domGlsl_newparam::domSemantic::create);
    121 
    122 	meta->setIsInnerClass( true );
    123 	//	Add attribute: _value
    124 	{
    125 		daeMetaAttribute *ma = new daeMetaAttribute;
    126 		ma->setName( "_value" );
    127 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
    128 		ma->setOffset( daeOffsetOf( domGlsl_newparam::domSemantic , _value ));
    129 		ma->setContainer( meta );
    130 		meta->appendAttribute(ma);
    131 	}
    132 
    133 	meta->setElementSize(sizeof(domGlsl_newparam::domSemantic));
    134 	meta->validate();
    135 
    136 	return meta;
    137 }
    138 
    139 daeElementRef
    140 domGlsl_newparam::domModifier::create(DAE& dae)
    141 {
    142 	domGlsl_newparam::domModifierRef ref = new domGlsl_newparam::domModifier(dae);
    143 	return ref;
    144 }
    145 
    146 
    147 daeMetaElement *
    148 domGlsl_newparam::domModifier::registerElement(DAE& dae)
    149 {
    150 	daeMetaElement* meta = dae.getMeta(ID());
    151 	if ( meta != NULL ) return meta;
    152 
    153 	meta = new daeMetaElement(dae);
    154 	dae.setMeta(ID(), *meta);
    155 	meta->setName( "modifier" );
    156 	meta->registerClass(domGlsl_newparam::domModifier::create);
    157 
    158 	meta->setIsInnerClass( true );
    159 	//	Add attribute: _value
    160 	{
    161 		daeMetaAttribute *ma = new daeMetaAttribute;
    162 		ma->setName( "_value" );
    163 		ma->setType( dae.getAtomicTypes().get("Fx_modifier_enum_common"));
    164 		ma->setOffset( daeOffsetOf( domGlsl_newparam::domModifier , _value ));
    165 		ma->setContainer( meta );
    166 		meta->appendAttribute(ma);
    167 	}
    168 
    169 	meta->setElementSize(sizeof(domGlsl_newparam::domModifier));
    170 	meta->validate();
    171 
    172 	return meta;
    173 }
    174 
    175