Mesh.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.MeshFromFileName = function(fileName) {
  9. var retVal = new Mesh()
  10. retVal.__ptr = Polycode.Mesh_MeshFromFileName(fileName)
  11. return retVal
  12. }
  13. Mesh.prototype.Copy = function() {
  14. var retVal = new Mesh()
  15. retVal.__ptr = Polycode.Mesh_Copy(this.__ptr)
  16. return retVal
  17. }
  18. Mesh.prototype.loadMesh = function(fileName) {
  19. Polycode.Mesh_loadMesh(this.__ptr, fileName)
  20. }
  21. Mesh.prototype.saveToFile = function(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs) {
  22. Polycode.Mesh_saveToFile(this.__ptr, fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
  23. }
  24. Mesh.prototype.loadFromFile = function(inFile) {
  25. Polycode.Mesh_loadFromFile(this.__ptr, inFile.__ptr)
  26. }
  27. Mesh.prototype.addSubmesh = function(newSubmesh) {
  28. Polycode.Mesh_addSubmesh(this.__ptr, newSubmesh)
  29. }
  30. Mesh.prototype.removeSubmeshAtIndex = function(index) {
  31. Polycode.Mesh_removeSubmeshAtIndex(this.__ptr, index)
  32. }
  33. Mesh.prototype.getNumSubmeshes = function() {
  34. return Polycode.Mesh_getNumSubmeshes(this.__ptr)
  35. }
  36. Mesh.prototype.getSubmeshAtIndex = function(index) {
  37. var retVal = new MeshGeometry()
  38. retVal.__ptr = Polycode.Mesh_getSubmeshAtIndex(this.__ptr, index)
  39. return retVal
  40. }
  41. Mesh.prototype.getSubmeshPointer = function(index) {
  42. var retVal = new MeshGeometry()
  43. retVal.__ptr = Polycode.Mesh_getSubmeshPointer(this.__ptr, index)
  44. return retVal
  45. }
  46. Mesh.prototype.clearMesh = function() {
  47. Polycode.Mesh_clearMesh(this.__ptr)
  48. }
  49. Mesh.prototype.calculateBBox = function() {
  50. var retVal = new Vector3()
  51. retVal.__ptr = Polycode.Mesh_calculateBBox(this.__ptr)
  52. return retVal
  53. }
  54. Mesh.prototype.getRadius = function() {
  55. return Polycode.Mesh_getRadius(this.__ptr)
  56. }