blob: 43a04b512c67248c96dfc3a5ec9c2b220ed66601 [file] [log] [blame]
/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
#include <dae.h>
#include <dae/daeDom.h>
#include <dom/domGlsl_setparam.h>
#include <dae/daeMetaCMPolicy.h>
#include <dae/daeMetaSequence.h>
#include <dae/daeMetaChoice.h>
#include <dae/daeMetaGroup.h>
#include <dae/daeMetaAny.h>
#include <dae/daeMetaElementAttribute.h>
daeElementRef
domGlsl_setparam::create(DAE& dae)
{
domGlsl_setparamRef ref = new domGlsl_setparam(dae);
return ref;
}
daeMetaElement *
domGlsl_setparam::registerElement(DAE& dae)
{
daeMetaElement* meta = dae.getMeta(ID());
if ( meta != NULL ) return meta;
meta = new daeMetaElement(dae);
dae.setMeta(ID(), *meta);
meta->setName( "glsl_setparam" );
meta->registerClass(domGlsl_setparam::create);
daeMetaCMPolicy *cm = NULL;
daeMetaElementAttribute *mea = NULL;
cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 );
mea->setName( "annotate" );
mea->setOffset( daeOffsetOf(domGlsl_setparam,elemAnnotate_array) );
mea->setElementType( domFx_annotate_common::registerElement(dae) );
cm->appendChild( mea );
cm = new daeMetaChoice( meta, cm, 0, 1, 1, 1 );
mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
mea->setName( "glsl_param_type" );
mea->setOffset( daeOffsetOf(domGlsl_setparam,elemGlsl_param_type) );
mea->setElementType( domGlsl_param_type::registerElement(dae) );
cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) );
mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
mea->setName( "array" );
mea->setOffset( daeOffsetOf(domGlsl_setparam,elemArray) );
mea->setElementType( domGlsl_setarray_type::registerElement(dae) );
cm->appendChild( mea );
cm->setMaxOrdinal( 0 );
cm->getParent()->appendChild( cm );
cm = cm->getParent();
cm->setMaxOrdinal( 1 );
meta->setCMRoot( cm );
// Ordered list of sub-elements
meta->addContents(daeOffsetOf(domGlsl_setparam,_contents));
meta->addContentsOrder(daeOffsetOf(domGlsl_setparam,_contentsOrder));
meta->addCMDataArray(daeOffsetOf(domGlsl_setparam,_CMData), 1);
// Add attribute: ref
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "ref" );
ma->setType( dae.getAtomicTypes().get("Glsl_identifier"));
ma->setOffset( daeOffsetOf( domGlsl_setparam , attrRef ));
ma->setContainer( meta );
ma->setIsRequired( true );
meta->appendAttribute(ma);
}
// Add attribute: program
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "program" );
ma->setType( dae.getAtomicTypes().get("xsNCName"));
ma->setOffset( daeOffsetOf( domGlsl_setparam , attrProgram ));
ma->setContainer( meta );
meta->appendAttribute(ma);
}
meta->setElementSize(sizeof(domGlsl_setparam));
meta->validate();
return meta;
}