Mesh.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. require('Polycode/Resource')
  2. function Mesh() {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.Mesh()
  5. }
  6. }
  7. Mesh.prototype = Object.create(Resource.prototype)
  8. Mesh.prototype.loadMesh = function(fileName) {
  9. Polycode.Mesh_loadMesh(this.__ptr, fileName)
  10. }
  11. Mesh.prototype.saveToFile = function(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs) {
  12. Polycode.Mesh_saveToFile(this.__ptr, fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
  13. }
  14. Mesh.prototype.addSubmesh = function(newSubmesh) {
  15. Polycode.Mesh_addSubmesh(this.__ptr, newSubmesh)
  16. }
  17. Mesh.prototype.removeSubmeshAtIndex = function(index) {
  18. Polycode.Mesh_removeSubmeshAtIndex(this.__ptr, index)
  19. }
  20. Mesh.prototype.getNumSubmeshes = function() {
  21. return Polycode.Mesh_getNumSubmeshes(this.__ptr)
  22. }
  23. Mesh.prototype.getSubmeshAtIndex = function(index) {
  24. var retVal = new MeshGeometry("__skip_ptr__")
  25. retVal.__ptr = Polycode.Mesh_getSubmeshAtIndex(this.__ptr, index)
  26. return retVal
  27. }
  28. Mesh.prototype.getSubmeshPointer = function(index) {
  29. var retVal = new MeshGeometry("__skip_ptr__")
  30. retVal.__ptr = Polycode.Mesh_getSubmeshPointer(this.__ptr, index)
  31. return retVal
  32. }
  33. Mesh.prototype.clearMesh = function() {
  34. Polycode.Mesh_clearMesh(this.__ptr)
  35. }
  36. Mesh.prototype.calculateBBox = function() {
  37. var retVal = new Vector3("__skip_ptr__")
  38. retVal.__ptr = Polycode.Mesh_calculateBBox(this.__ptr)
  39. return retVal
  40. }
  41. Mesh.prototype.getRadius = function() {
  42. return Polycode.Mesh_getRadius(this.__ptr)
  43. }