فهرست منبع

Move ArcFollowCamera into followCamera.ts

Fredrik Bondza 10 سال پیش
والد
کامیت
18be751fce
4فایلهای تغییر یافته به همراه33 افزوده شده و 72 حذف شده
  1. 1 2
      Tools/Gulp/config.json
  2. 0 38
      src/Cameras/babylon.arcFollowCamera.js
  3. 0 30
      src/Cameras/babylon.arcFollowCamera.ts
  4. 32 2
      src/Cameras/babylon.followCamera.ts

+ 1 - 2
Tools/Gulp/config.json

@@ -142,8 +142,7 @@
       "../../src/PostProcess/babylon.lensRenderingPipeline.js",
       "../../src/PostProcess/babylon.colorCorrectionPostProcess.js",
       "../../src/Cameras/babylon.stereoscopicCameras.js",
-      "../../src/PostProcess/babylon.hdrRenderingPipeline.js",
-      "../../src/Cameras/babylon.arcFollowCamera.js"
+      "../../src/PostProcess/babylon.hdrRenderingPipeline.js"
     ]
   },
   "shadersDirectories": [

+ 0 - 38
src/Cameras/babylon.arcFollowCamera.js

@@ -1,38 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcFollowCamera = (function (_super) {
-        __extends(ArcFollowCamera, _super);
-        function ArcFollowCamera(name, alpha, beta, radius, target, scene) {
-            _super.call(this, name, BABYLON.Vector3.Zero(), scene);
-            this.alpha = alpha;
-            this.beta = beta;
-            this.radius = radius;
-            this.target = target;
-            this._radPerDeg = Math.PI / 180;
-            this._cartesianCoordinates = BABYLON.Vector3.Zero();
-            this.follow();
-        }
-        ArcFollowCamera.prototype._degToRad = function (deg) {
-            return deg * this._radPerDeg;
-        };
-        ArcFollowCamera.prototype.follow = function () {
-            this._cartesianCoordinates.x = this.radius * Math.cos(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
-            this._cartesianCoordinates.y = this.radius * Math.sin(this._degToRad(this.beta));
-            this._cartesianCoordinates.z = this.radius * Math.sin(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
-            this.position = this.target.position.add(this._cartesianCoordinates);
-            this.setTarget(this.target.position);
-        };
-        ArcFollowCamera.prototype._checkInputs = function () {
-            _super.prototype._checkInputs.call(this);
-            this.follow();
-        };
-        return ArcFollowCamera;
-    })(BABYLON.TargetCamera);
-    BABYLON.ArcFollowCamera = ArcFollowCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 30
src/Cameras/babylon.arcFollowCamera.ts

@@ -1,30 +0,0 @@
-module BABYLON {
-    export class ArcFollowCamera extends TargetCamera {
-
-        private _radPerDeg:number = Math.PI / 180;
-        private _cartesianCoordinates:Vector3 = Vector3.Zero();
-
-        constructor(name:string, public alpha:number, public beta:number, public radius:number, public target:AbstractMesh, scene:Scene) {
-            super(name, Vector3.Zero(), scene);
-            this.follow();
-        }
-
-        private _degToRad(deg) {
-            return deg * this._radPerDeg;
-        }
-
-        private follow():void {
-            this._cartesianCoordinates.x = this.radius * Math.cos(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
-            this._cartesianCoordinates.y = this.radius * Math.sin(this._degToRad(this.beta));
-            this._cartesianCoordinates.z = this.radius * Math.sin(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
-
-            this.position = this.target.position.add(this._cartesianCoordinates);
-            this.setTarget(this.target.position);
-        }
-
-        public _checkInputs():void {
-            super._checkInputs();
-            this.follow();
-        }
-    }
-}

+ 32 - 2
src/Cameras/babylon.followCamera.ts

@@ -19,7 +19,7 @@
         private follow(cameraTarget:AbstractMesh) {
             if (!cameraTarget)
                 return;
-            
+
             var yRotation;
             if (cameraTarget.rotationQuaternion) {
                 var rotMatrix = new Matrix();
@@ -60,4 +60,34 @@
             this.follow(this.target);
         }
     }
-} 
+
+    export class ArcFollowCamera extends TargetCamera {
+
+        private _radPerDeg:number = Math.PI / 180;
+        private _cartesianCoordinates:Vector3 = Vector3.Zero();
+
+        constructor(name:string, public alpha:number, public beta:number, public radius:number, public target:AbstractMesh, scene:Scene) {
+            super(name, Vector3.Zero(), scene);
+            this.follow();
+        }
+
+        private _degToRad(deg) {
+            return deg * this._radPerDeg;
+        }
+
+        private follow():void {
+            this._cartesianCoordinates.x = this.radius * Math.cos(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
+            this._cartesianCoordinates.y = this.radius * Math.sin(this._degToRad(this.beta));
+            this._cartesianCoordinates.z = this.radius * Math.sin(this._degToRad(this.alpha)) * Math.cos(this._degToRad(this.beta));
+
+            this.position = this.target.position.add(this._cartesianCoordinates);
+            this.setTarget(this.target.position);
+        }
+
+        public _checkInputs():void {
+            super._checkInputs();
+            this.follow();
+        }
+    }
+}
+