Mesh.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. function Mesh() {
  2. }
  3. Mesh.prototype.loadMesh = function(fileName) {
  4. Polycode.Mesh_loadMesh(this.__ptr, fileName)
  5. }
  6. Mesh.prototype.clearMesh = function() {
  7. Polycode.Mesh_clearMesh(this.__ptr)
  8. }
  9. Mesh.prototype.saveToFile = function(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs) {
  10. Polycode.Mesh_saveToFile(this.__ptr, fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs)
  11. }
  12. Mesh.prototype.loadFromFile = function(inFile) {
  13. Polycode.Mesh_loadFromFile(this.__ptr, inFile)
  14. }
  15. Mesh.prototype.getVertexCount = function() {
  16. Polycode.Mesh_getVertexCount(this.__ptr)
  17. }
  18. Mesh.prototype.createPlane = function(w,h,tilingValue) {
  19. Polycode.Mesh_createPlane(this.__ptr, w,h,tilingValue)
  20. }
  21. Mesh.prototype.createVPlane = function(w,h,tilingValue) {
  22. Polycode.Mesh_createVPlane(this.__ptr, w,h,tilingValue)
  23. }
  24. Mesh.prototype.createCircle = function(w,h,numSegments,tilingValue) {
  25. Polycode.Mesh_createCircle(this.__ptr, w,h,numSegments,tilingValue)
  26. }
  27. Mesh.prototype.createLineCircle = function(w,h,numSegments,tilingValue) {
  28. Polycode.Mesh_createLineCircle(this.__ptr, w,h,numSegments,tilingValue)
  29. }
  30. Mesh.prototype.createTorus = function(radius,tubeRadius,segmentsW,segmentsH,tilingValue) {
  31. Polycode.Mesh_createTorus(this.__ptr, radius,tubeRadius,segmentsW,segmentsH,tilingValue)
  32. }
  33. Mesh.prototype.createBox = function(w,d,h,tilingValue) {
  34. Polycode.Mesh_createBox(this.__ptr, w,d,h,tilingValue)
  35. }
  36. Mesh.prototype.createSphere = function(radius,numRings,numSegments,tilingValue) {
  37. Polycode.Mesh_createSphere(this.__ptr, radius,numRings,numSegments,tilingValue)
  38. }
  39. Mesh.prototype.createIcosphere = function(radius,subdivisions) {
  40. Polycode.Mesh_createIcosphere(this.__ptr, radius,subdivisions)
  41. }
  42. Mesh.prototype.createOctosphere = function(radius,subdivisions) {
  43. Polycode.Mesh_createOctosphere(this.__ptr, radius,subdivisions)
  44. }
  45. Mesh.prototype.createCylinder = function(height,radius,numSegments,capped,tilingValue) {
  46. Polycode.Mesh_createCylinder(this.__ptr, height,radius,numSegments,capped,tilingValue)
  47. }
  48. Mesh.prototype.createCone = function(height,radius,numSegments,tilingValue) {
  49. Polycode.Mesh_createCone(this.__ptr, height,radius,numSegments,tilingValue)
  50. }
  51. Mesh.prototype.recenterMesh = function() {
  52. Polycode.Mesh_recenterMesh(this.__ptr)
  53. }
  54. Mesh.prototype.setVertexAtOffset = function(offset,x,y,z) {
  55. Polycode.Mesh_setVertexAtOffset(this.__ptr, offset,x,y,z)
  56. }
  57. Mesh.prototype.addVertexWithUVAndNormal = function(x,y,z,u,v,nx,ny,nz) {
  58. Polycode.Mesh_addVertexWithUVAndNormal(this.__ptr, x,y,z,u,v,nx,ny,nz)
  59. }
  60. Mesh.prototype.addTexCoord = function(u,v) {
  61. Polycode.Mesh_addTexCoord(this.__ptr, u,v)
  62. }
  63. Mesh.prototype.addTexCoord2 = function(u,v) {
  64. Polycode.Mesh_addTexCoord2(this.__ptr, u,v)
  65. }
  66. Mesh.prototype.addTangent = function(x,y,z) {
  67. Polycode.Mesh_addTangent(this.__ptr, x,y,z)
  68. }
  69. Mesh.prototype.addVertexWithUV = function(x,y,z,u,v) {
  70. Polycode.Mesh_addVertexWithUV(this.__ptr, x,y,z,u,v)
  71. }
  72. Mesh.prototype.addVertex = function(x,y,z) {
  73. Polycode.Mesh_addVertex(this.__ptr, x,y,z)
  74. }
  75. Mesh.prototype.addNormal = function(nx,ny,nz) {
  76. Polycode.Mesh_addNormal(this.__ptr, nx,ny,nz)
  77. }
  78. Mesh.prototype.addBoneAssignments = function(b1Weight,b1Index,b2Weight,b2Index,b3Weight,b3Index,b4Weight,b4Index) {
  79. Polycode.Mesh_addBoneAssignments(this.__ptr, b1Weight,b1Index,b2Weight,b2Index,b3Weight,b3Index,b4Weight,b4Index)
  80. }
  81. Mesh.prototype.addColor = function(r,g,b,a) {
  82. Polycode.Mesh_addColor(this.__ptr, r,g,b,a)
  83. }
  84. Mesh.prototype.getVertexPosition = function(vertexOffset) {
  85. Polycode.Mesh_getVertexPosition(this.__ptr, vertexOffset)
  86. }
  87. Mesh.prototype.getVertexPositionAtIndex = function(index) {
  88. Polycode.Mesh_getVertexPositionAtIndex(this.__ptr, index)
  89. }
  90. Mesh.prototype.getVertexTexCoord = function(vertexOffset) {
  91. Polycode.Mesh_getVertexTexCoord(this.__ptr, vertexOffset)
  92. }
  93. Mesh.prototype.getVertexTexCoordAtIndex = function(index) {
  94. Polycode.Mesh_getVertexTexCoordAtIndex(this.__ptr, index)
  95. }
  96. Mesh.prototype.Copy = function() {
  97. Polycode.Mesh_Copy(this.__ptr)
  98. }
  99. Mesh.prototype.getRadius = function() {
  100. Polycode.Mesh_getRadius(this.__ptr)
  101. }
  102. Mesh.prototype.calculateNormals = function() {
  103. Polycode.Mesh_calculateNormals(this.__ptr)
  104. }
  105. Mesh.prototype.calculateTangents = function() {
  106. Polycode.Mesh_calculateTangents(this.__ptr)
  107. }
  108. Mesh.prototype.getMeshType = function() {
  109. Polycode.Mesh_getMeshType(this.__ptr)
  110. }
  111. Mesh.prototype.setMeshType = function(newType) {
  112. Polycode.Mesh_setMeshType(this.__ptr, newType)
  113. }
  114. Mesh.prototype.getIndexGroupSize = function() {
  115. Polycode.Mesh_getIndexGroupSize(this.__ptr)
  116. }
  117. Mesh.prototype.calculateBBox = function() {
  118. Polycode.Mesh_calculateBBox(this.__ptr)
  119. }
  120. Mesh.prototype.hasVertexBuffer = function() {
  121. Polycode.Mesh_hasVertexBuffer(this.__ptr)
  122. }
  123. Mesh.prototype.addIndexedFace = function(i1,i2) {
  124. Polycode.Mesh_addIndexedFace(this.__ptr, i1,i2)
  125. }
  126. Mesh.prototype.addIndex = function(index) {
  127. Polycode.Mesh_addIndex(this.__ptr, index)
  128. }
  129. Mesh.prototype.removeVertexRange = function(beginRemoveVertex,vertexRemovalCount) {
  130. Polycode.Mesh_removeVertexRange(this.__ptr, beginRemoveVertex,vertexRemovalCount)
  131. }
  132. Mesh.prototype.removeFace = function(faceIndex) {
  133. Polycode.Mesh_removeFace(this.__ptr, faceIndex)
  134. }
  135. Mesh.prototype.removeUnusedVertices = function() {
  136. Polycode.Mesh_removeUnusedVertices(this.__ptr)
  137. }
  138. Mesh.prototype.getIndexCount = function() {
  139. Polycode.Mesh_getIndexCount(this.__ptr)
  140. }
  141. Mesh.prototype.subdivideToRadius = function(radius,subdivisions) {
  142. Polycode.Mesh_subdivideToRadius(this.__ptr, radius,subdivisions)
  143. }
  144. Mesh.prototype.saveAsOBJ = function(fileName) {
  145. Polycode.Mesh_saveAsOBJ(this.__ptr, fileName)
  146. }
  147. Mesh.prototype.normalizeBoneWeights = function() {
  148. Polycode.Mesh_normalizeBoneWeights(this.__ptr)
  149. }