domSkin.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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. #ifndef __domSkin_h__
  14. #define __domSkin_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domSource.h>
  19. #include <dom/domExtra.h>
  20. #include <dom/domInputLocal.h>
  21. #include <dom/domInputLocalOffset.h>
  22. class DAE;
  23. /**
  24. * The skin element contains vertex and primitive information sufficient to
  25. * describe blend-weight skinning.
  26. */
  27. class domSkin : public daeElement
  28. {
  29. public:
  30. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::SKIN; }
  31. static daeInt ID() { return 656; }
  32. virtual daeInt typeID() const { return ID(); }
  33. public:
  34. class domBind_shape_matrix;
  35. typedef daeSmartRef<domBind_shape_matrix> domBind_shape_matrixRef;
  36. typedef daeTArray<domBind_shape_matrixRef> domBind_shape_matrix_Array;
  37. /**
  38. * This provides extra information about the position and orientation of the
  39. * base mesh before binding. If bind_shape_matrix is not specified then an
  40. * identity matrix may be used as the bind_shape_matrix. The bind_shape_matrix
  41. * element may occur zero or one times.
  42. */
  43. class domBind_shape_matrix : public daeElement
  44. {
  45. public:
  46. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::BIND_SHAPE_MATRIX; }
  47. static daeInt ID() { return 657; }
  48. virtual daeInt typeID() const { return ID(); }
  49. protected: // Value
  50. /**
  51. * The domFloat4x4 value of the text data of this element.
  52. */
  53. domFloat4x4 _value;
  54. public: //Accessors and Mutators
  55. /**
  56. * Gets the _value array.
  57. * @return Returns a domFloat4x4 reference of the _value array.
  58. */
  59. domFloat4x4 &getValue() { return _value; }
  60. /**
  61. * Gets the _value array.
  62. * @return Returns a constant domFloat4x4 reference of the _value array.
  63. */
  64. const domFloat4x4 &getValue() const { return _value; }
  65. /**
  66. * Sets the _value array.
  67. * @param val The new value for the _value array.
  68. */
  69. void setValue( const domFloat4x4 &val ) { _value = val; }
  70. protected:
  71. /**
  72. * Constructor
  73. */
  74. domBind_shape_matrix(DAE& dae) : daeElement(dae), _value() {}
  75. /**
  76. * Destructor
  77. */
  78. virtual ~domBind_shape_matrix() {}
  79. /**
  80. * Overloaded assignment operator
  81. */
  82. virtual domBind_shape_matrix &operator=( const domBind_shape_matrix &cpy ) { (void)cpy; return *this; }
  83. public: // STATIC METHODS
  84. /**
  85. * Creates an instance of this class and returns a daeElementRef referencing it.
  86. * @return a daeElementRef referencing an instance of this object.
  87. */
  88. static DLLSPEC daeElementRef create(DAE& dae);
  89. /**
  90. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  91. * If a daeMetaElement already exists it will return that instead of creating a new one.
  92. * @return A daeMetaElement describing this COLLADA element.
  93. */
  94. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  95. };
  96. class domJoints;
  97. typedef daeSmartRef<domJoints> domJointsRef;
  98. typedef daeTArray<domJointsRef> domJoints_Array;
  99. /**
  100. * The joints element associates joint, or skeleton, nodes with attribute
  101. * data. In COLLADA, this is specified by the inverse bind matrix of each
  102. * joint (influence) in the skeleton.
  103. */
  104. class domJoints : public daeElement
  105. {
  106. public:
  107. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::JOINTS; }
  108. static daeInt ID() { return 658; }
  109. virtual daeInt typeID() const { return ID(); }
  110. protected: // Elements
  111. /**
  112. * The input element must occur at least twice. These inputs are local inputs.
  113. * @see domInput
  114. */
  115. domInputLocal_Array elemInput_array;
  116. /**
  117. * The extra element may appear any number of times. @see domExtra
  118. */
  119. domExtra_Array elemExtra_array;
  120. public: //Accessors and Mutators
  121. /**
  122. * Gets the input element array.
  123. * @return Returns a reference to the array of input elements.
  124. */
  125. domInputLocal_Array &getInput_array() { return elemInput_array; }
  126. /**
  127. * Gets the input element array.
  128. * @return Returns a constant reference to the array of input elements.
  129. */
  130. const domInputLocal_Array &getInput_array() const { return elemInput_array; }
  131. /**
  132. * Gets the extra element array.
  133. * @return Returns a reference to the array of extra elements.
  134. */
  135. domExtra_Array &getExtra_array() { return elemExtra_array; }
  136. /**
  137. * Gets the extra element array.
  138. * @return Returns a constant reference to the array of extra elements.
  139. */
  140. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  141. protected:
  142. /**
  143. * Constructor
  144. */
  145. domJoints(DAE& dae) : daeElement(dae), elemInput_array(), elemExtra_array() {}
  146. /**
  147. * Destructor
  148. */
  149. virtual ~domJoints() {}
  150. /**
  151. * Overloaded assignment operator
  152. */
  153. virtual domJoints &operator=( const domJoints &cpy ) { (void)cpy; return *this; }
  154. public: // STATIC METHODS
  155. /**
  156. * Creates an instance of this class and returns a daeElementRef referencing it.
  157. * @return a daeElementRef referencing an instance of this object.
  158. */
  159. static DLLSPEC daeElementRef create(DAE& dae);
  160. /**
  161. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  162. * If a daeMetaElement already exists it will return that instead of creating a new one.
  163. * @return A daeMetaElement describing this COLLADA element.
  164. */
  165. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  166. };
  167. class domVertex_weights;
  168. typedef daeSmartRef<domVertex_weights> domVertex_weightsRef;
  169. typedef daeTArray<domVertex_weightsRef> domVertex_weights_Array;
  170. /**
  171. * The vertex_weights element associates a set of joint-weight pairs with
  172. * each vertex in the base mesh.
  173. */
  174. class domVertex_weights : public daeElement
  175. {
  176. public:
  177. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::VERTEX_WEIGHTS; }
  178. static daeInt ID() { return 659; }
  179. virtual daeInt typeID() const { return ID(); }
  180. public:
  181. class domVcount;
  182. typedef daeSmartRef<domVcount> domVcountRef;
  183. typedef daeTArray<domVcountRef> domVcount_Array;
  184. /**
  185. * The vcount element contains a list of integers describing the number of
  186. * influences for each vertex. The vcount element may occur once.
  187. */
  188. class domVcount : public daeElement
  189. {
  190. public:
  191. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::VCOUNT; }
  192. static daeInt ID() { return 660; }
  193. virtual daeInt typeID() const { return ID(); }
  194. protected: // Value
  195. /**
  196. * The domListOfUInts value of the text data of this element.
  197. */
  198. domListOfUInts _value;
  199. public: //Accessors and Mutators
  200. /**
  201. * Gets the _value array.
  202. * @return Returns a domListOfUInts reference of the _value array.
  203. */
  204. domListOfUInts &getValue() { return _value; }
  205. /**
  206. * Gets the _value array.
  207. * @return Returns a constant domListOfUInts reference of the _value array.
  208. */
  209. const domListOfUInts &getValue() const { return _value; }
  210. /**
  211. * Sets the _value array.
  212. * @param val The new value for the _value array.
  213. */
  214. void setValue( const domListOfUInts &val ) { _value = val; }
  215. protected:
  216. /**
  217. * Constructor
  218. */
  219. domVcount(DAE& dae) : daeElement(dae), _value() {}
  220. /**
  221. * Destructor
  222. */
  223. virtual ~domVcount() {}
  224. /**
  225. * Overloaded assignment operator
  226. */
  227. virtual domVcount &operator=( const domVcount &cpy ) { (void)cpy; return *this; }
  228. public: // STATIC METHODS
  229. /**
  230. * Creates an instance of this class and returns a daeElementRef referencing it.
  231. * @return a daeElementRef referencing an instance of this object.
  232. */
  233. static DLLSPEC daeElementRef create(DAE& dae);
  234. /**
  235. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  236. * If a daeMetaElement already exists it will return that instead of creating a new one.
  237. * @return A daeMetaElement describing this COLLADA element.
  238. */
  239. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  240. };
  241. class domV;
  242. typedef daeSmartRef<domV> domVRef;
  243. typedef daeTArray<domVRef> domV_Array;
  244. /**
  245. * The v element describes which bones and attributes are associated with
  246. * each vertex. An index of –1 into the array of joints refers to the
  247. * bind shape. Weights should be normalized before use. The v element must
  248. * occur zero or one times.
  249. */
  250. class domV : public daeElement
  251. {
  252. public:
  253. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::V; }
  254. static daeInt ID() { return 661; }
  255. virtual daeInt typeID() const { return ID(); }
  256. protected: // Value
  257. /**
  258. * The domListOfInts value of the text data of this element.
  259. */
  260. domListOfInts _value;
  261. public: //Accessors and Mutators
  262. /**
  263. * Gets the _value array.
  264. * @return Returns a domListOfInts reference of the _value array.
  265. */
  266. domListOfInts &getValue() { return _value; }
  267. /**
  268. * Gets the _value array.
  269. * @return Returns a constant domListOfInts reference of the _value array.
  270. */
  271. const domListOfInts &getValue() const { return _value; }
  272. /**
  273. * Sets the _value array.
  274. * @param val The new value for the _value array.
  275. */
  276. void setValue( const domListOfInts &val ) { _value = val; }
  277. protected:
  278. /**
  279. * Constructor
  280. */
  281. domV(DAE& dae) : daeElement(dae), _value() {}
  282. /**
  283. * Destructor
  284. */
  285. virtual ~domV() {}
  286. /**
  287. * Overloaded assignment operator
  288. */
  289. virtual domV &operator=( const domV &cpy ) { (void)cpy; return *this; }
  290. public: // STATIC METHODS
  291. /**
  292. * Creates an instance of this class and returns a daeElementRef referencing it.
  293. * @return a daeElementRef referencing an instance of this object.
  294. */
  295. static DLLSPEC daeElementRef create(DAE& dae);
  296. /**
  297. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  298. * If a daeMetaElement already exists it will return that instead of creating a new one.
  299. * @return A daeMetaElement describing this COLLADA element.
  300. */
  301. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  302. };
  303. protected: // Attribute
  304. /**
  305. * The count attribute describes the number of vertices in the base mesh.
  306. * Required element.
  307. */
  308. domUint attrCount;
  309. protected: // Elements
  310. /**
  311. * The input element must occur at least twice. @see domInput
  312. */
  313. domInputLocalOffset_Array elemInput_array;
  314. /**
  315. * The vcount element contains a list of integers describing the number of
  316. * influences for each vertex. The vcount element may occur once. @see domVcount
  317. */
  318. domVcountRef elemVcount;
  319. /**
  320. * The v element describes which bones and attributes are associated with
  321. * each vertex. An index of –1 into the array of joints refers to the
  322. * bind shape. Weights should be normalized before use. The v element must
  323. * occur zero or one times. @see domV
  324. */
  325. domVRef elemV;
  326. /**
  327. * The extra element may appear any number of times. @see domExtra
  328. */
  329. domExtra_Array elemExtra_array;
  330. public: //Accessors and Mutators
  331. /**
  332. * Gets the count attribute.
  333. * @return Returns a domUint of the count attribute.
  334. */
  335. domUint getCount() const { return attrCount; }
  336. /**
  337. * Sets the count attribute.
  338. * @param atCount The new value for the count attribute.
  339. */
  340. void setCount( domUint atCount ) { attrCount = atCount; _validAttributeArray[0] = true; }
  341. /**
  342. * Gets the input element array.
  343. * @return Returns a reference to the array of input elements.
  344. */
  345. domInputLocalOffset_Array &getInput_array() { return elemInput_array; }
  346. /**
  347. * Gets the input element array.
  348. * @return Returns a constant reference to the array of input elements.
  349. */
  350. const domInputLocalOffset_Array &getInput_array() const { return elemInput_array; }
  351. /**
  352. * Gets the vcount element.
  353. * @return a daeSmartRef to the vcount element.
  354. */
  355. const domVcountRef getVcount() const { return elemVcount; }
  356. /**
  357. * Gets the v element.
  358. * @return a daeSmartRef to the v element.
  359. */
  360. const domVRef getV() const { return elemV; }
  361. /**
  362. * Gets the extra element array.
  363. * @return Returns a reference to the array of extra elements.
  364. */
  365. domExtra_Array &getExtra_array() { return elemExtra_array; }
  366. /**
  367. * Gets the extra element array.
  368. * @return Returns a constant reference to the array of extra elements.
  369. */
  370. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  371. protected:
  372. /**
  373. * Constructor
  374. */
  375. domVertex_weights(DAE& dae) : daeElement(dae), attrCount(), elemInput_array(), elemVcount(), elemV(), elemExtra_array() {}
  376. /**
  377. * Destructor
  378. */
  379. virtual ~domVertex_weights() {}
  380. /**
  381. * Overloaded assignment operator
  382. */
  383. virtual domVertex_weights &operator=( const domVertex_weights &cpy ) { (void)cpy; return *this; }
  384. public: // STATIC METHODS
  385. /**
  386. * Creates an instance of this class and returns a daeElementRef referencing it.
  387. * @return a daeElementRef referencing an instance of this object.
  388. */
  389. static DLLSPEC daeElementRef create(DAE& dae);
  390. /**
  391. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  392. * If a daeMetaElement already exists it will return that instead of creating a new one.
  393. * @return A daeMetaElement describing this COLLADA element.
  394. */
  395. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  396. };
  397. protected: // Attribute
  398. /**
  399. * The source attribute contains a URI reference to the base mesh, (a static
  400. * mesh or a morphed mesh). This also provides the bind-shape of the skinned
  401. * mesh. Required attribute.
  402. */
  403. xsAnyURI attrSource;
  404. protected: // Elements
  405. /**
  406. * This provides extra information about the position and orientation of the
  407. * base mesh before binding. If bind_shape_matrix is not specified then an
  408. * identity matrix may be used as the bind_shape_matrix. The bind_shape_matrix
  409. * element may occur zero or one times. @see domBind_shape_matrix
  410. */
  411. domBind_shape_matrixRef elemBind_shape_matrix;
  412. /**
  413. * The skin element must contain at least three source elements. @see domSource
  414. */
  415. domSource_Array elemSource_array;
  416. /**
  417. * The joints element associates joint, or skeleton, nodes with attribute
  418. * data. In COLLADA, this is specified by the inverse bind matrix of each
  419. * joint (influence) in the skeleton. @see domJoints
  420. */
  421. domJointsRef elemJoints;
  422. /**
  423. * The vertex_weights element associates a set of joint-weight pairs with
  424. * each vertex in the base mesh. @see domVertex_weights
  425. */
  426. domVertex_weightsRef elemVertex_weights;
  427. /**
  428. * The extra element may appear any number of times. @see domExtra
  429. */
  430. domExtra_Array elemExtra_array;
  431. public: //Accessors and Mutators
  432. /**
  433. * Gets the source attribute.
  434. * @return Returns a xsAnyURI reference of the source attribute.
  435. */
  436. xsAnyURI &getSource() { return attrSource; }
  437. /**
  438. * Gets the source attribute.
  439. * @return Returns a constant xsAnyURI reference of the source attribute.
  440. */
  441. const xsAnyURI &getSource() const { return attrSource; }
  442. /**
  443. * Sets the source attribute.
  444. * @param atSource The new value for the source attribute.
  445. */
  446. void setSource( const xsAnyURI &atSource ) { attrSource = atSource; _validAttributeArray[0] = true; }
  447. /**
  448. * Sets the source attribute.
  449. * @param atSource The new value for the source attribute.
  450. */
  451. void setSource( xsString atSource ) { attrSource = atSource; _validAttributeArray[0] = true; }
  452. /**
  453. * Gets the bind_shape_matrix element.
  454. * @return a daeSmartRef to the bind_shape_matrix element.
  455. */
  456. const domBind_shape_matrixRef getBind_shape_matrix() const { return elemBind_shape_matrix; }
  457. /**
  458. * Gets the source element array.
  459. * @return Returns a reference to the array of source elements.
  460. */
  461. domSource_Array &getSource_array() { return elemSource_array; }
  462. /**
  463. * Gets the source element array.
  464. * @return Returns a constant reference to the array of source elements.
  465. */
  466. const domSource_Array &getSource_array() const { return elemSource_array; }
  467. /**
  468. * Gets the joints element.
  469. * @return a daeSmartRef to the joints element.
  470. */
  471. const domJointsRef getJoints() const { return elemJoints; }
  472. /**
  473. * Gets the vertex_weights element.
  474. * @return a daeSmartRef to the vertex_weights element.
  475. */
  476. const domVertex_weightsRef getVertex_weights() const { return elemVertex_weights; }
  477. /**
  478. * Gets the extra element array.
  479. * @return Returns a reference to the array of extra elements.
  480. */
  481. domExtra_Array &getExtra_array() { return elemExtra_array; }
  482. /**
  483. * Gets the extra element array.
  484. * @return Returns a constant reference to the array of extra elements.
  485. */
  486. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  487. protected:
  488. /**
  489. * Constructor
  490. */
  491. domSkin(DAE& dae) : daeElement(dae), attrSource(dae, *this), elemBind_shape_matrix(), elemSource_array(), elemJoints(), elemVertex_weights(), elemExtra_array() {}
  492. /**
  493. * Destructor
  494. */
  495. virtual ~domSkin() {}
  496. /**
  497. * Overloaded assignment operator
  498. */
  499. virtual domSkin &operator=( const domSkin &cpy ) { (void)cpy; return *this; }
  500. public: // STATIC METHODS
  501. /**
  502. * Creates an instance of this class and returns a daeElementRef referencing it.
  503. * @return a daeElementRef referencing an instance of this object.
  504. */
  505. static DLLSPEC daeElementRef create(DAE& dae);
  506. /**
  507. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  508. * If a daeMetaElement already exists it will return that instead of creating a new one.
  509. * @return A daeMetaElement describing this COLLADA element.
  510. */
  511. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  512. };
  513. #endif