Pārlūkot izejas kodu

Updating Math library
New engine.runRenderLoop function

Deltakosh 12 gadi atpakaļ
vecāks
revīzija
bf5d82121e
3 mainītis faili ar 28 papildinājumiem un 2 dzēšanām
  1. 1 1
      Babylon/Tools/babylon.math.js
  2. 26 0
      Babylon/babylon.engine.js
  3. 1 1
      babylon.js

+ 1 - 1
Babylon/Tools/babylon.math.js

@@ -628,7 +628,7 @@
     ////////////////////////////////// Matrix //////////////////////////////////
 
     BABYLON.Matrix = function () {
-        this.m = [];
+        this.m = new Array(16);
     };
 
     // Properties

+ 26 - 0
Babylon/babylon.engine.js

@@ -105,6 +105,32 @@
     };
 
     // Methods
+    BABYLON.Engine.prototype.stopRenderLoop = function () {
+        this._runningLoop = false;
+    };
+
+    BABYLON.Engine.prototype.runRenderLoop = function (renderFunction) {
+        this._runningLoop = true
+        var that = this;
+
+        var loop = function () {
+            // Start new frame
+            that.beginFrame();
+
+            renderFunction();
+
+            // Present
+            that.endFrame();
+
+            if (that._runningLoop) {
+                // Register new frame
+                BABYLON.Tools.QueueNewFrame(loop);
+            }
+        };
+
+        BABYLON.Tools.QueueNewFrame(loop);
+    };
+
     BABYLON.Engine.prototype.switchFullscreen = function (element) {
         if (this.isFullscreen) {
             BABYLON.Tools.ExitFullscreen();

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
babylon.js