babylon.objFileLoader.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. declare module BABYLON {
  2. /**
  3. * Class reading and parsing the MTL file bundled with the obj file.
  4. */
  5. class MTLFileLoader {
  6. materials: BABYLON.StandardMaterial[];
  7. /**
  8. * This function will read the mtl file and create each material described inside
  9. * This function could be improve by adding :
  10. * -some component missing (Ni, Tf...)
  11. * -including the specific options available
  12. *
  13. * @param scene
  14. * @param data
  15. * @param rootUrl
  16. */
  17. parseMTL(scene: BABYLON.Scene, data: string, rootUrl: string): void;
  18. /**
  19. * Gets the texture for the material.
  20. *
  21. * If the material is imported from input file,
  22. * We sanitize the url to ensure it takes the textre from aside the material.
  23. *
  24. * @param rootUrl The root url to load from
  25. * @param value The value stored in the mtl
  26. * @return The Texture
  27. */
  28. private static _getTexture(rootUrl, value, scene);
  29. }
  30. class OBJFileLoader implements ISceneLoaderPlugin {
  31. static OPTIMIZE_WITH_UV: boolean;
  32. name: string;
  33. extensions: string;
  34. obj: RegExp;
  35. group: RegExp;
  36. mtllib: RegExp;
  37. usemtl: RegExp;
  38. smooth: RegExp;
  39. vertexPattern: RegExp;
  40. normalPattern: RegExp;
  41. uvPattern: RegExp;
  42. facePattern1: RegExp;
  43. facePattern2: RegExp;
  44. facePattern3: RegExp;
  45. facePattern4: RegExp;
  46. /**
  47. * Calls synchronously the MTL file attached to this obj.
  48. * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
  49. * Without this function materials are not displayed in the first frame (but displayed after).
  50. * In consequence it is impossible to get material information in your HTML file
  51. *
  52. * @param url The URL of the MTL file
  53. * @param rootUrl
  54. * @param onSuccess Callback function to be called when the MTL file is loaded
  55. * @private
  56. */
  57. private _loadMTL(url, rootUrl, onSuccess);
  58. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  59. load(scene: Scene, data: string, rootUrl: string): boolean;
  60. /**
  61. * Read the OBJ file and create an Array of meshes.
  62. * Each mesh contains all information given by the OBJ and the MTL file.
  63. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
  64. *
  65. * @param meshesNames
  66. * @param scene BABYLON.Scene The scene where are displayed the data
  67. * @param data String The content of the obj file
  68. * @param rootUrl String The path to the folder
  69. * @returns Array<AbstractMesh>
  70. * @private
  71. */
  72. private _parseSolid(meshesNames, scene, data, rootUrl);
  73. }
  74. }