babylon.mesh.js 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  1. var __extends = this.__extends || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. __.prototype = b.prototype;
  5. d.prototype = new __();
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var Mesh = (function (_super) {
  10. __extends(Mesh, _super);
  11. function Mesh(name, scene) {
  12. _super.call(this, name, scene);
  13. // Members
  14. this.position = new BABYLON.Vector3(0, 0, 0);
  15. this.rotation = new BABYLON.Vector3(0, 0, 0);
  16. this.rotationQuaternion = null;
  17. this.scaling = new BABYLON.Vector3(1, 1, 1);
  18. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NONE;
  19. this.material = null;
  20. this.isVisible = true;
  21. this.isPickable = true;
  22. this.visibility = 1.0;
  23. this.billboardMode = BABYLON.Mesh.BILLBOARDMODE_NONE;
  24. this.checkCollisions = false;
  25. this.receiveShadows = false;
  26. this._isDisposed = false;
  27. this.onDispose = null;
  28. this.skeleton = null;
  29. this.renderingGroupId = 0;
  30. this.infiniteDistance = false;
  31. this.showBoundingBox = false;
  32. // Cache
  33. this._positions = null;
  34. this._localScaling = BABYLON.Matrix.Zero();
  35. this._localRotation = BABYLON.Matrix.Zero();
  36. this._localTranslation = BABYLON.Matrix.Zero();
  37. this._localBillboard = BABYLON.Matrix.Zero();
  38. this._localPivotScaling = BABYLON.Matrix.Zero();
  39. this._localPivotScalingRotation = BABYLON.Matrix.Zero();
  40. this._localWorld = BABYLON.Matrix.Zero();
  41. this._worldMatrix = BABYLON.Matrix.Zero();
  42. this._rotateYByPI = BABYLON.Matrix.RotationY(Math.PI);
  43. this._collisionsTransformMatrix = BABYLON.Matrix.Zero();
  44. this._collisionsScalingMatrix = BABYLON.Matrix.Zero();
  45. this._absolutePosition = BABYLON.Vector3.Zero();
  46. this._isDirty = false;
  47. // Physics
  48. this._physicImpostor = BABYLON.PhysicsEngine.NoImpostor;
  49. this._pivotMatrix = BABYLON.Matrix.Identity();
  50. this._renderId = 0;
  51. this._onBeforeRenderCallbacks = [];
  52. this._animationStarted = false;
  53. scene.meshes.push(this);
  54. }
  55. Object.defineProperty(Mesh, "BILLBOARDMODE_NONE", {
  56. get: function () {
  57. return Mesh._BILLBOARDMODE_NONE;
  58. },
  59. enumerable: true,
  60. configurable: true
  61. });
  62. Object.defineProperty(Mesh, "BILLBOARDMODE_X", {
  63. get: function () {
  64. return Mesh._BILLBOARDMODE_X;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(Mesh, "BILLBOARDMODE_Y", {
  70. get: function () {
  71. return Mesh._BILLBOARDMODE_Y;
  72. },
  73. enumerable: true,
  74. configurable: true
  75. });
  76. Object.defineProperty(Mesh, "BILLBOARDMODE_Z", {
  77. get: function () {
  78. return Mesh._BILLBOARDMODE_Z;
  79. },
  80. enumerable: true,
  81. configurable: true
  82. });
  83. Object.defineProperty(Mesh, "BILLBOARDMODE_ALL", {
  84. get: function () {
  85. return Mesh._BILLBOARDMODE_ALL;
  86. },
  87. enumerable: true,
  88. configurable: true
  89. });
  90. Mesh.prototype.getBoundingInfo = function () {
  91. return this._boundingInfo;
  92. };
  93. Mesh.prototype.getWorldMatrix = function () {
  94. if (this._currentRenderId !== this.getScene().getRenderId()) {
  95. this.computeWorldMatrix();
  96. }
  97. return this._worldMatrix;
  98. };
  99. Mesh.prototype.rotate = function (axis, amount, space) {
  100. if (!this.rotationQuaternion) {
  101. this.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);
  102. this.rotation = BABYLON.Vector3.Zero();
  103. }
  104. if (!space || space == 0 /* LOCAL */) {
  105. var rotationQuaternion = BABYLON.Quaternion.RotationAxis(axis, amount);
  106. this.rotationQuaternion = this.rotationQuaternion.multiply(rotationQuaternion);
  107. } else {
  108. if (this.parent) {
  109. var invertParentWorldMatrix = this.parent.getWorldMatrix().clone();
  110. invertParentWorldMatrix.invert();
  111. axis = BABYLON.Vector3.TransformNormal(axis, invertParentWorldMatrix);
  112. }
  113. rotationQuaternion = BABYLON.Quaternion.RotationAxis(axis, amount);
  114. this.rotationQuaternion = rotationQuaternion.multiply(this.rotationQuaternion);
  115. }
  116. };
  117. Mesh.prototype.translate = function (axis, distance, space) {
  118. var displacementVector = axis.scale(distance);
  119. if (!space || space == 0 /* LOCAL */) {
  120. var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
  121. this.setPositionWithLocalVector(tempV3);
  122. } else {
  123. this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));
  124. }
  125. };
  126. Mesh.prototype.getAbsolutePosition = function () {
  127. this.computeWorldMatrix();
  128. return this._absolutePosition;
  129. };
  130. Mesh.prototype.setAbsolutePosition = function (absolutePosition) {
  131. if (!absolutePosition) {
  132. return;
  133. }
  134. var absolutePositionX;
  135. var absolutePositionY;
  136. var absolutePositionZ;
  137. if (absolutePosition.x === undefined) {
  138. if (arguments.length < 3) {
  139. return;
  140. }
  141. absolutePositionX = arguments[0];
  142. absolutePositionY = arguments[1];
  143. absolutePositionZ = arguments[2];
  144. } else {
  145. absolutePositionX = absolutePosition.x;
  146. absolutePositionY = absolutePosition.y;
  147. absolutePositionZ = absolutePosition.z;
  148. }
  149. if (this.parent) {
  150. var invertParentWorldMatrix = this.parent.getWorldMatrix().clone();
  151. invertParentWorldMatrix.invert();
  152. var worldPosition = new BABYLON.Vector3(absolutePositionX, absolutePositionY, absolutePositionZ);
  153. this.position = BABYLON.Vector3.TransformCoordinates(worldPosition, invertParentWorldMatrix);
  154. } else {
  155. this.position.x = absolutePositionX;
  156. this.position.y = absolutePositionY;
  157. this.position.z = absolutePositionZ;
  158. }
  159. };
  160. Mesh.prototype.getTotalVertices = function () {
  161. if (!this._geometry) {
  162. return 0;
  163. }
  164. return this._geometry.getTotalVertices();
  165. };
  166. Mesh.prototype.getVerticesData = function (kind) {
  167. if (!this._geometry) {
  168. return null;
  169. }
  170. return this._geometry.getVerticesData(kind);
  171. };
  172. Mesh.prototype.getVertexBuffer = function (kind) {
  173. if (!this._geometry) {
  174. return undefined;
  175. }
  176. return this._geometry.getVertexBuffer(kind);
  177. };
  178. Mesh.prototype.isVerticesDataPresent = function (kind) {
  179. if (!this._geometry) {
  180. if (this._delayInfo) {
  181. return this._delayInfo.indexOf(kind) !== -1;
  182. }
  183. return false;
  184. }
  185. return this._geometry.isVerticesDataPresent(kind);
  186. };
  187. Mesh.prototype.getVerticesDataKinds = function () {
  188. if (!this._geometry) {
  189. var result = [];
  190. if (this._delayInfo) {
  191. for (var kind in this._delayInfo) {
  192. result.push(kind);
  193. }
  194. }
  195. return result;
  196. }
  197. return this._geometry.getVerticesDataKinds();
  198. };
  199. Mesh.prototype.getTotalIndices = function () {
  200. if (!this._geometry) {
  201. return 0;
  202. }
  203. return this._geometry.getTotalIndices();
  204. };
  205. Mesh.prototype.getIndices = function () {
  206. if (!this._geometry) {
  207. return [];
  208. }
  209. return this._geometry.getIndices();
  210. };
  211. Mesh.prototype.setPivotMatrix = function (matrix) {
  212. this._pivotMatrix = matrix;
  213. this._cache.pivotMatrixUpdated = true;
  214. };
  215. Mesh.prototype.getPivotMatrix = function () {
  216. return this._pivotMatrix;
  217. };
  218. Mesh.prototype._isSynchronized = function () {
  219. if (this._isDirty) {
  220. return false;
  221. }
  222. if (this.billboardMode !== Mesh.BILLBOARDMODE_NONE)
  223. return false;
  224. if (this._cache.pivotMatrixUpdated) {
  225. return false;
  226. }
  227. if (this.infiniteDistance) {
  228. return false;
  229. }
  230. if (!this._cache.position.equals(this.position))
  231. return false;
  232. if (this.rotationQuaternion) {
  233. if (!this._cache.rotationQuaternion.equals(this.rotationQuaternion))
  234. return false;
  235. } else {
  236. if (!this._cache.rotation.equals(this.rotation))
  237. return false;
  238. }
  239. if (!this._cache.scaling.equals(this.scaling))
  240. return false;
  241. return true;
  242. };
  243. Mesh.prototype.isReady = function () {
  244. return this._isReady;
  245. };
  246. Mesh.prototype.isAnimated = function () {
  247. return this._animationStarted;
  248. };
  249. Mesh.prototype.isDisposed = function () {
  250. return this._isDisposed;
  251. };
  252. // Methods
  253. Mesh.prototype._initCache = function () {
  254. _super.prototype._initCache.call(this);
  255. this._cache.localMatrixUpdated = false;
  256. this._cache.position = BABYLON.Vector3.Zero();
  257. this._cache.scaling = BABYLON.Vector3.Zero();
  258. this._cache.rotation = BABYLON.Vector3.Zero();
  259. this._cache.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 0);
  260. };
  261. Mesh.prototype.markAsDirty = function (property) {
  262. if (property === "rotation") {
  263. this.rotationQuaternion = null;
  264. }
  265. this._currentRenderId = Number.MAX_VALUE;
  266. this._isDirty = true;
  267. };
  268. Mesh.prototype.refreshBoundingInfo = function () {
  269. var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
  270. if (data) {
  271. var extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
  272. this._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
  273. }
  274. if (this.subMeshes) {
  275. for (var index = 0; index < this.subMeshes.length; index++) {
  276. this.subMeshes[index].refreshBoundingInfo();
  277. }
  278. }
  279. this._updateBoundingInfo();
  280. };
  281. Mesh.prototype._updateBoundingInfo = function () {
  282. this._boundingInfo = this._boundingInfo || new BABYLON.BoundingInfo(this._absolutePosition, this._absolutePosition);
  283. this._boundingInfo._update(this._worldMatrix);
  284. if (!this.subMeshes) {
  285. return;
  286. }
  287. for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
  288. var subMesh = this.subMeshes[subIndex];
  289. subMesh.updateBoundingInfo(this._worldMatrix);
  290. }
  291. };
  292. Mesh.prototype.computeWorldMatrix = function (force) {
  293. if (!force && (this._currentRenderId == this.getScene().getRenderId() || this.isSynchronized(true))) {
  294. return this._worldMatrix;
  295. }
  296. this._cache.position.copyFrom(this.position);
  297. this._cache.scaling.copyFrom(this.scaling);
  298. this._cache.pivotMatrixUpdated = false;
  299. this._currentRenderId = this.getScene().getRenderId();
  300. this._isDirty = false;
  301. // Scaling
  302. BABYLON.Matrix.ScalingToRef(this.scaling.x, this.scaling.y, this.scaling.z, this._localScaling);
  303. // Rotation
  304. if (this.rotationQuaternion) {
  305. this.rotationQuaternion.toRotationMatrix(this._localRotation);
  306. this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);
  307. } else {
  308. BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._localRotation);
  309. this._cache.rotation.copyFrom(this.rotation);
  310. }
  311. // Translation
  312. if (this.infiniteDistance && !this.parent) {
  313. var camera = this.getScene().activeCamera;
  314. var cameraWorldMatrix = camera.getWorldMatrix();
  315. var cameraGlobalPosition = new BABYLON.Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);
  316. BABYLON.Matrix.TranslationToRef(this.position.x + cameraGlobalPosition.x, this.position.y + cameraGlobalPosition.y, this.position.z + cameraGlobalPosition.z, this._localTranslation);
  317. } else {
  318. BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._localTranslation);
  319. }
  320. // Composing transformations
  321. this._pivotMatrix.multiplyToRef(this._localScaling, this._localPivotScaling);
  322. this._localPivotScaling.multiplyToRef(this._localRotation, this._localPivotScalingRotation);
  323. // Billboarding
  324. if (this.billboardMode !== Mesh.BILLBOARDMODE_NONE) {
  325. var localPosition = this.position.clone();
  326. var zero = this.getScene().activeCamera.position.clone();
  327. if (this.parent && this.parent.position) {
  328. localPosition.addInPlace(this.parent.position);
  329. BABYLON.Matrix.TranslationToRef(localPosition.x, localPosition.y, localPosition.z, this._localTranslation);
  330. }
  331. if ((this.billboardMode & Mesh.BILLBOARDMODE_ALL) === Mesh.BILLBOARDMODE_ALL) {
  332. zero = this.getScene().activeCamera.position;
  333. } else {
  334. if (this.billboardMode & BABYLON.Mesh.BILLBOARDMODE_X)
  335. zero.x = localPosition.x + BABYLON.Engine.Epsilon;
  336. if (this.billboardMode & BABYLON.Mesh.BILLBOARDMODE_Y)
  337. zero.y = localPosition.y + 0.001;
  338. if (this.billboardMode & BABYLON.Mesh.BILLBOARDMODE_Z)
  339. zero.z = localPosition.z + 0.001;
  340. }
  341. BABYLON.Matrix.LookAtLHToRef(localPosition, zero, BABYLON.Vector3.Up(), this._localBillboard);
  342. this._localBillboard.m[12] = this._localBillboard.m[13] = this._localBillboard.m[14] = 0;
  343. this._localBillboard.invert();
  344. this._localPivotScalingRotation.multiplyToRef(this._localBillboard, this._localWorld);
  345. this._rotateYByPI.multiplyToRef(this._localWorld, this._localPivotScalingRotation);
  346. }
  347. // Local world
  348. this._localPivotScalingRotation.multiplyToRef(this._localTranslation, this._localWorld);
  349. // Parent
  350. if (this.parent && this.parent.getWorldMatrix && this.billboardMode === BABYLON.Mesh.BILLBOARDMODE_NONE) {
  351. this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
  352. } else {
  353. this._worldMatrix.copyFrom(this._localWorld);
  354. }
  355. // Bounding info
  356. this._updateBoundingInfo();
  357. // Absolute position
  358. this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
  359. return this._worldMatrix;
  360. };
  361. Mesh.prototype._createGlobalSubMesh = function () {
  362. var totalVertices = this.getTotalVertices();
  363. if (!totalVertices || !this.getIndices()) {
  364. return null;
  365. }
  366. this.subMeshes = [];
  367. return new BABYLON.SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);
  368. };
  369. Mesh.prototype.subdivide = function (count) {
  370. if (count < 1) {
  371. return;
  372. }
  373. var totalIndices = this.getTotalIndices();
  374. var subdivisionSize = totalIndices / count;
  375. var offset = 0;
  376. this.subMeshes = [];
  377. for (var index = 0; index < count; index++) {
  378. BABYLON.SubMesh.CreateFromIndices(0, offset, Math.min(subdivisionSize, totalIndices - offset), this);
  379. offset += subdivisionSize;
  380. }
  381. };
  382. Mesh.prototype.setVerticesData = function (data, kind, updatable) {
  383. if (!this._geometry) {
  384. var vertexData = new BABYLON.VertexData();
  385. vertexData.set(data, kind);
  386. var scene = this.getScene();
  387. new BABYLON.Geometry(BABYLON.Geometry.RandomId(), scene.getEngine(), vertexData, updatable, this);
  388. } else {
  389. this._geometry.setVerticesData(data, kind, updatable);
  390. }
  391. };
  392. Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
  393. if (!this._geometry) {
  394. return;
  395. }
  396. if (!makeItUnique) {
  397. this._geometry.updateVerticesData(kind, data, updateExtends);
  398. } else {
  399. this.makeGeometryUnique();
  400. this.updateVerticesData(kind, data, updateExtends, false);
  401. }
  402. };
  403. Mesh.prototype.makeGeometryUnique = function () {
  404. if (!this._geometry) {
  405. return;
  406. }
  407. var geometry = this._geometry.copy(BABYLON.Geometry.RandomId());
  408. geometry.applyToMesh(this);
  409. };
  410. Mesh.prototype.setIndices = function (indices) {
  411. if (!this._geometry) {
  412. var vertexData = new BABYLON.VertexData();
  413. vertexData.indices = indices;
  414. var scene = this.getScene();
  415. new BABYLON.Geometry(BABYLON.Geometry.RandomId(), scene.getEngine(), vertexData, false, this);
  416. } else {
  417. this._geometry.setIndices(indices);
  418. }
  419. };
  420. // ANY
  421. Mesh.prototype.bindAndDraw = function (subMesh, effect, wireframe) {
  422. if (!this._geometry || !this._geometry.getVertexBuffers() || !this._geometry.getIndexBuffer()) {
  423. return;
  424. }
  425. var engine = this.getScene().getEngine();
  426. // Wireframe
  427. var indexToBind = this._geometry.getIndexBuffer();
  428. var useTriangles = true;
  429. if (wireframe) {
  430. indexToBind = subMesh.getLinesIndexBuffer(this.getIndices(), engine);
  431. useTriangles = false;
  432. }
  433. // VBOs
  434. engine.bindMultiBuffers(this._geometry.getVertexBuffers(), indexToBind, effect);
  435. // Draw order
  436. engine.draw(useTriangles, useTriangles ? subMesh.indexStart : 0, useTriangles ? subMesh.indexCount : subMesh.linesIndexCount);
  437. };
  438. Mesh.prototype.registerBeforeRender = function (func) {
  439. this._onBeforeRenderCallbacks.push(func);
  440. };
  441. Mesh.prototype.unregisterBeforeRender = function (func) {
  442. var index = this._onBeforeRenderCallbacks.indexOf(func);
  443. if (index > -1) {
  444. this._onBeforeRenderCallbacks.splice(index, 1);
  445. }
  446. };
  447. Mesh.prototype.render = function (subMesh) {
  448. if (!this._geometry || !this._geometry.getVertexBuffers() || !this._geometry.getIndexBuffer()) {
  449. return;
  450. }
  451. for (var callbackIndex = 0; callbackIndex < this._onBeforeRenderCallbacks.length; callbackIndex++) {
  452. this._onBeforeRenderCallbacks[callbackIndex]();
  453. }
  454. // World
  455. var world = this.getWorldMatrix();
  456. // Material
  457. var effectiveMaterial = subMesh.getMaterial();
  458. if (!effectiveMaterial || !effectiveMaterial.isReady(this)) {
  459. return;
  460. }
  461. effectiveMaterial._preBind();
  462. effectiveMaterial.bind(world, this);
  463. // Bind and draw
  464. var engine = this.getScene().getEngine();
  465. this.bindAndDraw(subMesh, effectiveMaterial.getEffect(), engine.forceWireframe || effectiveMaterial.wireframe);
  466. // Unbind
  467. effectiveMaterial.unbind();
  468. };
  469. Mesh.prototype.getEmittedParticleSystems = function () {
  470. var results = new Array();
  471. for (var index = 0; index < this.getScene().particleSystems.length; index++) {
  472. var particleSystem = this.getScene().particleSystems[index];
  473. if (particleSystem.emitter === this) {
  474. results.push(particleSystem);
  475. }
  476. }
  477. return results;
  478. };
  479. Mesh.prototype.getHierarchyEmittedParticleSystems = function () {
  480. var results = new Array();
  481. var descendants = this.getDescendants();
  482. descendants.push(this);
  483. for (var index = 0; index < this.getScene().particleSystems.length; index++) {
  484. var particleSystem = this.getScene().particleSystems[index];
  485. if (descendants.indexOf(particleSystem.emitter) !== -1) {
  486. results.push(particleSystem);
  487. }
  488. }
  489. return results;
  490. };
  491. Mesh.prototype.getChildren = function () {
  492. var results = [];
  493. for (var index = 0; index < this.getScene().meshes.length; index++) {
  494. var mesh = this.getScene().meshes[index];
  495. if (mesh.parent == this) {
  496. results.push(mesh);
  497. }
  498. }
  499. return results;
  500. };
  501. Mesh.prototype.isInFrustum = function (frustumPlanes) {
  502. if (this.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_LOADING) {
  503. return false;
  504. }
  505. if (!this._boundingInfo.isInFrustum(frustumPlanes)) {
  506. return false;
  507. }
  508. var that = this;
  509. var scene = this.getScene();
  510. if (this._geometry) {
  511. this._geometry.load(scene);
  512. } else if (that.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
  513. that.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADING;
  514. scene._addPendingData(that);
  515. BABYLON.Tools.LoadFile(this.delayLoadingFile, function (data) {
  516. that._delayLoadingFunction(JSON.parse(data), that);
  517. that.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
  518. scene._removePendingData(that);
  519. }, function () {
  520. }, scene.database);
  521. }
  522. return true;
  523. };
  524. Mesh.prototype.setMaterialByID = function (id) {
  525. var materials = this.getScene().materials;
  526. for (var index = 0; index < materials.length; index++) {
  527. if (materials[index].id == id) {
  528. this.material = materials[index];
  529. return;
  530. }
  531. }
  532. // Multi
  533. var multiMaterials = this.getScene().multiMaterials;
  534. for (index = 0; index < multiMaterials.length; index++) {
  535. if (multiMaterials[index].id == id) {
  536. this.material = multiMaterials[index];
  537. return;
  538. }
  539. }
  540. };
  541. Mesh.prototype.getAnimatables = function () {
  542. var results = [];
  543. if (this.material) {
  544. results.push(this.material);
  545. }
  546. return results;
  547. };
  548. // Geometry
  549. Mesh.prototype.setPositionWithLocalVector = function (vector3) {
  550. this.computeWorldMatrix();
  551. this.position = BABYLON.Vector3.TransformNormal(vector3, this._localWorld);
  552. };
  553. Mesh.prototype.getPositionExpressedInLocalSpace = function () {
  554. this.computeWorldMatrix();
  555. var invLocalWorldMatrix = this._localWorld.clone();
  556. invLocalWorldMatrix.invert();
  557. return BABYLON.Vector3.TransformNormal(this.position, invLocalWorldMatrix);
  558. };
  559. Mesh.prototype.locallyTranslate = function (vector3) {
  560. this.computeWorldMatrix();
  561. this.position = BABYLON.Vector3.TransformCoordinates(vector3, this._localWorld);
  562. };
  563. Mesh.prototype.bakeTransformIntoVertices = function (transform) {
  564. // Position
  565. if (!this.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind)) {
  566. return;
  567. }
  568. this._resetPointsArrayCache();
  569. var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
  570. var temp = [];
  571. for (var index = 0; index < data.length; index += 3) {
  572. BABYLON.Vector3.TransformCoordinates(BABYLON.Vector3.FromArray(data, index), transform).toArray(temp, index);
  573. }
  574. this.setVerticesData(temp, BABYLON.VertexBuffer.PositionKind, this.getVertexBuffer(BABYLON.VertexBuffer.PositionKind).isUpdatable());
  575. // Normals
  576. if (!this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
  577. return;
  578. }
  579. data = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
  580. for (index = 0; index < data.length; index += 3) {
  581. BABYLON.Vector3.TransformNormal(BABYLON.Vector3.FromArray(data, index), transform).toArray(temp, index);
  582. }
  583. this.setVerticesData(temp, BABYLON.VertexBuffer.NormalKind, this.getVertexBuffer(BABYLON.VertexBuffer.NormalKind).isUpdatable());
  584. };
  585. Mesh.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor) {
  586. /// <summary>Orients a mesh towards a target point. Mesh must be drawn facing user.</summary>
  587. /// <param name="targetPoint" type="BABYLON.Vector3">The position (must be in same space as current mesh) to look at</param>
  588. /// <param name="yawCor" type="Number">optional yaw (y-axis) correction in radians</param>
  589. /// <param name="pitchCor" type="Number">optional pitch (x-axis) correction in radians</param>
  590. /// <param name="rollCor" type="Number">optional roll (z-axis) correction in radians</param>
  591. /// <returns>Mesh oriented towards targetMesh</returns>
  592. yawCor = yawCor || 0; // default to zero if undefined
  593. pitchCor = pitchCor || 0;
  594. rollCor = rollCor || 0;
  595. var dv = targetPoint.subtract(this.position);
  596. var yaw = -Math.atan2(dv.z, dv.x) - Math.PI / 2;
  597. var len = Math.sqrt(dv.x * dv.x + dv.z * dv.z);
  598. var pitch = Math.atan2(dv.y, len);
  599. this.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(yaw + yawCor, pitch + pitchCor, rollCor);
  600. };
  601. // Cache
  602. Mesh.prototype._resetPointsArrayCache = function () {
  603. this._positions = null;
  604. };
  605. Mesh.prototype._generatePointsArray = function () {
  606. if (this._positions)
  607. return;
  608. this._positions = [];
  609. var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
  610. for (var index = 0; index < data.length; index += 3) {
  611. this._positions.push(BABYLON.Vector3.FromArray(data, index));
  612. }
  613. };
  614. // Collisions
  615. Mesh.prototype._collideForSubMesh = function (subMesh, transformMatrix, collider) {
  616. this._generatePointsArray();
  617. // Transformation
  618. if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {
  619. subMesh._lastColliderTransformMatrix = transformMatrix.clone();
  620. subMesh._lastColliderWorldVertices = [];
  621. subMesh._trianglePlanes = [];
  622. var start = subMesh.verticesStart;
  623. var end = (subMesh.verticesStart + subMesh.verticesCount);
  624. for (var i = start; i < end; i++) {
  625. subMesh._lastColliderWorldVertices.push(BABYLON.Vector3.TransformCoordinates(this._positions[i], transformMatrix));
  626. }
  627. }
  628. // Collide
  629. collider._collide(subMesh, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart);
  630. };
  631. Mesh.prototype._processCollisionsForSubModels = function (collider, transformMatrix) {
  632. for (var index = 0; index < this.subMeshes.length; index++) {
  633. var subMesh = this.subMeshes[index];
  634. // Bounding test
  635. if (this.subMeshes.length > 1 && !subMesh._checkCollision(collider))
  636. continue;
  637. this._collideForSubMesh(subMesh, transformMatrix, collider);
  638. }
  639. };
  640. Mesh.prototype._checkCollision = function (collider) {
  641. // Bounding box test
  642. if (!this._boundingInfo._checkCollision(collider))
  643. return;
  644. // Transformation matrix
  645. BABYLON.Matrix.ScalingToRef(1.0 / collider.radius.x, 1.0 / collider.radius.y, 1.0 / collider.radius.z, this._collisionsScalingMatrix);
  646. this._worldMatrix.multiplyToRef(this._collisionsScalingMatrix, this._collisionsTransformMatrix);
  647. this._processCollisionsForSubModels(collider, this._collisionsTransformMatrix);
  648. };
  649. Mesh.prototype.intersectsMesh = function (mesh, precise) {
  650. if (!this._boundingInfo || !mesh._boundingInfo) {
  651. return false;
  652. }
  653. return this._boundingInfo.intersects(mesh._boundingInfo, precise);
  654. };
  655. Mesh.prototype.intersectsPoint = function (point) {
  656. if (!this._boundingInfo) {
  657. return false;
  658. }
  659. return this._boundingInfo.intersectsPoint(point);
  660. };
  661. // Picking
  662. Mesh.prototype.intersects = function (ray, fastCheck) {
  663. var pickingInfo = new BABYLON.PickingInfo();
  664. if (!this._boundingInfo || !ray.intersectsSphere(this._boundingInfo.boundingSphere) || !ray.intersectsBox(this._boundingInfo.boundingBox)) {
  665. return pickingInfo;
  666. }
  667. this._generatePointsArray();
  668. var intersectInfo = null;
  669. for (var index = 0; index < this.subMeshes.length; index++) {
  670. var subMesh = this.subMeshes[index];
  671. // Bounding test
  672. if (this.subMeshes.length > 1 && !subMesh.canIntersects(ray))
  673. continue;
  674. var currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck);
  675. if (currentIntersectInfo) {
  676. if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {
  677. intersectInfo = currentIntersectInfo;
  678. if (fastCheck) {
  679. break;
  680. }
  681. }
  682. }
  683. }
  684. if (intersectInfo) {
  685. // Get picked point
  686. var world = this.getWorldMatrix();
  687. var worldOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, world);
  688. var direction = ray.direction.clone();
  689. direction.normalize();
  690. direction = direction.scale(intersectInfo.distance);
  691. var worldDirection = BABYLON.Vector3.TransformNormal(direction, world);
  692. var pickedPoint = worldOrigin.add(worldDirection);
  693. // Return result
  694. pickingInfo.hit = true;
  695. pickingInfo.distance = BABYLON.Vector3.Distance(worldOrigin, pickedPoint);
  696. pickingInfo.pickedPoint = pickedPoint;
  697. pickingInfo.pickedMesh = this;
  698. pickingInfo.bu = intersectInfo.bu;
  699. pickingInfo.bv = intersectInfo.bv;
  700. pickingInfo.faceId = intersectInfo.faceId;
  701. return pickingInfo;
  702. }
  703. return pickingInfo;
  704. };
  705. // Clone
  706. Mesh.prototype.clone = function (name, newParent, doNotCloneChildren) {
  707. var result = new BABYLON.Mesh(name, this.getScene());
  708. // Geometry
  709. this._geometry.applyToMesh(result);
  710. // Deep copy
  711. BABYLON.Tools.DeepCopy(this, result, ["name", "material", "skeleton"], []);
  712. // Bounding info
  713. var extend = BABYLON.Tools.ExtractMinAndMax(this.getVerticesData(BABYLON.VertexBuffer.PositionKind), 0, this.getTotalVertices());
  714. result._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
  715. // Material
  716. result.material = this.material;
  717. // Parent
  718. if (newParent) {
  719. result.parent = newParent;
  720. }
  721. if (!doNotCloneChildren) {
  722. for (var index = 0; index < this.getScene().meshes.length; index++) {
  723. var mesh = this.getScene().meshes[index];
  724. if (mesh.parent == this) {
  725. mesh.clone(mesh.name, result);
  726. }
  727. }
  728. }
  729. for (index = 0; index < this.getScene().particleSystems.length; index++) {
  730. var system = this.getScene().particleSystems[index];
  731. if (system.emitter == this) {
  732. system.clone(system.name, result);
  733. }
  734. }
  735. result.computeWorldMatrix(true);
  736. return result;
  737. };
  738. // Dispose
  739. Mesh.prototype.dispose = function (doNotRecurse) {
  740. if (this._geometry) {
  741. this._geometry.releaseForMesh(this);
  742. }
  743. // Physics
  744. if (this.getPhysicsImpostor() != BABYLON.PhysicsEngine.NoImpostor) {
  745. this.setPhysicsState(BABYLON.PhysicsEngine.NoImpostor);
  746. }
  747. // Remove from scene
  748. var index = this.getScene().meshes.indexOf(this);
  749. this.getScene().meshes.splice(index, 1);
  750. if (!doNotRecurse) {
  751. for (index = 0; index < this.getScene().particleSystems.length; index++) {
  752. if (this.getScene().particleSystems[index].emitter == this) {
  753. this.getScene().particleSystems[index].dispose();
  754. index--;
  755. }
  756. }
  757. // Children
  758. var objects = this.getScene().meshes.slice(0);
  759. for (index = 0; index < objects.length; index++) {
  760. if (objects[index].parent == this) {
  761. objects[index].dispose();
  762. }
  763. }
  764. } else {
  765. for (index = 0; index < this.getScene().meshes.length; index++) {
  766. var obj = this.getScene().meshes[index];
  767. if (obj.parent === this) {
  768. obj.parent = null;
  769. obj.computeWorldMatrix(true);
  770. }
  771. }
  772. }
  773. this._isDisposed = true;
  774. // Callback
  775. if (this.onDispose) {
  776. this.onDispose();
  777. }
  778. };
  779. // Physics
  780. Mesh.prototype.setPhysicsState = function (impostor, options) {
  781. var physicsEngine = this.getScene().getPhysicsEngine();
  782. if (!physicsEngine) {
  783. return;
  784. }
  785. if (impostor.impostor) {
  786. // Old API
  787. options = impostor;
  788. impostor = impostor.impostor;
  789. }
  790. impostor = impostor || BABYLON.PhysicsEngine.NoImpostor;
  791. if (impostor === BABYLON.PhysicsEngine.NoImpostor) {
  792. physicsEngine._unregisterMesh(this);
  793. return;
  794. }
  795. options.mass = options.mass || 0;
  796. options.friction = options.friction || 0.2;
  797. options.restitution = options.restitution || 0.9;
  798. this._physicImpostor = impostor;
  799. this._physicsMass = options.mass;
  800. this._physicsFriction = options.friction;
  801. this._physicRestitution = options.restitution;
  802. physicsEngine._registerMesh(this, impostor, options);
  803. };
  804. Mesh.prototype.getPhysicsImpostor = function () {
  805. if (!this._physicImpostor) {
  806. return BABYLON.PhysicsEngine.NoImpostor;
  807. }
  808. return this._physicImpostor;
  809. };
  810. Mesh.prototype.getPhysicsMass = function () {
  811. if (!this._physicsMass) {
  812. return 0;
  813. }
  814. return this._physicsMass;
  815. };
  816. Mesh.prototype.getPhysicsFriction = function () {
  817. if (!this._physicsFriction) {
  818. return 0;
  819. }
  820. return this._physicsFriction;
  821. };
  822. Mesh.prototype.getPhysicsRestitution = function () {
  823. if (!this._physicRestitution) {
  824. return 0;
  825. }
  826. return this._physicRestitution;
  827. };
  828. Mesh.prototype.applyImpulse = function (force, contactPoint) {
  829. if (!this._physicImpostor) {
  830. return;
  831. }
  832. this.getScene().getPhysicsEngine()._applyImpulse(this, force, contactPoint);
  833. };
  834. Mesh.prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2) {
  835. if (!this._physicImpostor) {
  836. return;
  837. }
  838. this.getScene().getPhysicsEngine()._createLink(this, otherMesh, pivot1, pivot2);
  839. };
  840. // Geometric tools
  841. Mesh.prototype.convertToFlatShadedMesh = function () {
  842. /// <summary>Update normals and vertices to get a flat shading rendering.</summary>
  843. /// <summary>Warning: This may imply adding vertices to the mesh in order to get exactly 3 vertices per face</summary>
  844. var kinds = this.getVerticesDataKinds();
  845. var vbs = [];
  846. var data = [];
  847. var newdata = [];
  848. var updatableNormals = false;
  849. for (var kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
  850. var kind = kinds[kindIndex];
  851. var vertexBuffer = this.getVertexBuffer(kind);
  852. if (kind === BABYLON.VertexBuffer.NormalKind) {
  853. updatableNormals = vertexBuffer.isUpdatable();
  854. kinds.splice(kindIndex, 1);
  855. kindIndex--;
  856. continue;
  857. }
  858. vbs[kind] = vertexBuffer;
  859. data[kind] = vbs[kind].getData();
  860. newdata[kind] = [];
  861. }
  862. // Save previous submeshes
  863. var previousSubmeshes = this.subMeshes.slice(0);
  864. var indices = this.getIndices();
  865. var totalIndices = this.getTotalIndices();
  866. for (index = 0; index < totalIndices; index++) {
  867. var vertexIndex = indices[index];
  868. for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
  869. kind = kinds[kindIndex];
  870. var stride = vbs[kind].getStrideSize();
  871. for (var offset = 0; offset < stride; offset++) {
  872. newdata[kind].push(data[kind][vertexIndex * stride + offset]);
  873. }
  874. }
  875. }
  876. // Updating faces & normal
  877. var normals = [];
  878. var positions = newdata[BABYLON.VertexBuffer.PositionKind];
  879. for (var index = 0; index < totalIndices; index += 3) {
  880. indices[index] = index;
  881. indices[index + 1] = index + 1;
  882. indices[index + 2] = index + 2;
  883. var p1 = BABYLON.Vector3.FromArray(positions, index * 3);
  884. var p2 = BABYLON.Vector3.FromArray(positions, (index + 1) * 3);
  885. var p3 = BABYLON.Vector3.FromArray(positions, (index + 2) * 3);
  886. var p1p2 = p1.subtract(p2);
  887. var p3p2 = p3.subtract(p2);
  888. var normal = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(p1p2, p3p2));
  889. for (var localIndex = 0; localIndex < 3; localIndex++) {
  890. normals.push(normal.x);
  891. normals.push(normal.y);
  892. normals.push(normal.z);
  893. }
  894. }
  895. this.setIndices(indices);
  896. this.setVerticesData(normals, BABYLON.VertexBuffer.NormalKind, updatableNormals);
  897. for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
  898. kind = kinds[kindIndex];
  899. this.setVerticesData(newdata[kind], kind, vbs[kind].isUpdatable());
  900. }
  901. // Updating submeshes
  902. this.subMeshes = [];
  903. for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {
  904. var previousOne = previousSubmeshes[submeshIndex];
  905. var subMesh = new BABYLON.SubMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);
  906. }
  907. };
  908. // Statics
  909. Mesh.CreateBox = function (name, size, scene, updatable) {
  910. var box = new BABYLON.Mesh(name, scene);
  911. var vertexData = BABYLON.VertexData.CreateBox(size);
  912. vertexData.applyToMesh(box, updatable);
  913. return box;
  914. };
  915. Mesh.CreateSphere = function (name, segments, diameter, scene, updatable) {
  916. var sphere = new BABYLON.Mesh(name, scene);
  917. var vertexData = BABYLON.VertexData.CreateSphere(segments, diameter);
  918. vertexData.applyToMesh(sphere, updatable);
  919. return sphere;
  920. };
  921. // Cylinder and cone (Code inspired by SharpDX.org)
  922. Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, scene, updatable) {
  923. var cylinder = new BABYLON.Mesh(name, scene);
  924. var vertexData = BABYLON.VertexData.CreateCylinder(height, diameterTop, diameterBottom, tessellation);
  925. vertexData.applyToMesh(cylinder, updatable);
  926. return cylinder;
  927. };
  928. // Torus (Code from SharpDX.org)
  929. Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable) {
  930. var torus = new BABYLON.Mesh(name, scene);
  931. var vertexData = BABYLON.VertexData.CreateTorus(diameter, thickness, tessellation);
  932. vertexData.applyToMesh(torus, updatable);
  933. return torus;
  934. };
  935. Mesh.CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable) {
  936. var torusKnot = new BABYLON.Mesh(name, scene);
  937. var vertexData = BABYLON.VertexData.CreateTorusKnot(radius, tube, radialSegments, tubularSegments, p, q);
  938. vertexData.applyToMesh(torusKnot, updatable);
  939. return torusKnot;
  940. };
  941. // Plane & ground
  942. Mesh.CreatePlane = function (name, size, scene, updatable) {
  943. var plane = new BABYLON.Mesh(name, scene);
  944. var vertexData = BABYLON.VertexData.CreatePlane(size);
  945. vertexData.applyToMesh(plane, updatable);
  946. return plane;
  947. };
  948. Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {
  949. var ground = new BABYLON.Mesh(name, scene);
  950. var vertexData = BABYLON.VertexData.CreateGround(width, height, subdivisions);
  951. vertexData.applyToMesh(ground, updatable);
  952. return ground;
  953. };
  954. Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable) {
  955. var ground = new BABYLON.Mesh(name, scene);
  956. var onload = function (img) {
  957. // Getting height map data
  958. var canvas = document.createElement("canvas");
  959. var context = canvas.getContext("2d");
  960. var heightMapWidth = img.width;
  961. var heightMapHeight = img.height;
  962. canvas.width = heightMapWidth;
  963. canvas.height = heightMapHeight;
  964. context.drawImage(img, 0, 0);
  965. // Create VertexData from map data
  966. var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;
  967. var vertexData = BABYLON.VertexData.CreateGroundFromHeightMap(width, height, subdivisions, minHeight, maxHeight, buffer, heightMapWidth, heightMapHeight);
  968. vertexData.applyToMesh(ground, updatable);
  969. ground._isReady = true;
  970. };
  971. BABYLON.Tools.LoadImage(url, onload, function () {
  972. }, scene.database);
  973. ground._isReady = false;
  974. return ground;
  975. };
  976. // Tools
  977. Mesh.MinMax = function (meshes) {
  978. var minVector = null;
  979. var maxVector = null;
  980. for (var i in meshes) {
  981. var mesh = meshes[i];
  982. var boundingBox = mesh.getBoundingInfo().boundingBox;
  983. if (!minVector) {
  984. minVector = boundingBox.minimumWorld;
  985. maxVector = boundingBox.maximumWorld;
  986. continue;
  987. }
  988. minVector.MinimizeInPlace(boundingBox.minimumWorld);
  989. maxVector.MaximizeInPlace(boundingBox.maximumWorld);
  990. }
  991. return {
  992. min: minVector,
  993. max: maxVector
  994. };
  995. };
  996. Mesh.Center = function (meshesOrMinMaxVector) {
  997. var minMaxVector = meshesOrMinMaxVector.min !== undefined ? meshesOrMinMaxVector : BABYLON.Mesh.MinMax(meshesOrMinMaxVector);
  998. return BABYLON.Vector3.Center(minMaxVector.min, minMaxVector.max);
  999. };
  1000. Mesh._BILLBOARDMODE_NONE = 0;
  1001. Mesh._BILLBOARDMODE_X = 1;
  1002. Mesh._BILLBOARDMODE_Y = 2;
  1003. Mesh._BILLBOARDMODE_Z = 4;
  1004. Mesh._BILLBOARDMODE_ALL = 7;
  1005. return Mesh;
  1006. })(BABYLON.Node);
  1007. BABYLON.Mesh = Mesh;
  1008. })(BABYLON || (BABYLON = {}));
  1009. //# sourceMappingURL=babylon.mesh.js.map