فهرست منبع

Fixing cosmetic stuff (Thanks to Gwenaël Hagenmuller)

David Catuhe 11 سال پیش
والد
کامیت
b6762876ba
5فایلهای تغییر یافته به همراه56 افزوده شده و 17 حذف شده
  1. 15 13
      Babylon/Cameras/babylon.camera.js
  2. 21 0
      Babylon/Mesh/babylon.mesh.js
  3. 1 1
      Babylon/Tools/babylon.filesInput.js
  4. 2 2
      Babylon/babylon.node.js
  5. 17 1
      what's new.md

+ 15 - 13
Babylon/Cameras/babylon.camera.js

@@ -126,21 +126,23 @@ var BABYLON = BABYLON || {};
              && this._cache.minZ === this.minZ
              && this._cache.maxZ === this.maxZ;
 
+        if (!check) {
+            return false;
+        }
+
         var engine = this._scene.getEngine();
 
-        if (check) {
-            if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
-                check = this._cache.fov === this.fov
-                     && this._cache.aspectRatio === engine.getAspectRatio();
-            }
-            else {
-                check = this._cache.orthoLeft === this.orthoLeft
-                     && this._cache.orthoRight === this.orthoRight
-                     && this._cache.orthoBottom === this.orthoBottom
-                     && this._cache.orthoTop === this.orthoTop
-                     && this._cache.renderWidth === engine.getRenderWidth()
-                     && this._cache.renderHeight === engine.getRenderHeight();
-            }
+        if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
+            check = this._cache.fov === this.fov
+                 && this._cache.aspectRatio === engine.getAspectRatio();
+        }
+        else {
+            check = this._cache.orthoLeft === this.orthoLeft
+                 && this._cache.orthoRight === this.orthoRight
+                 && this._cache.orthoBottom === this.orthoBottom
+                 && this._cache.orthoTop === this.orthoTop
+                 && this._cache.renderWidth === engine.getRenderWidth()
+                 && this._cache.renderHeight === engine.getRenderHeight();
         }
 
         return check;

+ 21 - 0
Babylon/Mesh/babylon.mesh.js

@@ -532,6 +532,7 @@ var BABYLON = BABYLON || {};
     };
 
     // Geometry
+    // Deprecated: use setPositionWithLocalVector instead 
     BABYLON.Mesh.prototype.setLocalTranslation = function (vector3) {
         console.warn("deprecated: use setPositionWithLocalVector instead");
         this.computeWorldMatrix();
@@ -541,6 +542,7 @@ var BABYLON = BABYLON || {};
         this.position = BABYLON.Vector3.TransformCoordinates(vector3, worldMatrix);
     };
 
+    // Deprecated: use getPositionExpressedInLocalSpace instead 
     BABYLON.Mesh.prototype.getLocalTranslation = function () {
         console.warn("deprecated: use getPositionExpressedInLocalSpace instead");
         this.computeWorldMatrix();
@@ -600,6 +602,25 @@ var BABYLON = BABYLON || {};
         this.setVerticesData(temp, BABYLON.VertexBuffer.NormalKind, this._vertexBuffers[BABYLON.VertexBuffer.NormalKind].isUpdatable());
     };
 
+    BABYLON.Mesh.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor) {
+        /// <summary>Orients a mesh towards a target point. Mesh must be drawn facing user.</summary>
+        /// <param name="targetPoint" type="BABYLON.Vector3">The position (must be in same space as current mesh) to look at</param>
+        /// <param name="yawCor" type="Number">optional yaw (y-axis) correction in radians</param>
+        /// <param name="pitchCor" type="Number">optional pitch (x-axis) correction in radians</param>
+        /// <param name="rollCor" type="Number">optional roll (z-axis) correction in radians</param>
+        /// <returns>Mesh oriented towards targetMesh</returns>
+
+        yawCor = yawCor || 0; // default to zero if undefined 
+        pitchCor = pitchCor || 0;
+        rollCor = rollCor || 0;
+
+        var dv = targetPoint.subtract(this.position);
+        var yaw = -Math.atan2(dv.z, dv.x) - Math.PI / 2;
+        var len = Math.sqrt(dv.x * dv.x + dv.z * dv.z);
+        var pitch = Math.atan2(dv.y, len);
+        this.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(yaw + yawCor, pitch + pitchCor, rollCor);
+    };
+
     // Cache
     BABYLON.Mesh.prototype._resetPointsArrayCache = function () {
         this._positions = null;

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

@@ -12,7 +12,7 @@ var BABYLON = BABYLON || {};
         that = this;
         this.engine = p_engine;
         this.canvas = p_canvas;
-        this.originalScene = p_scene;
+        this.currentScene = p_scene;
         this.sceneLoadedCallback = p_sceneLoadedCallback;
         this.progressCallback = p_progressCallback;
         this.additionnalRenderLoopLogicCallback = p_additionnalRenderLoopLogicCallback;

+ 2 - 2
Babylon/babylon.node.js

@@ -61,9 +61,9 @@ var BABYLON = BABYLON || {};
     BABYLON.Node.prototype.isSynchronized = function (updateCache) {
         var check = this.hasNewParent();
 
-        check = check ? true : !this.isSynchronizedWithParent();
+        check = check || !this.isSynchronizedWithParent();
 
-        check = check ? true : !this._isSynchronized();
+        check = check || !this._isSynchronized();
 
         if (updateCache)
             this.updateCache(true);

+ 17 - 1
what's new.md

@@ -1,5 +1,21 @@
-Changes list
+Changes list
 ============
+- 1.8.5:
+ - **Major updates**
+ - Visual Studio 2013 templates for Windows 8.1 and nuget packages ([pierlag](http://www.github.com/pierlag))
+ - **Updates**
+ - New ```matrix.multiply``` function (up to 50% faster) ([deltakosh](http://www.github.com/deltakosh))
+ - New matrices cache system for camera (view and projection matrices) ([juliengobin](http://www.github.com/juliengobin))
+ - New physics impostor: compound and mesh (still really slow) ([deltakosh](http://www.github.com/deltakosh))
+ - Set crossOrigin flag for support CORS ([vbouzon](http://www.github.com/vbouzon))
+ - XNA importer: Changes for Right-Left Coordinate Systems & Prefixed Mesh Parts with Mesh Name ([professorF](http://www.github.com/professorF))
+ - Fixing getPivotMatrix ([gwenael-hagenmuller](http://www.github.com/gwenael-hagenmuller))
+ - New geometry functions: getLocalTranslation, setPositionWithLocalVector, getPositionExpressedInLocalSpace,locallyTranslate ([gwenael-hagenmuller](http://www.github.com/gwenael-hagenmuller))
+ - Adding multi mesh import from same file([nicolas-obre](http://www.github.com/nicolas-obre)) 
+ - **Bugfixes**
+ - Fixing issue when disposing a parent and not its children ([deltakosh](http://www.github.com/deltakosh))
+ - Fixing .obj importer ([deltakosh](http://www.github.com/deltakosh))
+ - Added guardband checks for impostors' size ([deltakosh](http://www.github.com/deltakosh))
 - 1.8.0:
  - **Major updates**
  - Support for [physics engine](http://www.babylonjs.com/index.html?PHYSICS) thanks to cannon.js ([deltakosh](http://www.github.com/deltakosh))