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/domCylinder.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 domCylinder::create(DAE& dae)
21 {
22 domCylinderRef ref = new domCylinder(dae);
23 return ref;
24 }
25
26
27 daeMetaElement *
registerElement(DAE & dae)28 domCylinder::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( "cylinder" );
36 meta->registerClass(domCylinder::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, 1, 1 );
43 mea->setName( "height" );
44 mea->setOffset( daeOffsetOf(domCylinder,elemHeight) );
45 mea->setElementType( domCylinder::domHeight::registerElement(dae) );
46 cm->appendChild( mea );
47
48 mea = new daeMetaElementAttribute( meta, cm, 1, 1, 1 );
49 mea->setName( "radius" );
50 mea->setOffset( daeOffsetOf(domCylinder,elemRadius) );
51 mea->setElementType( domCylinder::domRadius::registerElement(dae) );
52 cm->appendChild( mea );
53
54 mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
55 mea->setName( "extra" );
56 mea->setOffset( daeOffsetOf(domCylinder,elemExtra_array) );
57 mea->setElementType( domExtra::registerElement(dae) );
58 cm->appendChild( mea );
59
60 cm->setMaxOrdinal( 2 );
61 meta->setCMRoot( cm );
62
63 meta->setElementSize(sizeof(domCylinder));
64 meta->validate();
65
66 return meta;
67 }
68
69 daeElementRef
create(DAE & dae)70 domCylinder::domHeight::create(DAE& dae)
71 {
72 domCylinder::domHeightRef ref = new domCylinder::domHeight(dae);
73 return ref;
74 }
75
76
77 daeMetaElement *
registerElement(DAE & dae)78 domCylinder::domHeight::registerElement(DAE& dae)
79 {
80 daeMetaElement* meta = dae.getMeta(ID());
81 if ( meta != NULL ) return meta;
82
83 meta = new daeMetaElement(dae);
84 dae.setMeta(ID(), *meta);
85 meta->setName( "height" );
86 meta->registerClass(domCylinder::domHeight::create);
87
88 meta->setIsInnerClass( true );
89 // Add attribute: _value
90 {
91 daeMetaAttribute *ma = new daeMetaAttribute;
92 ma->setName( "_value" );
93 ma->setType( dae.getAtomicTypes().get("Float"));
94 ma->setOffset( daeOffsetOf( domCylinder::domHeight , _value ));
95 ma->setContainer( meta );
96 meta->appendAttribute(ma);
97 }
98
99 meta->setElementSize(sizeof(domCylinder::domHeight));
100 meta->validate();
101
102 return meta;
103 }
104
105 daeElementRef
create(DAE & dae)106 domCylinder::domRadius::create(DAE& dae)
107 {
108 domCylinder::domRadiusRef ref = new domCylinder::domRadius(dae);
109 return ref;
110 }
111
112
113 daeMetaElement *
registerElement(DAE & dae)114 domCylinder::domRadius::registerElement(DAE& dae)
115 {
116 daeMetaElement* meta = dae.getMeta(ID());
117 if ( meta != NULL ) return meta;
118
119 meta = new daeMetaElement(dae);
120 dae.setMeta(ID(), *meta);
121 meta->setName( "radius" );
122 meta->registerClass(domCylinder::domRadius::create);
123
124 meta->setIsInnerClass( true );
125 // Add attribute: _value
126 {
127 daeMetaAttribute *ma = new daeMetaArrayAttribute;
128 ma->setName( "_value" );
129 ma->setType( dae.getAtomicTypes().get("Float2"));
130 ma->setOffset( daeOffsetOf( domCylinder::domRadius , _value ));
131 ma->setContainer( meta );
132 meta->appendAttribute(ma);
133 }
134
135 meta->setElementSize(sizeof(domCylinder::domRadius));
136 meta->validate();
137
138 return meta;
139 }
140
141