domLibrary_lights.cpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/domLibrary_lights.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. domLibrary_lights::create(DAE& dae)
  24. {
  25. domLibrary_lightsRef ref = new domLibrary_lights(dae);
  26. return ref;
  27. }
  28. daeMetaElement *
  29. domLibrary_lights::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( "library_lights" );
  36. meta->registerClass(domLibrary_lights::create);
  37. daeMetaCMPolicy *cm = NULL;
  38. daeMetaElementAttribute *mea = NULL;
  39. cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
  40. mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
  41. mea->setName( "asset" );
  42. mea->setOffset( daeOffsetOf(domLibrary_lights,elemAsset) );
  43. mea->setElementType( domAsset::registerElement(dae) );
  44. cm->appendChild( mea );
  45. mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
  46. mea->setName( "light" );
  47. mea->setOffset( daeOffsetOf(domLibrary_lights,elemLight_array) );
  48. mea->setElementType( domLight::registerElement(dae) );
  49. cm->appendChild( mea );
  50. mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
  51. mea->setName( "extra" );
  52. mea->setOffset( daeOffsetOf(domLibrary_lights,elemExtra_array) );
  53. mea->setElementType( domExtra::registerElement(dae) );
  54. cm->appendChild( mea );
  55. cm->setMaxOrdinal( 2 );
  56. meta->setCMRoot( cm );
  57. // Add attribute: id
  58. {
  59. daeMetaAttribute *ma = new daeMetaAttribute;
  60. ma->setName( "id" );
  61. ma->setType( dae.getAtomicTypes().get("xsID"));
  62. ma->setOffset( daeOffsetOf( domLibrary_lights , attrId ));
  63. ma->setContainer( meta );
  64. meta->appendAttribute(ma);
  65. }
  66. // Add attribute: name
  67. {
  68. daeMetaAttribute *ma = new daeMetaAttribute;
  69. ma->setName( "name" );
  70. ma->setType( dae.getAtomicTypes().get("xsNCName"));
  71. ma->setOffset( daeOffsetOf( domLibrary_lights , attrName ));
  72. ma->setContainer( meta );
  73. meta->appendAttribute(ma);
  74. }
  75. meta->setElementSize(sizeof(domLibrary_lights));
  76. meta->validate();
  77. return meta;
  78. }