Bone.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. function Bone() {
  2. Object.defineProperties(this, {
  3. 'parentBoneId': { enumerable: true, configurable: true, get: Bone.prototype.__get_parentBoneId, set: Bone.prototype.__set_parentBoneId},
  4. 'boneMatrix': { enumerable: true, configurable: true, get: Bone.prototype.__get_boneMatrix, set: Bone.prototype.__set_boneMatrix},
  5. 'restMatrix': { enumerable: true, configurable: true, get: Bone.prototype.__get_restMatrix, set: Bone.prototype.__set_restMatrix},
  6. 'baseMatrix': { enumerable: true, configurable: true, get: Bone.prototype.__get_baseMatrix, set: Bone.prototype.__set_baseMatrix},
  7. 'finalMatrix': { enumerable: true, configurable: true, get: Bone.prototype.__get_finalMatrix, set: Bone.prototype.__set_finalMatrix},
  8. 'baseRotation': { enumerable: true, configurable: true, get: Bone.prototype.__get_baseRotation, set: Bone.prototype.__set_baseRotation},
  9. 'baseScale': { enumerable: true, configurable: true, get: Bone.prototype.__get_baseScale, set: Bone.prototype.__set_baseScale},
  10. 'basePosition': { enumerable: true, configurable: true, get: Bone.prototype.__get_basePosition, set: Bone.prototype.__set_basePosition},
  11. 'disableAnimation': { enumerable: true, configurable: true, get: Bone.prototype.__get_disableAnimation, set: Bone.prototype.__set_disableAnimation}
  12. })
  13. }
  14. Bone.prototype.__get_parentBoneId = function() {
  15. return Polycode.Bone__get_parentBoneId(this.__ptr)
  16. }
  17. Bone.prototype.__set_parentBoneId = function(val) {
  18. Polycode.Bone__set_parentBoneId(this.__ptr, val)
  19. }
  20. Bone.prototype.__get_boneMatrix = function() {
  21. var retVal = new Matrix4()
  22. retVal.__ptr = Polycode.Bone__get_boneMatrix(this.__ptr)
  23. return retVal
  24. }
  25. Bone.prototype.__set_boneMatrix = function(val) {
  26. Polycode.Bone__set_boneMatrix(this.__ptr, val.__ptr)
  27. }
  28. Bone.prototype.__get_restMatrix = function() {
  29. var retVal = new Matrix4()
  30. retVal.__ptr = Polycode.Bone__get_restMatrix(this.__ptr)
  31. return retVal
  32. }
  33. Bone.prototype.__set_restMatrix = function(val) {
  34. Polycode.Bone__set_restMatrix(this.__ptr, val.__ptr)
  35. }
  36. Bone.prototype.__get_baseMatrix = function() {
  37. var retVal = new Matrix4()
  38. retVal.__ptr = Polycode.Bone__get_baseMatrix(this.__ptr)
  39. return retVal
  40. }
  41. Bone.prototype.__set_baseMatrix = function(val) {
  42. Polycode.Bone__set_baseMatrix(this.__ptr, val.__ptr)
  43. }
  44. Bone.prototype.__get_finalMatrix = function() {
  45. var retVal = new Matrix4()
  46. retVal.__ptr = Polycode.Bone__get_finalMatrix(this.__ptr)
  47. return retVal
  48. }
  49. Bone.prototype.__set_finalMatrix = function(val) {
  50. Polycode.Bone__set_finalMatrix(this.__ptr, val.__ptr)
  51. }
  52. Bone.prototype.__get_baseRotation = function() {
  53. var retVal = new Quaternion()
  54. retVal.__ptr = Polycode.Bone__get_baseRotation(this.__ptr)
  55. return retVal
  56. }
  57. Bone.prototype.__set_baseRotation = function(val) {
  58. Polycode.Bone__set_baseRotation(this.__ptr, val.__ptr)
  59. }
  60. Bone.prototype.__get_baseScale = function() {
  61. var retVal = new Vector3()
  62. retVal.__ptr = Polycode.Bone__get_baseScale(this.__ptr)
  63. return retVal
  64. }
  65. Bone.prototype.__set_baseScale = function(val) {
  66. Polycode.Bone__set_baseScale(this.__ptr, val.__ptr)
  67. }
  68. Bone.prototype.__get_basePosition = function() {
  69. var retVal = new Vector3()
  70. retVal.__ptr = Polycode.Bone__get_basePosition(this.__ptr)
  71. return retVal
  72. }
  73. Bone.prototype.__set_basePosition = function(val) {
  74. Polycode.Bone__set_basePosition(this.__ptr, val.__ptr)
  75. }
  76. Bone.prototype.__get_disableAnimation = function() {
  77. return Polycode.Bone__get_disableAnimation(this.__ptr)
  78. }
  79. Bone.prototype.__set_disableAnimation = function(val) {
  80. Polycode.Bone__set_disableAnimation(this.__ptr, val)
  81. }
  82. Duktape.fin(Bone.prototype, function (x) {
  83. if (x === Bone.prototype) {
  84. return;
  85. }
  86. Polycode.Bone__delete(x.__ptr)
  87. })
  88. Bone.prototype.getName = function() {
  89. return Polycode.Bone_getName(this.__ptr)
  90. }
  91. Bone.prototype.setParentBone = function(bone) {
  92. Polycode.Bone_setParentBone(this.__ptr, bone)
  93. }
  94. Bone.prototype.addChildBone = function(bone) {
  95. Polycode.Bone_addChildBone(this.__ptr, bone)
  96. }
  97. Bone.prototype.getParentBone = function() {
  98. var retVal = new Bone()
  99. retVal.__ptr = Polycode.Bone_getParentBone(this.__ptr)
  100. return retVal
  101. }
  102. Bone.prototype.getNumChildBones = function() {
  103. return Polycode.Bone_getNumChildBones(this.__ptr)
  104. }
  105. Bone.prototype.getChildBone = function(index) {
  106. var retVal = new Bone()
  107. retVal.__ptr = Polycode.Bone_getChildBone(this.__ptr, index)
  108. return retVal
  109. }
  110. Bone.prototype.getBoneMatrix = function() {
  111. var retVal = new Matrix4()
  112. retVal.__ptr = Polycode.Bone_getBoneMatrix(this.__ptr)
  113. return retVal
  114. }
  115. Bone.prototype.setBoneMatrix = function(matrix) {
  116. Polycode.Bone_setBoneMatrix(this.__ptr, matrix)
  117. }
  118. Bone.prototype.getRestMatrix = function() {
  119. var retVal = new Matrix4()
  120. retVal.__ptr = Polycode.Bone_getRestMatrix(this.__ptr)
  121. return retVal
  122. }
  123. Bone.prototype.getFullRestMatrix = function() {
  124. var retVal = new Matrix4()
  125. retVal.__ptr = Polycode.Bone_getFullRestMatrix(this.__ptr)
  126. return retVal
  127. }
  128. Bone.prototype.getParentRestMatrix = function() {
  129. var retVal = new Matrix4()
  130. retVal.__ptr = Polycode.Bone_getParentRestMatrix(this.__ptr)
  131. return retVal
  132. }
  133. Bone.prototype.getFinalMatrix = function() {
  134. var retVal = new Matrix4()
  135. retVal.__ptr = Polycode.Bone_getFinalMatrix(this.__ptr)
  136. return retVal
  137. }
  138. Bone.prototype.setRestMatrix = function(matrix) {
  139. Polycode.Bone_setRestMatrix(this.__ptr, matrix)
  140. }
  141. Bone.prototype.setBaseMatrix = function(matrix) {
  142. Polycode.Bone_setBaseMatrix(this.__ptr, matrix)
  143. }
  144. Bone.prototype.getBaseMatrix = function() {
  145. var retVal = new Matrix4()
  146. retVal.__ptr = Polycode.Bone_getBaseMatrix(this.__ptr)
  147. return retVal
  148. }
  149. Bone.prototype.getFullBaseMatrix = function() {
  150. var retVal = new Matrix4()
  151. retVal.__ptr = Polycode.Bone_getFullBaseMatrix(this.__ptr)
  152. return retVal
  153. }
  154. Bone.prototype.rebuildFinalMatrix = function() {
  155. Polycode.Bone_rebuildFinalMatrix(this.__ptr)
  156. }
  157. Bone.prototype.buildFinalMatrix = function() {
  158. var retVal = new Matrix4()
  159. retVal.__ptr = Polycode.Bone_buildFinalMatrix(this.__ptr)
  160. return retVal
  161. }
  162. Bone.prototype.intializeBone = function(basePosition,baseScale,baseRotation,restPosition,restScale,restRotation) {
  163. Polycode.Bone_intializeBone(this.__ptr, basePosition,baseScale,baseRotation,restPosition,restScale,restRotation)
  164. }