Преглед изворни кода

Updating Math library
New engine.runRenderLoop function

Deltakosh пре 12 година
родитељ
комит
bf5d82121e
3 измењених фајлова са 28 додато и 2 уклоњено
  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();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
babylon.js