babylon.scene.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367
  1. var BABYLON;
  2. (function (BABYLON) {
  3. var Scene = (function () {
  4. // Constructor
  5. function Scene(engine) {
  6. // Members
  7. this.autoClear = true;
  8. this.clearColor = new BABYLON.Color3(0.2, 0.2, 0.3);
  9. this.ambientColor = new BABYLON.Color3(0, 0, 0);
  10. this.forceWireframe = false;
  11. this.cameraToUseForPointers = null;
  12. // Fog
  13. this.fogMode = BABYLON.Scene.FOGMODE_NONE;
  14. this.fogColor = new BABYLON.Color3(0.2, 0.2, 0.3);
  15. this.fogDensity = 0.1;
  16. this.fogStart = 0;
  17. this.fogEnd = 1000.0;
  18. // Lights
  19. this.lightsEnabled = true;
  20. this.lights = new Array();
  21. // Cameras
  22. this.cameras = new Array();
  23. this.activeCameras = new Array();
  24. // Meshes
  25. this.meshes = new Array();
  26. // Geometries
  27. this._geometries = new Array();
  28. this.materials = new Array();
  29. this.multiMaterials = new Array();
  30. this.defaultMaterial = new BABYLON.StandardMaterial("default material", this);
  31. // Textures
  32. this.texturesEnabled = true;
  33. this.textures = new Array();
  34. // Particles
  35. this.particlesEnabled = true;
  36. this.particleSystems = new Array();
  37. // Sprites
  38. this.spriteManagers = new Array();
  39. // Layers
  40. this.layers = new Array();
  41. // Skeletons
  42. this.skeletons = new Array();
  43. // Lens flares
  44. this.lensFlareSystems = new Array();
  45. // Collisions
  46. this.collisionsEnabled = true;
  47. this.gravity = new BABYLON.Vector3(0, -9.0, 0);
  48. // Postprocesses
  49. this.postProcessesEnabled = true;
  50. // Customs render targets
  51. this.renderTargetsEnabled = true;
  52. this.customRenderTargets = new Array();
  53. // Imported meshes
  54. this.importedMeshesFiles = new Array();
  55. this._actionManagers = new Array();
  56. this._meshesForIntersections = new BABYLON.SmartArray(256);
  57. this._totalVertices = 0;
  58. this._activeVertices = 0;
  59. this._activeParticles = 0;
  60. this._lastFrameDuration = 0;
  61. this._evaluateActiveMeshesDuration = 0;
  62. this._renderTargetsDuration = 0;
  63. this._particlesDuration = 0;
  64. this._renderDuration = 0;
  65. this._spritesDuration = 0;
  66. this._animationRatio = 0;
  67. this._renderId = 0;
  68. this._executeWhenReadyTimeoutId = -1;
  69. this._toBeDisposed = new BABYLON.SmartArray(256);
  70. this._onReadyCallbacks = new Array();
  71. this._pendingData = [];
  72. this._onBeforeRenderCallbacks = new Array();
  73. this._activeMeshes = new BABYLON.SmartArray(256);
  74. this._processedMaterials = new BABYLON.SmartArray(256);
  75. this._renderTargets = new BABYLON.SmartArray(256);
  76. this._activeParticleSystems = new BABYLON.SmartArray(256);
  77. this._activeSkeletons = new BABYLON.SmartArray(32);
  78. this._activeAnimatables = new Array();
  79. this._transformMatrix = BABYLON.Matrix.Zero();
  80. this._scaledPosition = BABYLON.Vector3.Zero();
  81. this._scaledVelocity = BABYLON.Vector3.Zero();
  82. this._engine = engine;
  83. engine.scenes.push(this);
  84. this._renderingManager = new BABYLON.RenderingManager(this);
  85. this.postProcessManager = new BABYLON.PostProcessManager(this);
  86. this.postProcessRenderPipelineManager = new BABYLON.PostProcessRenderPipelineManager();
  87. this._boundingBoxRenderer = new BABYLON.BoundingBoxRenderer(this);
  88. this.attachControl();
  89. }
  90. Object.defineProperty(Scene.prototype, "meshUnderPointer", {
  91. // Properties
  92. get: function () {
  93. return this._meshUnderPointer;
  94. },
  95. enumerable: true,
  96. configurable: true
  97. });
  98. Object.defineProperty(Scene.prototype, "pointerX", {
  99. get: function () {
  100. return this._pointerX;
  101. },
  102. enumerable: true,
  103. configurable: true
  104. });
  105. Object.defineProperty(Scene.prototype, "pointerY", {
  106. get: function () {
  107. return this._pointerY;
  108. },
  109. enumerable: true,
  110. configurable: true
  111. });
  112. Scene.prototype.getBoundingBoxRenderer = function () {
  113. return this._boundingBoxRenderer;
  114. };
  115. Scene.prototype.getEngine = function () {
  116. return this._engine;
  117. };
  118. Scene.prototype.getTotalVertices = function () {
  119. return this._totalVertices;
  120. };
  121. Scene.prototype.getActiveVertices = function () {
  122. return this._activeVertices;
  123. };
  124. Scene.prototype.getActiveParticles = function () {
  125. return this._activeParticles;
  126. };
  127. // Stats
  128. Scene.prototype.getLastFrameDuration = function () {
  129. return this._lastFrameDuration;
  130. };
  131. Scene.prototype.getEvaluateActiveMeshesDuration = function () {
  132. return this._evaluateActiveMeshesDuration;
  133. };
  134. Scene.prototype.getActiveMeshes = function () {
  135. return this._activeMeshes;
  136. };
  137. Scene.prototype.getRenderTargetsDuration = function () {
  138. return this._renderTargetsDuration;
  139. };
  140. Scene.prototype.getRenderDuration = function () {
  141. return this._renderDuration;
  142. };
  143. Scene.prototype.getParticlesDuration = function () {
  144. return this._particlesDuration;
  145. };
  146. Scene.prototype.getSpritesDuration = function () {
  147. return this._spritesDuration;
  148. };
  149. Scene.prototype.getAnimationRatio = function () {
  150. return this._animationRatio;
  151. };
  152. Scene.prototype.getRenderId = function () {
  153. return this._renderId;
  154. };
  155. Scene.prototype._updatePointerPosition = function (evt) {
  156. var canvasRect = this._engine.getRenderingCanvasClientRect();
  157. this._pointerX = evt.clientX - canvasRect.left;
  158. this._pointerY = evt.clientY - canvasRect.top;
  159. if (this.cameraToUseForPointers) {
  160. this._pointerX = this._pointerX - this.cameraToUseForPointers.viewport.x * this._engine.getRenderWidth();
  161. this._pointerY = this._pointerY - this.cameraToUseForPointers.viewport.y * this._engine.getRenderHeight();
  162. }
  163. };
  164. // Pointers handling
  165. Scene.prototype.attachControl = function () {
  166. var _this = this;
  167. this._onPointerMove = function (evt) {
  168. var canvas = _this._engine.getRenderingCanvas();
  169. _this._updatePointerPosition(evt);
  170. var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) {
  171. return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasPointerTriggers;
  172. }, false, _this.cameraToUseForPointers);
  173. if (pickResult.hit) {
  174. _this.setPointerOverMesh(pickResult.pickedMesh);
  175. canvas.style.cursor = "pointer";
  176. _this._meshUnderPointer = pickResult.pickedMesh;
  177. } else {
  178. _this.setPointerOverMesh(null);
  179. canvas.style.cursor = "";
  180. _this._meshUnderPointer = null;
  181. }
  182. };
  183. this._onPointerDown = function (evt) {
  184. var predicate = null;
  185. if (!_this.onPointerDown) {
  186. predicate = function (mesh) {
  187. return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasPickTriggers;
  188. };
  189. }
  190. _this._updatePointerPosition(evt);
  191. var pickResult = _this.pick(_this._pointerX, _this._pointerY, predicate, false, _this.cameraToUseForPointers);
  192. if (pickResult.hit) {
  193. if (pickResult.pickedMesh.actionManager) {
  194. switch (evt.button) {
  195. case 0:
  196. pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnLeftPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh));
  197. break;
  198. case 1:
  199. pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnCenterPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh));
  200. break;
  201. case 2:
  202. pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnRightPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh));
  203. break;
  204. }
  205. pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh));
  206. }
  207. }
  208. if (_this.onPointerDown) {
  209. _this.onPointerDown(evt, pickResult);
  210. }
  211. };
  212. var eventPrefix = BABYLON.Tools.GetPointerPrefix();
  213. this._engine.getRenderingCanvas().addEventListener(eventPrefix + "move", this._onPointerMove, false);
  214. this._engine.getRenderingCanvas().addEventListener(eventPrefix + "down", this._onPointerDown, false);
  215. };
  216. Scene.prototype.detachControl = function () {
  217. var eventPrefix = BABYLON.Tools.GetPointerPrefix();
  218. this._engine.getRenderingCanvas().removeEventListener(eventPrefix + "move", this._onPointerMove);
  219. this._engine.getRenderingCanvas().removeEventListener(eventPrefix + "down", this._onPointerDown);
  220. };
  221. // Ready
  222. Scene.prototype.isReady = function () {
  223. if (this._pendingData.length > 0) {
  224. return false;
  225. }
  226. for (var index = 0; index < this._geometries.length; index++) {
  227. var geometry = this._geometries[index];
  228. if (geometry.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_LOADING) {
  229. return false;
  230. }
  231. }
  232. for (index = 0; index < this.meshes.length; index++) {
  233. var mesh = this.meshes[index];
  234. if (!mesh.isReady()) {
  235. return false;
  236. }
  237. var mat = mesh.material;
  238. if (mat) {
  239. if (!mat.isReady(mesh)) {
  240. return false;
  241. }
  242. }
  243. }
  244. return true;
  245. };
  246. Scene.prototype.registerBeforeRender = function (func) {
  247. this._onBeforeRenderCallbacks.push(func);
  248. };
  249. Scene.prototype.unregisterBeforeRender = function (func) {
  250. var index = this._onBeforeRenderCallbacks.indexOf(func);
  251. if (index > -1) {
  252. this._onBeforeRenderCallbacks.splice(index, 1);
  253. }
  254. };
  255. Scene.prototype._addPendingData = function (data) {
  256. this._pendingData.push(data);
  257. };
  258. Scene.prototype._removePendingData = function (data) {
  259. var index = this._pendingData.indexOf(data);
  260. if (index !== -1) {
  261. this._pendingData.splice(index, 1);
  262. }
  263. };
  264. Scene.prototype.getWaitingItemsCount = function () {
  265. return this._pendingData.length;
  266. };
  267. Scene.prototype.executeWhenReady = function (func) {
  268. var _this = this;
  269. this._onReadyCallbacks.push(func);
  270. if (this._executeWhenReadyTimeoutId !== -1) {
  271. return;
  272. }
  273. this._executeWhenReadyTimeoutId = setTimeout(function () {
  274. _this._checkIsReady();
  275. }, 150);
  276. };
  277. Scene.prototype._checkIsReady = function () {
  278. var _this = this;
  279. if (this.isReady()) {
  280. this._onReadyCallbacks.forEach(function (func) {
  281. func();
  282. });
  283. this._onReadyCallbacks = [];
  284. this._executeWhenReadyTimeoutId = -1;
  285. return;
  286. }
  287. this._executeWhenReadyTimeoutId = setTimeout(function () {
  288. _this._checkIsReady();
  289. }, 150);
  290. };
  291. // Animations
  292. Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
  293. if (speedRatio === undefined) {
  294. speedRatio = 1.0;
  295. }
  296. this.stopAnimation(target);
  297. if (!animatable) {
  298. animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd);
  299. }
  300. // Local animations
  301. if (target.animations) {
  302. animatable.appendAnimations(target, target.animations);
  303. }
  304. // Children animations
  305. if (target.getAnimatables) {
  306. var animatables = target.getAnimatables();
  307. for (var index = 0; index < animatables.length; index++) {
  308. this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable);
  309. }
  310. }
  311. return animatable;
  312. };
  313. Scene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd) {
  314. if (speedRatio === undefined) {
  315. speedRatio = 1.0;
  316. }
  317. var animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations);
  318. return animatable;
  319. };
  320. Scene.prototype.getAnimatableByTarget = function (target) {
  321. for (var index = 0; index < this._activeAnimatables.length; index++) {
  322. if (this._activeAnimatables[index].target === target) {
  323. return this._activeAnimatables[index];
  324. }
  325. }
  326. return null;
  327. };
  328. Scene.prototype.stopAnimation = function (target) {
  329. var animatable = this.getAnimatableByTarget(target);
  330. if (animatable) {
  331. animatable.stop();
  332. }
  333. };
  334. Scene.prototype._animate = function () {
  335. if (!this._animationStartDate) {
  336. this._animationStartDate = new Date().getTime();
  337. }
  338. // Getting time
  339. var now = new Date().getTime();
  340. var delay = now - this._animationStartDate;
  341. for (var index = 0; index < this._activeAnimatables.length; index++) {
  342. if (!this._activeAnimatables[index]._animate(delay)) {
  343. this._activeAnimatables.splice(index, 1);
  344. index--;
  345. }
  346. }
  347. };
  348. // Matrix
  349. Scene.prototype.getViewMatrix = function () {
  350. return this._viewMatrix;
  351. };
  352. Scene.prototype.getProjectionMatrix = function () {
  353. return this._projectionMatrix;
  354. };
  355. Scene.prototype.getTransformMatrix = function () {
  356. return this._transformMatrix;
  357. };
  358. Scene.prototype.setTransformMatrix = function (view, projection) {
  359. this._viewMatrix = view;
  360. this._projectionMatrix = projection;
  361. this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
  362. };
  363. // Methods
  364. Scene.prototype.setActiveCameraByID = function (id) {
  365. var camera = this.getCameraByID(id);
  366. if (camera) {
  367. this.activeCamera = camera;
  368. return camera;
  369. }
  370. return null;
  371. };
  372. Scene.prototype.setActiveCameraByName = function (name) {
  373. var camera = this.getCameraByName(name);
  374. if (camera) {
  375. this.activeCamera = camera;
  376. return camera;
  377. }
  378. return null;
  379. };
  380. Scene.prototype.getMaterialByID = function (id) {
  381. for (var index = 0; index < this.materials.length; index++) {
  382. if (this.materials[index].id === id) {
  383. return this.materials[index];
  384. }
  385. }
  386. return null;
  387. };
  388. Scene.prototype.getMaterialByName = function (name) {
  389. for (var index = 0; index < this.materials.length; index++) {
  390. if (this.materials[index].name === name) {
  391. return this.materials[index];
  392. }
  393. }
  394. return null;
  395. };
  396. Scene.prototype.getCameraByID = function (id) {
  397. for (var index = 0; index < this.cameras.length; index++) {
  398. if (this.cameras[index].id === id) {
  399. return this.cameras[index];
  400. }
  401. }
  402. return null;
  403. };
  404. Scene.prototype.getCameraByName = function (name) {
  405. for (var index = 0; index < this.cameras.length; index++) {
  406. if (this.cameras[index].name === name) {
  407. return this.cameras[index];
  408. }
  409. }
  410. return null;
  411. };
  412. Scene.prototype.getLightByName = function (name) {
  413. for (var index = 0; index < this.lights.length; index++) {
  414. if (this.lights[index].name === name) {
  415. return this.lights[index];
  416. }
  417. }
  418. return null;
  419. };
  420. Scene.prototype.getLightByID = function (id) {
  421. for (var index = 0; index < this.lights.length; index++) {
  422. if (this.lights[index].id === id) {
  423. return this.lights[index];
  424. }
  425. }
  426. return null;
  427. };
  428. Scene.prototype.getGeometryByID = function (id) {
  429. for (var index = 0; index < this._geometries.length; index++) {
  430. if (this._geometries[index].id === id) {
  431. return this._geometries[index];
  432. }
  433. }
  434. return null;
  435. };
  436. Scene.prototype.pushGeometry = function (geometry, force) {
  437. if (!force && this.getGeometryByID(geometry.id)) {
  438. return false;
  439. }
  440. this._geometries.push(geometry);
  441. return true;
  442. };
  443. Scene.prototype.getGeometries = function () {
  444. return this._geometries;
  445. };
  446. Scene.prototype.getMeshByID = function (id) {
  447. for (var index = 0; index < this.meshes.length; index++) {
  448. if (this.meshes[index].id === id) {
  449. return this.meshes[index];
  450. }
  451. }
  452. return null;
  453. };
  454. Scene.prototype.getLastMeshByID = function (id) {
  455. for (var index = this.meshes.length - 1; index >= 0; index--) {
  456. if (this.meshes[index].id === id) {
  457. return this.meshes[index];
  458. }
  459. }
  460. return null;
  461. };
  462. Scene.prototype.getLastEntryByID = function (id) {
  463. for (var index = this.meshes.length - 1; index >= 0; index--) {
  464. if (this.meshes[index].id === id) {
  465. return this.meshes[index];
  466. }
  467. }
  468. for (index = this.cameras.length - 1; index >= 0; index--) {
  469. if (this.cameras[index].id === id) {
  470. return this.cameras[index];
  471. }
  472. }
  473. for (index = this.lights.length - 1; index >= 0; index--) {
  474. if (this.lights[index].id === id) {
  475. return this.lights[index];
  476. }
  477. }
  478. return null;
  479. };
  480. Scene.prototype.getMeshByName = function (name) {
  481. for (var index = 0; index < this.meshes.length; index++) {
  482. if (this.meshes[index].name === name) {
  483. return this.meshes[index];
  484. }
  485. }
  486. return null;
  487. };
  488. Scene.prototype.getLastSkeletonByID = function (id) {
  489. for (var index = this.skeletons.length - 1; index >= 0; index--) {
  490. if (this.skeletons[index].id === id) {
  491. return this.skeletons[index];
  492. }
  493. }
  494. return null;
  495. };
  496. Scene.prototype.getSkeletonById = function (id) {
  497. for (var index = 0; index < this.skeletons.length; index++) {
  498. if (this.skeletons[index].id === id) {
  499. return this.skeletons[index];
  500. }
  501. }
  502. return null;
  503. };
  504. Scene.prototype.getSkeletonByName = function (name) {
  505. for (var index = 0; index < this.skeletons.length; index++) {
  506. if (this.skeletons[index].name === name) {
  507. return this.skeletons[index];
  508. }
  509. }
  510. return null;
  511. };
  512. Scene.prototype.isActiveMesh = function (mesh) {
  513. return (this._activeMeshes.indexOf(mesh) !== -1);
  514. };
  515. Scene.prototype._evaluateSubMesh = function (subMesh, mesh) {
  516. if (mesh.subMeshes.length == 1 || subMesh.isInFrustum(this._frustumPlanes)) {
  517. var material = subMesh.getMaterial();
  518. if (mesh.showSubMeshesBoundingBox) {
  519. this._boundingBoxRenderer.renderList.push(subMesh.getBoundingInfo().boundingBox);
  520. }
  521. if (material) {
  522. // Render targets
  523. if (material.getRenderTargetTextures) {
  524. if (this._processedMaterials.indexOf(material) === -1) {
  525. this._processedMaterials.push(material);
  526. this._renderTargets.concat(material.getRenderTargetTextures());
  527. }
  528. }
  529. // Dispatch
  530. this._activeVertices += subMesh.verticesCount;
  531. this._renderingManager.dispatch(subMesh);
  532. }
  533. }
  534. };
  535. Scene.prototype._evaluateActiveMeshes = function () {
  536. this._activeMeshes.reset();
  537. this._renderingManager.reset();
  538. this._processedMaterials.reset();
  539. this._activeParticleSystems.reset();
  540. this._activeSkeletons.reset();
  541. this._boundingBoxRenderer.reset();
  542. if (!this._frustumPlanes) {
  543. this._frustumPlanes = BABYLON.Frustum.GetPlanes(this._transformMatrix);
  544. } else {
  545. BABYLON.Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);
  546. }
  547. // Meshes
  548. var meshes;
  549. var len;
  550. if (this._selectionOctree) {
  551. var selection = this._selectionOctree.select(this._frustumPlanes);
  552. meshes = selection.data;
  553. len = selection.length;
  554. } else {
  555. len = this.meshes.length;
  556. meshes = this.meshes;
  557. }
  558. for (var meshIndex = 0; meshIndex < len; meshIndex++) {
  559. var mesh = meshes[meshIndex];
  560. this._totalVertices += mesh.getTotalVertices();
  561. if (!mesh.isReady()) {
  562. continue;
  563. }
  564. mesh.computeWorldMatrix();
  565. mesh._preActivate();
  566. // Intersections
  567. if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers([BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger])) {
  568. this._meshesForIntersections.pushNoDuplicate(mesh);
  569. }
  570. if (mesh.isEnabled() && mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) != 0) && mesh.isInFrustum(this._frustumPlanes)) {
  571. this._activeMeshes.push(mesh);
  572. mesh._activate(this._renderId);
  573. this._activeMesh(mesh);
  574. }
  575. }
  576. // Particle systems
  577. var beforeParticlesDate = new Date().getTime();
  578. if (this.particlesEnabled) {
  579. for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {
  580. var particleSystem = this.particleSystems[particleIndex];
  581. if (!particleSystem.isStarted()) {
  582. continue;
  583. }
  584. if (!particleSystem.emitter.position || (particleSystem.emitter && particleSystem.emitter.isEnabled())) {
  585. this._activeParticleSystems.push(particleSystem);
  586. particleSystem.animate();
  587. }
  588. }
  589. }
  590. this._particlesDuration += new Date().getTime() - beforeParticlesDate;
  591. };
  592. Scene.prototype._activeMesh = function (mesh) {
  593. if (mesh.skeleton) {
  594. this._activeSkeletons.pushNoDuplicate(mesh.skeleton);
  595. }
  596. if (mesh.showBoundingBox) {
  597. this._boundingBoxRenderer.renderList.push(mesh.getBoundingInfo().boundingBox);
  598. }
  599. if (mesh.subMeshes) {
  600. // Submeshes Octrees
  601. var len;
  602. var subMeshes;
  603. if (mesh._submeshesOctree && mesh.useOctreeForRenderingSelection) {
  604. var intersections = mesh._submeshesOctree.select(this._frustumPlanes);
  605. len = intersections.length;
  606. subMeshes = intersections.data;
  607. } else {
  608. subMeshes = mesh.subMeshes;
  609. len = subMeshes.length;
  610. }
  611. for (var subIndex = 0; subIndex < len; subIndex++) {
  612. var subMesh = subMeshes[subIndex];
  613. this._evaluateSubMesh(subMesh, mesh);
  614. }
  615. }
  616. };
  617. Scene.prototype.updateTransformMatrix = function (force) {
  618. this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));
  619. };
  620. Scene.prototype._renderForCamera = function (camera) {
  621. var engine = this._engine;
  622. this.activeCamera = camera;
  623. if (!this.activeCamera)
  624. throw new Error("Active camera not set");
  625. // Viewport
  626. engine.setViewport(this.activeCamera.viewport);
  627. // Camera
  628. this._renderId++;
  629. this.updateTransformMatrix();
  630. if (this.beforeCameraRender) {
  631. this.beforeCameraRender(this.activeCamera);
  632. }
  633. // Meshes
  634. var beforeEvaluateActiveMeshesDate = new Date().getTime();
  635. this._evaluateActiveMeshes();
  636. this._evaluateActiveMeshesDuration += new Date().getTime() - beforeEvaluateActiveMeshesDate;
  637. for (var skeletonIndex = 0; skeletonIndex < this._activeSkeletons.length; skeletonIndex++) {
  638. var skeleton = this._activeSkeletons.data[skeletonIndex];
  639. skeleton.prepare();
  640. }
  641. for (var customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {
  642. var renderTarget = this.customRenderTargets[customIndex];
  643. this._renderTargets.push(renderTarget);
  644. }
  645. // Render targets
  646. var beforeRenderTargetDate = new Date().getTime();
  647. if (this.renderTargetsEnabled) {
  648. for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {
  649. renderTarget = this._renderTargets.data[renderIndex];
  650. if (renderTarget._shouldRender()) {
  651. this._renderId++;
  652. renderTarget.render();
  653. }
  654. }
  655. this._renderId++;
  656. }
  657. if (this._renderTargets.length > 0) {
  658. engine.restoreDefaultFramebuffer();
  659. }
  660. this._renderTargetsDuration = new Date().getTime() - beforeRenderTargetDate;
  661. // Prepare Frame
  662. this.postProcessManager._prepareFrame();
  663. var beforeRenderDate = new Date().getTime();
  664. // Backgrounds
  665. if (this.layers.length) {
  666. engine.setDepthBuffer(false);
  667. var layerIndex;
  668. var layer;
  669. for (layerIndex = 0; layerIndex < this.layers.length; layerIndex++) {
  670. layer = this.layers[layerIndex];
  671. if (layer.isBackground) {
  672. layer.render();
  673. }
  674. }
  675. engine.setDepthBuffer(true);
  676. }
  677. // Render
  678. this._renderingManager.render(null, null, true, true);
  679. // Bounding boxes
  680. this._boundingBoxRenderer.render();
  681. for (var lensFlareSystemIndex = 0; lensFlareSystemIndex < this.lensFlareSystems.length; lensFlareSystemIndex++) {
  682. this.lensFlareSystems[lensFlareSystemIndex].render();
  683. }
  684. // Foregrounds
  685. if (this.layers.length) {
  686. engine.setDepthBuffer(false);
  687. for (layerIndex = 0; layerIndex < this.layers.length; layerIndex++) {
  688. layer = this.layers[layerIndex];
  689. if (!layer.isBackground) {
  690. layer.render();
  691. }
  692. }
  693. engine.setDepthBuffer(true);
  694. }
  695. this._renderDuration += new Date().getTime() - beforeRenderDate;
  696. // Finalize frame
  697. this.postProcessManager._finalizeFrame(camera.isIntermediate);
  698. // Update camera
  699. this.activeCamera._updateFromScene();
  700. // Reset some special arrays
  701. this._renderTargets.reset();
  702. if (this.afterCameraRender) {
  703. this.afterCameraRender(this.activeCamera);
  704. }
  705. };
  706. Scene.prototype._processSubCameras = function (camera) {
  707. if (camera.subCameras.length == 0) {
  708. this._renderForCamera(camera);
  709. return;
  710. }
  711. for (var index = 0; index < camera.subCameras.length; index++) {
  712. this._renderForCamera(camera.subCameras[index]);
  713. }
  714. this.activeCamera = camera;
  715. this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
  716. // Update camera
  717. this.activeCamera._updateFromScene();
  718. };
  719. Scene.prototype._checkIntersections = function () {
  720. for (var index = 0; index < this._meshesForIntersections.length; index++) {
  721. var sourceMesh = this._meshesForIntersections.data[index];
  722. for (var actionIndex = 0; actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {
  723. var action = sourceMesh.actionManager.actions[actionIndex];
  724. if (action.trigger == BABYLON.ActionManager.OnIntersectionEnterTrigger || action.trigger == BABYLON.ActionManager.OnIntersectionExitTrigger) {
  725. var otherMesh = action.getTriggerParameter();
  726. var areIntersecting = otherMesh.intersectsMesh(sourceMesh, false);
  727. var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);
  728. if (areIntersecting && currentIntersectionInProgress === -1 && action.trigger == BABYLON.ActionManager.OnIntersectionEnterTrigger) {
  729. sourceMesh.actionManager.processTrigger(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionEvent.CreateNew(sourceMesh));
  730. sourceMesh._intersectionsInProgress.push(otherMesh);
  731. } else if (!areIntersecting && currentIntersectionInProgress > -1 && action.trigger == BABYLON.ActionManager.OnIntersectionExitTrigger) {
  732. sourceMesh.actionManager.processTrigger(BABYLON.ActionManager.OnIntersectionExitTrigger, BABYLON.ActionEvent.CreateNew(sourceMesh));
  733. var indexOfOther = sourceMesh._intersectionsInProgress.indexOf(otherMesh);
  734. if (indexOfOther > -1) {
  735. sourceMesh._intersectionsInProgress.splice(indexOfOther, 1);
  736. }
  737. }
  738. }
  739. }
  740. }
  741. };
  742. Scene.prototype.render = function () {
  743. var startDate = new Date().getTime();
  744. this._particlesDuration = 0;
  745. this._spritesDuration = 0;
  746. this._activeParticles = 0;
  747. this._renderDuration = 0;
  748. this._evaluateActiveMeshesDuration = 0;
  749. this._totalVertices = 0;
  750. this._activeVertices = 0;
  751. this._meshesForIntersections.reset();
  752. // Actions
  753. if (this.actionManager) {
  754. this.actionManager.processTrigger(BABYLON.ActionManager.OnEveryFrameTrigger, null);
  755. }
  756. // Before render
  757. if (this.beforeRender) {
  758. this.beforeRender();
  759. }
  760. for (var callbackIndex = 0; callbackIndex < this._onBeforeRenderCallbacks.length; callbackIndex++) {
  761. this._onBeforeRenderCallbacks[callbackIndex]();
  762. }
  763. // Animations
  764. var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(BABYLON.Tools.GetDeltaTime(), Scene.MaxDeltaTime));
  765. this._animationRatio = deltaTime * (60.0 / 1000.0);
  766. this._animate();
  767. // Physics
  768. if (this._physicsEngine) {
  769. this._physicsEngine._runOneStep(deltaTime / 1000.0);
  770. }
  771. // Clear
  772. this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe, true);
  773. for (var lightIndex = 0; lightIndex < this.lights.length; lightIndex++) {
  774. var light = this.lights[lightIndex];
  775. var shadowGenerator = light.getShadowGenerator();
  776. if (light.isEnabled() && shadowGenerator && shadowGenerator.getShadowMap().getScene().textures.indexOf(shadowGenerator.getShadowMap()) !== -1) {
  777. this._renderTargets.push(shadowGenerator.getShadowMap());
  778. }
  779. }
  780. // RenderPipeline
  781. this.postProcessRenderPipelineManager.update();
  782. // Multi-cameras?
  783. if (this.activeCameras.length > 0) {
  784. var currentRenderId = this._renderId;
  785. for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
  786. this._renderId = currentRenderId;
  787. this._processSubCameras(this.activeCameras[cameraIndex]);
  788. }
  789. } else {
  790. this._processSubCameras(this.activeCamera);
  791. }
  792. // Intersection checks
  793. this._checkIntersections();
  794. // After render
  795. if (this.afterRender) {
  796. this.afterRender();
  797. }
  798. for (var index = 0; index < this._toBeDisposed.length; index++) {
  799. this._toBeDisposed.data[index].dispose();
  800. this._toBeDisposed[index] = null;
  801. }
  802. this._toBeDisposed.reset();
  803. this._lastFrameDuration = new Date().getTime() - startDate;
  804. };
  805. Scene.prototype.dispose = function () {
  806. this.beforeRender = null;
  807. this.afterRender = null;
  808. this.skeletons = [];
  809. this._boundingBoxRenderer.dispose();
  810. // Events
  811. if (this.onDispose) {
  812. this.onDispose();
  813. }
  814. this.detachControl();
  815. // Detach cameras
  816. var canvas = this._engine.getRenderingCanvas();
  817. var index;
  818. for (index = 0; index < this.cameras.length; index++) {
  819. this.cameras[index].detachControl(canvas);
  820. }
  821. while (this.lights.length) {
  822. this.lights[0].dispose();
  823. }
  824. while (this.meshes.length) {
  825. this.meshes[0].dispose(true);
  826. }
  827. while (this.cameras.length) {
  828. this.cameras[0].dispose();
  829. }
  830. while (this.materials.length) {
  831. this.materials[0].dispose();
  832. }
  833. while (this.particleSystems.length) {
  834. this.particleSystems[0].dispose();
  835. }
  836. while (this.spriteManagers.length) {
  837. this.spriteManagers[0].dispose();
  838. }
  839. while (this.layers.length) {
  840. this.layers[0].dispose();
  841. }
  842. while (this.textures.length) {
  843. this.textures[0].dispose();
  844. }
  845. // Post-processes
  846. this.postProcessManager.dispose();
  847. // Physics
  848. if (this._physicsEngine) {
  849. this.disablePhysicsEngine();
  850. }
  851. // Remove from engine
  852. index = this._engine.scenes.indexOf(this);
  853. this._engine.scenes.splice(index, 1);
  854. this._engine.wipeCaches();
  855. };
  856. // Collisions
  857. Scene.prototype._getNewPosition = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
  858. if (typeof excludedMesh === "undefined") { excludedMesh = null; }
  859. position.divideToRef(collider.radius, this._scaledPosition);
  860. velocity.divideToRef(collider.radius, this._scaledVelocity);
  861. collider.retry = 0;
  862. collider.initialVelocity = this._scaledVelocity;
  863. collider.initialPosition = this._scaledPosition;
  864. this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, finalPosition, excludedMesh);
  865. finalPosition.multiplyInPlace(collider.radius);
  866. };
  867. Scene.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
  868. if (typeof excludedMesh === "undefined") { excludedMesh = null; }
  869. var closeDistance = BABYLON.Engine.CollisionsEpsilon * 10.0;
  870. if (collider.retry >= maximumRetry) {
  871. finalPosition.copyFrom(position);
  872. return;
  873. }
  874. collider._initialize(position, velocity, closeDistance);
  875. for (var index = 0; index < this.meshes.length; index++) {
  876. var mesh = this.meshes[index];
  877. if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh) {
  878. mesh._checkCollision(collider);
  879. }
  880. }
  881. if (!collider.collisionFound) {
  882. position.addToRef(velocity, finalPosition);
  883. return;
  884. }
  885. if (velocity.x != 0 || velocity.y != 0 || velocity.z != 0) {
  886. collider._getResponse(position, velocity);
  887. }
  888. if (velocity.length() <= closeDistance) {
  889. finalPosition.copyFrom(position);
  890. return;
  891. }
  892. collider.retry++;
  893. this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
  894. };
  895. // Octrees
  896. Scene.prototype.createOrUpdateSelectionOctree = function (maxCapacity, maxDepth) {
  897. if (typeof maxCapacity === "undefined") { maxCapacity = 64; }
  898. if (typeof maxDepth === "undefined") { maxDepth = 2; }
  899. if (!this._selectionOctree) {
  900. this._selectionOctree = new BABYLON.Octree(BABYLON.Octree.CreationFuncForMeshes, maxCapacity, maxDepth);
  901. }
  902. var min = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
  903. var max = new BABYLON.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
  904. for (var index = 0; index < this.meshes.length; index++) {
  905. var mesh = this.meshes[index];
  906. mesh.computeWorldMatrix(true);
  907. var minBox = mesh.getBoundingInfo().boundingBox.minimumWorld;
  908. var maxBox = mesh.getBoundingInfo().boundingBox.maximumWorld;
  909. BABYLON.Tools.CheckExtends(minBox, min, max);
  910. BABYLON.Tools.CheckExtends(maxBox, min, max);
  911. }
  912. // Update octree
  913. this._selectionOctree.update(min, max, this.meshes);
  914. return this._selectionOctree;
  915. };
  916. // Picking
  917. Scene.prototype.createPickingRay = function (x, y, world, camera) {
  918. var engine = this._engine;
  919. if (!camera) {
  920. if (!this.activeCamera)
  921. throw new Error("Active camera not set");
  922. camera = this.activeCamera;
  923. }
  924. var cameraViewport = camera.viewport;
  925. var viewport = cameraViewport.toGlobal(engine);
  926. // Moving coordinates to local viewport world
  927. x = x / this._engine.getHardwareScalingLevel() - viewport.x;
  928. y = y / this._engine.getHardwareScalingLevel() - (this._engine.getRenderHeight() - viewport.y - viewport.height);
  929. return BABYLON.Ray.CreateNew(x, y, viewport.width, viewport.height, world ? world : BABYLON.Matrix.Identity(), camera.getViewMatrix(), camera.getProjectionMatrix());
  930. };
  931. Scene.prototype._internalPick = function (rayFunction, predicate, fastCheck) {
  932. var pickingInfo = null;
  933. for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {
  934. var mesh = this.meshes[meshIndex];
  935. if (predicate) {
  936. if (!predicate(mesh)) {
  937. continue;
  938. }
  939. } else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
  940. continue;
  941. }
  942. var world = mesh.getWorldMatrix();
  943. var ray = rayFunction(world);
  944. var result = mesh.intersects(ray, fastCheck);
  945. if (!result || !result.hit)
  946. continue;
  947. if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance)
  948. continue;
  949. pickingInfo = result;
  950. if (fastCheck) {
  951. break;
  952. }
  953. }
  954. return pickingInfo || new BABYLON.PickingInfo();
  955. };
  956. Scene.prototype.pick = function (x, y, predicate, fastCheck, camera) {
  957. var _this = this;
  958. /// <summary>Launch a ray to try to pick a mesh in the scene</summary>
  959. /// <param name="x">X position on screen</param>
  960. /// <param name="y">Y position on screen</param>
  961. /// <param name="predicate">Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true</param>
  962. /// <param name="fastCheck">Launch a fast check only using the bounding boxes. Can be set to null.</param>
  963. /// <param name="camera">camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used</param>
  964. return this._internalPick(function (world) {
  965. return _this.createPickingRay(x, y, world, camera);
  966. }, predicate, fastCheck);
  967. };
  968. Scene.prototype.pickWithRay = function (ray, predicate, fastCheck) {
  969. var _this = this;
  970. return this._internalPick(function (world) {
  971. if (!_this._pickWithRayInverseMatrix) {
  972. _this._pickWithRayInverseMatrix = BABYLON.Matrix.Identity();
  973. }
  974. world.invertToRef(_this._pickWithRayInverseMatrix);
  975. return BABYLON.Ray.Transform(ray, _this._pickWithRayInverseMatrix);
  976. }, predicate, fastCheck);
  977. };
  978. Scene.prototype.setPointerOverMesh = function (mesh) {
  979. if (this._pointerOverMesh === mesh) {
  980. return;
  981. }
  982. if (this._pointerOverMesh && this._pointerOverMesh.actionManager) {
  983. this._pointerOverMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPointerOutTrigger, BABYLON.ActionEvent.CreateNew(this._pointerOverMesh));
  984. }
  985. this._pointerOverMesh = mesh;
  986. if (this._pointerOverMesh && this._pointerOverMesh.actionManager) {
  987. this._pointerOverMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPointerOverTrigger, BABYLON.ActionEvent.CreateNew(this._pointerOverMesh));
  988. }
  989. };
  990. Scene.prototype.getPointerOverMesh = function () {
  991. return this._pointerOverMesh;
  992. };
  993. // Physics
  994. Scene.prototype.getPhysicsEngine = function () {
  995. return this._physicsEngine;
  996. };
  997. Scene.prototype.enablePhysics = function (gravity, plugin) {
  998. if (this._physicsEngine) {
  999. return true;
  1000. }
  1001. this._physicsEngine = new BABYLON.PhysicsEngine(plugin);
  1002. if (!this._physicsEngine.isSupported()) {
  1003. this._physicsEngine = null;
  1004. return false;
  1005. }
  1006. this._physicsEngine._initialize(gravity);
  1007. return true;
  1008. };
  1009. Scene.prototype.disablePhysicsEngine = function () {
  1010. if (!this._physicsEngine) {
  1011. return;
  1012. }
  1013. this._physicsEngine.dispose();
  1014. this._physicsEngine = undefined;
  1015. };
  1016. Scene.prototype.isPhysicsEnabled = function () {
  1017. return this._physicsEngine !== undefined;
  1018. };
  1019. Scene.prototype.setGravity = function (gravity) {
  1020. if (!this._physicsEngine) {
  1021. return;
  1022. }
  1023. this._physicsEngine._setGravity(gravity);
  1024. };
  1025. Scene.prototype.createCompoundImpostor = function (parts, options) {
  1026. if (parts.parts) {
  1027. options = parts;
  1028. parts = parts.parts;
  1029. }
  1030. if (!this._physicsEngine) {
  1031. return null;
  1032. }
  1033. for (var index = 0; index < parts.length; index++) {
  1034. var mesh = parts[index].mesh;
  1035. mesh._physicImpostor = parts[index].impostor;
  1036. mesh._physicsMass = options.mass / parts.length;
  1037. mesh._physicsFriction = options.friction;
  1038. mesh._physicRestitution = options.restitution;
  1039. }
  1040. return this._physicsEngine._registerMeshesAsCompound(parts, options);
  1041. };
  1042. //ANY
  1043. Scene.prototype.deleteCompoundImpostor = function (compound) {
  1044. for (var index = 0; index < compound.parts.length; index++) {
  1045. var mesh = compound.parts[index].mesh;
  1046. mesh._physicImpostor = BABYLON.PhysicsEngine.NoImpostor;
  1047. this._physicsEngine._unregisterMesh(mesh);
  1048. }
  1049. };
  1050. // Tags
  1051. Scene.prototype._getByTags = function (list, tagsQuery) {
  1052. if (tagsQuery === undefined) {
  1053. // returns the complete list (could be done with BABYLON.Tags.MatchesQuery but no need to have a for-loop here)
  1054. return list;
  1055. }
  1056. var listByTags = [];
  1057. for (var i in list) {
  1058. var item = list[i];
  1059. if (BABYLON.Tags.MatchesQuery(item, tagsQuery)) {
  1060. listByTags.push(item);
  1061. }
  1062. }
  1063. return listByTags;
  1064. };
  1065. Scene.prototype.getMeshesByTags = function (tagsQuery) {
  1066. return this._getByTags(this.meshes, tagsQuery);
  1067. };
  1068. Scene.prototype.getCamerasByTags = function (tagsQuery) {
  1069. return this._getByTags(this.cameras, tagsQuery);
  1070. };
  1071. Scene.prototype.getLightsByTags = function (tagsQuery) {
  1072. return this._getByTags(this.lights, tagsQuery);
  1073. };
  1074. Scene.prototype.getMaterialByTags = function (tagsQuery) {
  1075. return this._getByTags(this.materials, tagsQuery).concat(this._getByTags(this.multiMaterials, tagsQuery));
  1076. };
  1077. Scene.FOGMODE_NONE = 0;
  1078. Scene.FOGMODE_EXP = 1;
  1079. Scene.FOGMODE_EXP2 = 2;
  1080. Scene.FOGMODE_LINEAR = 3;
  1081. Scene.MinDeltaTime = 1.0;
  1082. Scene.MaxDeltaTime = 1000.0;
  1083. return Scene;
  1084. })();
  1085. BABYLON.Scene = Scene;
  1086. })(BABYLON || (BABYLON = {}));
  1087. //# sourceMappingURL=babylon.scene.js.map