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