Просмотр исходного кода

introduce getLeft and right controller for webVRCamera

David Catuhe 8 лет назад
Родитель
Сommit
1a2f05b8ce

Разница между файлами не показана из-за своего большого размера
+ 2645 - 2640
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 37 - 37
dist/preview release/babylon.js


+ 31 - 0
dist/preview release/babylon.max.js

@@ -58990,6 +58990,37 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        WebVRFreeCamera.prototype.getControllerByName = function (name) {
+            var controller;
+            this.controllers.forEach(function (gp) {
+                if (gp.hand === name) {
+                    return gp;
+                }
+            });
+            return controller;
+        };
+        Object.defineProperty(WebVRFreeCamera.prototype, "leftController", {
+            get: function () {
+                if (!this._leftController) {
+                    this._leftController = this.getControllerByName("left");
+                }
+                return this._leftController;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        ;
+        Object.defineProperty(WebVRFreeCamera.prototype, "rightController", {
+            get: function () {
+                if (!this._rightController) {
+                    this._rightController = this.getControllerByName("right");
+                }
+                return this._rightController;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        ;
         WebVRFreeCamera.prototype.getLeftCamera = function () {
             return this._rigCameras[0];
         };

Разница между файлами не показана из-за своего большого размера
+ 2645 - 2640
dist/preview release/babylon.module.d.ts


Разница между файлами не показана из-за своего большого размера
+ 38 - 38
dist/preview release/babylon.worker.js


+ 30 - 0
src/Cameras/VR/babylon.webVRCamera.ts

@@ -186,6 +186,36 @@ module BABYLON {
             }
         }
 
+        public getControllerByName(name: string): WebVRController {
+            var controller: WebVRController;
+
+            this.controllers.forEach(gp => {
+                if (gp.hand === name) {
+                    return gp;
+                }
+            })
+
+            return controller;
+        }
+
+        private _leftController: WebVRController;
+        public get leftController(): WebVRController {
+            if (!this._leftController) {
+                this._leftController = this.getControllerByName("left");
+            }
+
+            return this._leftController;
+        };
+
+        private _rightController: WebVRController;
+        public get rightController(): WebVRController {
+            if (!this._rightController) {
+                this._rightController = this.getControllerByName("right");
+            }
+
+            return this._rightController;
+        };
+
         public getLeftCamera() {
             return (<FreeCamera>this._rigCameras[0]);
         }