domTranslate.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #include <dae.h>
  14. #include <dae/daeDom.h>
  15. #include <dom/domTranslate.h>
  16. #include <dae/daeMetaCMPolicy.h>
  17. #include <dae/daeMetaSequence.h>
  18. #include <dae/daeMetaChoice.h>
  19. #include <dae/daeMetaGroup.h>
  20. #include <dae/daeMetaAny.h>
  21. #include <dae/daeMetaElementAttribute.h>
  22. daeElementRef
  23. domTranslate::create(DAE& dae)
  24. {
  25. domTranslateRef ref = new domTranslate(dae);
  26. return ref;
  27. }
  28. daeMetaElement *
  29. domTranslate::registerElement(DAE& dae)
  30. {
  31. daeMetaElement* meta = dae.getMeta(ID());
  32. if ( meta != NULL ) return meta;
  33. meta = new daeMetaElement(dae);
  34. dae.setMeta(ID(), *meta);
  35. meta->setName( "translate" );
  36. meta->registerClass(domTranslate::create);
  37. // Add attribute: _value
  38. {
  39. daeMetaAttribute *ma = new daeMetaArrayAttribute;
  40. ma->setName( "_value" );
  41. ma->setType( dae.getAtomicTypes().get("Float3"));
  42. ma->setOffset( daeOffsetOf( domTranslate , _value ));
  43. ma->setContainer( meta );
  44. meta->appendAttribute(ma);
  45. }
  46. // Add attribute: sid
  47. {
  48. daeMetaAttribute *ma = new daeMetaAttribute;
  49. ma->setName( "sid" );
  50. ma->setType( dae.getAtomicTypes().get("xsNCName"));
  51. ma->setOffset( daeOffsetOf( domTranslate , attrSid ));
  52. ma->setContainer( meta );
  53. meta->appendAttribute(ma);
  54. }
  55. meta->setElementSize(sizeof(domTranslate));
  56. meta->validate();
  57. return meta;
  58. }