David Catuhe 10 years ago
parent
commit
bc973027da
4 changed files with 235 additions and 16 deletions
  1. 183 4
      babylon.1.14-RC-debug.js
  2. 8 8
      babylon.1.14-RC.js
  3. 9 3
      readme.md
  4. 35 1
      what's new.md

+ 183 - 4
babylon.1.14-RC-debug.js

@@ -293,6 +293,11 @@ var BABYLON;
             return new Vector2(this.x - otherVector.x, this.y - otherVector.y);
             return new Vector2(this.x - otherVector.x, this.y - otherVector.y);
         };
         };
 
 
+        Vector2.prototype.subtractInPlace = function (otherVector) {
+            this.x -= otherVector.x;
+            this.y -= otherVector.y;
+        };
+
         Vector2.prototype.multiplyInPlace = function (otherVector) {
         Vector2.prototype.multiplyInPlace = function (otherVector) {
             this.x *= otherVector.x;
             this.x *= otherVector.x;
             this.y *= otherVector.y;
             this.y *= otherVector.y;
@@ -352,7 +357,7 @@ var BABYLON;
             var len = this.length();
             var len = this.length();
 
 
             if (len === 0)
             if (len === 0)
-                return;
+                return this;
 
 
             var num = 1.0 / len;
             var num = 1.0 / len;
 
 
@@ -639,7 +644,7 @@ var BABYLON;
             var len = this.length();
             var len = this.length();
 
 
             if (len === 0)
             if (len === 0)
-                return;
+                return this;
 
 
             var num = 1.0 / len;
             var num = 1.0 / len;
 
 
@@ -9707,7 +9712,7 @@ var BABYLON;
 
 
             options.mass = options.mass || 0;
             options.mass = options.mass || 0;
             options.friction = options.friction || 0.2;
             options.friction = options.friction || 0.2;
-            options.restitution = options.restitution || 0.9;
+            options.restitution = options.restitution || 0.2;
 
 
             this._physicImpostor = impostor;
             this._physicImpostor = impostor;
             this._physicsMass = options.mass;
             this._physicsMass = options.mass;
@@ -16645,6 +16650,7 @@ var BABYLON;
                     var registeredMesh = this._registeredMeshes[index];
                     var registeredMesh = this._registeredMeshes[index];
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
                         var body = registeredMesh.body.body;
                         var body = registeredMesh.body.body;
+                        mesh.computeWorldMatrix(true);
 
 
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         body.setPosition(center.x, center.y, center.z);
                         body.setPosition(center.x, center.y, center.z);
@@ -17027,7 +17033,6 @@ var BABYLON;
         PhysicsEngine.SphereImpostor = 1;
         PhysicsEngine.SphereImpostor = 1;
         PhysicsEngine.BoxImpostor = 2;
         PhysicsEngine.BoxImpostor = 2;
         PhysicsEngine.PlaneImpostor = 3;
         PhysicsEngine.PlaneImpostor = 3;
-        PhysicsEngine.CompoundImpostor = 4;
         PhysicsEngine.MeshImpostor = 4;
         PhysicsEngine.MeshImpostor = 4;
         PhysicsEngine.CapsuleImpostor = 5;
         PhysicsEngine.CapsuleImpostor = 5;
         PhysicsEngine.ConeImpostor = 6;
         PhysicsEngine.ConeImpostor = 6;
@@ -20332,6 +20337,180 @@ var __extends = this.__extends || function (d, b) {
 };
 };
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    var OculusRiftDevKit2013_Metric = {
+        HResolution: 1280,
+        VResolution: 800,
+        HScreenSize: 0.149759993,
+        VScreenSize: 0.0935999975,
+        VScreenCenter: 0.0467999987,
+        EyeToScreenDistance: 0.0410000011,
+        LensSeparationDistance: 0.0635000020,
+        InterpupillaryDistance: 0.0640000030,
+        DistortionK: [1.0, 0.219999999, 0.239999995, 0.0],
+        ChromaAbCorrection: [0.995999992, -0.00400000019, 1.01400006, 0.0],
+        PostProcessScaleFactor: 1.714605507808412,
+        LensCenterOffset: 0.151976421
+    };
+
+    var _OculusInnerGamepadCamera = (function (_super) {
+        __extends(_OculusInnerGamepadCamera, _super);
+        function _OculusInnerGamepadCamera(name, position, scene, isLeftEye) {
+            _super.call(this, name, position, scene);
+            this._workMatrix = new BABYLON.Matrix();
+            this._actualUp = new BABYLON.Vector3(0, 0, 0);
+
+           
+            this._aspectRatioAspectRatio = OculusRiftDevKit2013_Metric.HResolution / (2 * OculusRiftDevKit2013_Metric.VResolution);
+            this._aspectRatioFov = (2 * Math.atan((OculusRiftDevKit2013_Metric.PostProcessScaleFactor * OculusRiftDevKit2013_Metric.VScreenSize) / (2 * OculusRiftDevKit2013_Metric.EyeToScreenDistance)));
+
+            var hMeters = (OculusRiftDevKit2013_Metric.HScreenSize / 4) - (OculusRiftDevKit2013_Metric.LensSeparationDistance / 2);
+            var h = (4 * hMeters) / OculusRiftDevKit2013_Metric.HScreenSize;
+
+            this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
+
+            this.viewport = new BABYLON.Viewport(isLeftEye ? 0 : 0.5, 0, 0.5, 1.0);
+
+            this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance : -.5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance, 0, 0);
+
+           
+            var postProcess = new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, OculusRiftDevKit2013_Metric);
+        }
+        _OculusInnerGamepadCamera.prototype.getProjectionMatrix = function () {
+            BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._workMatrix);
+            this._workMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
+            return this._projectionMatrix;
+        };
+
+        _OculusInnerGamepadCamera.prototype._getViewMatrix = function () {
+            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
+
+            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
+            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._actualUp);
+
+           
+            this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
+
+            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._actualUp, this._workMatrix);
+
+            this._workMatrix.multiplyToRef(this._preViewMatrix, this._viewMatrix);
+            return this._viewMatrix;
+        };
+        return _OculusInnerGamepadCamera;
+    })(BABYLON.FreeCamera);
+
+    var OculusGamepadCamera = (function (_super) {
+        __extends(OculusGamepadCamera, _super);
+        function OculusGamepadCamera(name, position, scene) {
+            var _this = this;
+            _super.call(this, name, position, scene);
+            this.angularSensibility = 200;
+            this.moveSensibility = 75;
+
+            this._leftCamera = new _OculusInnerGamepadCamera(name + "_left", position.clone(), scene, true);
+            this._rightCamera = new _OculusInnerGamepadCamera(name + "_right", position.clone(), scene, false);
+
+            this.subCameras.push(this._leftCamera);
+            this.subCameras.push(this._rightCamera);
+
+            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
+            this._gamepads = new BABYLON.Gamepads(function (gamepad) {
+                _this._onNewGameConnected(gamepad);
+            });
+        }
+        OculusGamepadCamera.prototype._onNewGameConnected = function (gamepad) {
+           
+            if (gamepad.index === 0) {
+                this._gamepad = gamepad;
+            }
+        };
+
+        OculusGamepadCamera.prototype._update = function () {
+            this._leftCamera.position.copyFrom(this.position);
+            this._rightCamera.position.copyFrom(this.position);
+
+            this._updateCamera(this._leftCamera);
+            this._updateCamera(this._rightCamera);
+
+            _super.prototype._update.call(this);
+        };
+
+        OculusGamepadCamera.prototype._checkInputs = function () {
+            if (!this._gamepad) {
+                return;
+            }
+
+            var LSValues = this._gamepad.leftStick;
+            var normalizedLX = LSValues.x / this.moveSensibility;
+            var normalizedLY = LSValues.y / this.moveSensibility;
+            LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
+            LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
+
+            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
+            var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x, 0, -LSValues.y), cameraTransform);
+            this.cameraDirection = this.cameraDirection.add(deltaTransform);
+        };
+
+        OculusGamepadCamera.prototype._updateCamera = function (camera) {
+            camera.minZ = this.minZ;
+            camera.maxZ = this.maxZ;
+
+            camera.rotation.x = this.rotation.x;
+            camera.rotation.y = this.rotation.y;
+            camera.rotation.z = this.rotation.z;
+        };
+
+       
+        OculusGamepadCamera.prototype._onOrientationEvent = function (evt) {
+            var yaw = evt.alpha / 180 * Math.PI;
+            var pitch = evt.beta / 180 * Math.PI;
+            var roll = evt.gamma / 180 * Math.PI;
+
+            if (!this._offsetOrientation) {
+                this._offsetOrientation = {
+                    yaw: yaw,
+                    pitch: pitch,
+                    roll: roll
+                };
+                return;
+            } else {
+                this.rotation.y += yaw - this._offsetOrientation.yaw;
+                this.rotation.x += pitch - this._offsetOrientation.pitch;
+                this.rotation.z += this._offsetOrientation.roll - roll;
+
+                this._offsetOrientation.yaw = yaw;
+                this._offsetOrientation.pitch = pitch;
+                this._offsetOrientation.roll = roll;
+            }
+        };
+
+        OculusGamepadCamera.prototype.attachControl = function (element, noPreventDefault) {
+            _super.prototype.attachControl.call(this, element, noPreventDefault);
+
+            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
+        };
+
+        OculusGamepadCamera.prototype.detachControl = function (element) {
+            _super.prototype.detachControl.call(this, element);
+
+            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
+        };
+
+        OculusGamepadCamera.prototype.dispose = function () {
+            this._gamepads.dispose();
+            _super.prototype.dispose.call(this);
+        };
+        return OculusGamepadCamera;
+    })(BABYLON.FreeCamera);
+    BABYLON.OculusGamepadCamera = OculusGamepadCamera;
+})(BABYLON || (BABYLON = {}));
+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 VirtualJoysticksCamera = (function (_super) {
     var VirtualJoysticksCamera = (function (_super) {
         __extends(VirtualJoysticksCamera, _super);
         __extends(VirtualJoysticksCamera, _super);

File diff suppressed because it is too large
+ 8 - 8
babylon.1.14-RC.js


+ 9 - 3
readme.md

@@ -28,7 +28,7 @@ Online [asset converter](http://www.babylonjs.com/converter.html) where you can
 ## Features
 ## Features
 - Complete scene graph with lights, cameras, materials and meshes
 - Complete scene graph with lights, cameras, materials and meshes
 - Collisions engine
 - Collisions engine
-- Physics engine (thanks to [cannon.js](http://github.com/schteppe/cannon.js))
+- Physics engine (thanks to [oimo.js](https://github.com/lo-th/Oimo.js))
 - Scene picking
 - Scene picking
 - Antialiasing
 - Antialiasing
 - Animations engine
 - Animations engine
@@ -39,8 +39,9 @@ Online [asset converter](http://www.babylonjs.com/converter.html) where you can
  - Sub-meshes clipping
  - Sub-meshes clipping
  - Hardware scaling
  - Hardware scaling
  - Selection octrees
  - Selection octrees
- - Offline mode (Assets are saved locally to prevent reloading them)
- - Incremental loading
+ - Offline mode via IndexedDB (Assets are saved locally to prevent reloading them)
+ - Incremental loading 
+ - Binary compressed format
  - Hardware accelerated instances
  - Hardware accelerated instances
 - Standard material is a per pixel material that supports:
 - Standard material is a per pixel material that supports:
  - Diffuse lightning and texture
  - Diffuse lightning and texture
@@ -52,6 +53,7 @@ Online [asset converter](http://www.babylonjs.com/converter.html) where you can
  - Emissive texture
  - Emissive texture
  - Specular texture
  - Specular texture
  - Bump texture
  - Bump texture
+ - Fresnel term for diffuse, opacity, emissive and reflection
  - Up to 4 lights (points, directionals, spots, hemispherics)
  - Up to 4 lights (points, directionals, spots, hemispherics)
  - Custom materials
  - Custom materials
  - Custom shaders
  - Custom shaders
@@ -82,6 +84,9 @@ Online [asset converter](http://www.babylonjs.com/converter.html) where you can
  - Virtual Joysticks camera
  - Virtual Joysticks camera
  - Oculus Rift camera
  - Oculus Rift camera
  - Gamepad camera
  - Gamepad camera
+ - VR Device Oriention camera
+ - WebVR camera
+ - Follow camera
 -  Meshes: 
 -  Meshes: 
  - Mesh cloning
  - Mesh cloning
  - Dynamic meshes
  - Dynamic meshes
@@ -92,6 +97,7 @@ Online [asset converter](http://www.babylonjs.com/converter.html) where you can
  - Exporter for Blender
  - Exporter for Blender
  - Exporter for Cheetah3d
  - Exporter for Cheetah3d
  - Exporter for 3ds Max
  - Exporter for 3ds Max
+ - Assets manager
 
 
 ## Apache License 2.0 (Apache)
 ## Apache License 2.0 (Apache)
 
 

+ 35 - 1
what's new.md

@@ -1,10 +1,44 @@
 Changes list
 Changes list
 ============
 ============
+- 1.14.0:
+ - **Major updates**
+ - New VRDeviceOrientionCamera for cardboard like systems ([demonixis](http://www.github.com/demonixis))
+ - New WebVRCamera for WebVR compatible systems ([demonixis](http://www.github.com/demonixis))
+ - All shaders now use high precision profile to address iOS8 compatibility ([deltakosh](http://www.github.com/deltakosh))
+ - New camera: ```BABYLON.FollowCamera``` used to smoothly follow a given target [abogartz](https://github.com/abogartz)
+ - New ```BABYLON.AssetsManager``` used to handle [assets loading](https://github.com/BabylonJS/Babylon.js/wiki/Using-AssetsManager) alongside loading screen display ([deltakosh](http://www.github.com/deltakosh))
+ - New ```Engine.displayLoadingUI()```, ```Engine.hideLoadingUI()```, ```Engine.loadingUiText```. See [more here](https://github.com/BabylonJS/Babylon.js/wiki/Using-AssetsManager) ([deltakosh](http://www.github.com/deltakosh))
+ - New cache engine (Based on state objects) ([deltakosh](http://www.github.com/deltakosh))
+ - Fresnel support for diffuse, emissive, opacity and reflection on ```StandardMaterial```. See [demo here](http://www.babylonjs.com/?FRESNEL) and [wiki here](https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-FresnelParameters%3F) ([deltakosh](http://www.github.com/deltakosh))
+ - TypeScript declaration file is now available ([deltakosh](http://www.github.com/deltakosh))
+ - Binary file format supported. You can use online converter [here](http://www.babylonjs.com/binary) ([r2d2Proton](https://github.com/r2d2Proton))
+ - **Updates**
+ - New ```mesh.updateVerticesDataDirectly(kind, float32array)``` to update mesh data directly ([deltakosh](http://www.github.com/deltakosh))
+ - Sandbox & IndexedDB layer are now supporting TGA & DDS textures  ([davrous](http://www.github.com/davrous))
+ - Integrating lights animations, cameras type and animations for Blender exporter ([Palmer-JC](http://www.github.com/Palmer-JC)) 
+ - New "Get zip" option for CYOS ([deltakosh](http://www.github.com/deltakosh))
+ - Add pinch and zoom for iOS and Android on ArcRotateCamera ([Eucly2](http://www.github.com/Eucly2))
+ - New ```camera.projectToScreen()``` function to transform a vector3 into a screen pixel ([deltakosh](http://www.github.com/deltakosh))
+ - New ```effect``` parameter to define custom shader for ```BABYLON.ParticleSystem``` constructor. See [demo here](http://www.babylonjs.com/?PARTICLES2) and [wiki here](https://github.com/BabylonJS/Babylon.js/wiki/12-Particles) ([deltakosh](http://www.github.com/deltakosh)) 
+ - Added toEulerAnglesToRef and CopyFromFloats to Quaternion ([Demonixis](https://github.com/demonixis))
+ - Added function to calculate the inverse of a quaternion ([Daner](https://github.com/daner))
+ - New ```StandardMaterial.useSpecularOverAlpha``` to define if you want specular to appear even on top of transparent surfaces ([deltakosh](http://www.github.com/deltakosh))
+ - New ```SceneLoader.Append``` function to append a babylon.js file to an existing scene ([Palmer-JC](https://github.com/Palmer-JC))
+ - New ```LinesMesh.alpha``` property ([deltakosh](http://www.github.com/deltakosh))
+ - Adding instances exportation support for 3DSMax exporter ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```Mesh.applyDisplacementMap``` and ```Mesh.applyDisplacementMapFromBuffer``` ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```Mesh.renderOutline``` property to render outlines around a mesh (used with ```Mesh.outlineColor``` and ```Mesh.outlineWidth```) ([deltakosh](http://www.github.com/deltakosh))
+ - New ```Light.includedOnlyMeshes``` array to define explicitely which mesh is affected by a light ([deltakosh](http://www.github.com/deltakosh))  
+ - Added multiply and divide functions to Vector2 ([daner](http://www.github.com/daner)) 
+ - New feature demo for [custom render target texture](http://www.babylonjs.com/?CUSTOMRENDERTARGET) ([deltakosh](http://www.github.com/deltakosh)) 
+ - RenderTargetTexture can now specify a camera to use ([deltakosh](http://www.github.com/deltakosh)) 
+ - **Updates**
+ - Fixing tons of bugs with PostProcessRenderPipeline. Wiki updated. ([deltakosh](http://www.github.com/deltakosh)) 
 - 1.13.0:
 - 1.13.0:
  - **Major updates**
  - **Major updates**
  - TypeScript port finished ([davrous](http://www.github.com/davrous) & [deltakosh](http://www.github.com/deltakosh)) 
  - TypeScript port finished ([davrous](http://www.github.com/davrous) & [deltakosh](http://www.github.com/deltakosh)) 
  - Physics engine: new OIMO plugin ([temechon](http://www.github.com/temechon))
  - Physics engine: new OIMO plugin ([temechon](http://www.github.com/temechon))
- - new demo: [V8 engine](http://www.babylonjs.com/index.html?V8)
+ - New demo: [V8 engine](http://www.babylonjs.com/index.html?V8) (Michel Rousseau)
  - **Updates**
  - **Updates**
  - Fixed ray creation when the devicePixelRatio is not equals to 1 ([demonixis](http://www.github.com/demonixis))
  - Fixed ray creation when the devicePixelRatio is not equals to 1 ([demonixis](http://www.github.com/demonixis))
  - New ```mesh.registerAfterRender``` and ```mesh.unregisterAfterRender``` functions ([deltakosh](http://www.github.com/deltakosh)) 
  - New ```mesh.registerAfterRender``` and ```mesh.unregisterAfterRender``` functions ([deltakosh](http://www.github.com/deltakosh))