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_setparam_simple.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
create(DAE & dae)20 domGlsl_setparam_simple::create(DAE& dae)
21 {
22 domGlsl_setparam_simpleRef ref = new domGlsl_setparam_simple(dae);
23 return ref;
24 }
25
26
27 daeMetaElement *
registerElement(DAE & dae)28 domGlsl_setparam_simple::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_setparam_simple" );
36 meta->registerClass(domGlsl_setparam_simple::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_setparam_simple,elemAnnotate_array) );
45 mea->setElementType( domFx_annotate_common::registerElement(dae) );
46 cm->appendChild( mea );
47
48 mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 );
49 mea->setName( "glsl_param_type" );
50 mea->setOffset( daeOffsetOf(domGlsl_setparam_simple,elemGlsl_param_type) );
51 mea->setElementType( domGlsl_param_type::registerElement(dae) );
52 cm->appendChild( new daeMetaGroup( mea, meta, cm, 1, 1, 1 ) );
53
54 cm->setMaxOrdinal( 1 );
55 meta->setCMRoot( cm );
56
57 // Add attribute: ref
58 {
59 daeMetaAttribute *ma = new daeMetaAttribute;
60 ma->setName( "ref" );
61 ma->setType( dae.getAtomicTypes().get("Glsl_identifier"));
62 ma->setOffset( daeOffsetOf( domGlsl_setparam_simple , attrRef ));
63 ma->setContainer( meta );
64 ma->setIsRequired( true );
65
66 meta->appendAttribute(ma);
67 }
68
69 meta->setElementSize(sizeof(domGlsl_setparam_simple));
70 meta->validate();
71
72 return meta;
73 }
74
75