Przeglądaj źródła

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

Conflicts:
	babylon.1.9.0.js
Deltakosh 11 lat temu
rodzic
commit
5f94370bef
24 zmienionych plików z 326 dodań i 291 usunięć
  1. 5 9
      Babylon/Cameras/Controllers/babylon.globalAxisFactorsFilter.js
  2. 4 8
      Babylon/Cameras/Controllers/babylon.gravityInputController.js
  3. 7 13
      Babylon/Cameras/Controllers/babylon.inputCollisionFilter.js
  4. 27 18
      Babylon/Cameras/Controllers/babylon.inputController.js
  5. 7 7
      Babylon/Cameras/Controllers/babylon.keyboardMoveController.js
  6. 2 2
      Babylon/Cameras/Controllers/babylon.oculusController.js
  7. 32 0
      Babylon/Cameras/babylon.arcRotateCamera.js
  8. 0 134
      Babylon/Cameras/babylon.oculusCamera.js
  9. 16 6
      Babylon/Cameras/babylon.oculusOrientedCamera.js
  10. 0 34
      Babylon/Collisions/babylon.collisionPlane.js
  11. 5 4
      Babylon/Materials/textures/babylon.cubeTexture.js
  12. 33 8
      Babylon/Math/babylon.math.js
  13. 30 6
      Babylon/Mesh/babylon.csg.js
  14. 26 0
      Babylon/Mesh/babylon.mesh.js
  15. 4 4
      Babylon/PostProcess/babylon.oculusDistortionCorrectionPostProcess.js
  16. 7 4
      Babylon/babylon.engine.js
  17. 4 2
      Tools/BuildOurOwnBabylonJS/BabylonJS/BabylonJS.csproj
  18. 16 21
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.sln
  19. 4 4
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/babylonJS.xml
  20. 5 3
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/BuildOurOwnBabylonJSServer.csproj
  21. 28 2
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/Controllers/OurDemoController.cs
  22. 15 0
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/ViewModel/OurDemoViewModel.cs
  23. 47 0
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/Views/OurDemo/sample.cshtml
  24. 2 2
      babylon.1.9.0.js

+ 5 - 9
Babylon/Cameras/Controllers/babylon.globalAxisFactorsFilter.js

@@ -3,26 +3,22 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-	BABYLON.globalAxisFactorsFilter = function (scene, target, xFactor, yFactor, zFactor) {
+	BABYLON.GlobalAxisFactorsFilter = function (scene, target, xFactor, yFactor, zFactor) {
 		BABYLON.inputFilter.call(this, scene,target);
 		this.xFactor = xFactor;
 		this.yFactor = yFactor;
 		this.zFactor = zFactor;
 
-		this._localToGlobalMatrix = new BABYLON.Matrix();
-		this._globalToLocalMatrix = new BABYLON.Matrix();
 		this._globalMovement = new BABYLON.Vector3(0, 0, 0);
 	};
-	BABYLON.globalAxisFactorsFilter.prototype = Object.create(BABYLON.inputFilter.prototype);
-	BABYLON.globalAxisFactorsFilter.prototype.moveRelative = function (relativeMovement) {
+	BABYLON.GlobalAxisFactorsFilter.prototype = Object.create(BABYLON.inputFilter.prototype);
+	BABYLON.GlobalAxisFactorsFilter.prototype.moveRelative = function (relativeMovement) {
 		var orientation = this.getOrientation();
-		BABYLON.Matrix.RotationYawPitchRollToRef(orientation.yaw, orientation.pitch, orientation.roll, this._localToGlobalMatrix);
-		this._localToGlobalMatrix.invertToRef(this._globalToLocalMatrix);
-		BABYLON.Vector3.TransformNormalToRef(relativeMovement, this._localToGlobalMatrix, this._globalMovement);
+		BABYLON.Vector3.TransformNormalToRef(relativeMovement, this.getOrientationMatrix(), this._globalMovement);
 		this._globalMovement.x *= this.xFactor;
 		this._globalMovement.y *= this.yFactor;
 		this._globalMovement.z *= this.zFactor;
-		BABYLON.Vector3.TransformNormalToRef(this._globalMovement, this._globalToLocalMatrix, relativeMovement);
+		BABYLON.Vector3.TransformNormalToRef(this._globalMovement, this.getInvertOrientationMatrix(), relativeMovement);
 		this.target.moveRelative(relativeMovement);
 	};
 })();

+ 4 - 8
Babylon/Cameras/Controllers/babylon.gravityInputController.js

@@ -4,21 +4,17 @@ var BABYLON = BABYLON || {};
 
 (function () {
     BABYLON.GravityInputController = function (scene, target) {
-        BABYLON.inputController.call(this, scene, target);
-        this._fallSpeed = 1; // 1 meters per second
+        BABYLON.InputController.call(this, scene, target);
         this._moveVectorGlobal = new BABYLON.Vector3(0, 0, 0);
         this._moveVectorLocal = new BABYLON.Vector3(0, 0, 0);
-        this._invertMatrix = new BABYLON.Matrix();
+        this._fallSpeed = .6;
     };
-    BABYLON.GravityInputController.prototype = Object.create(BABYLON.inputController.prototype);
+    BABYLON.GravityInputController.prototype = Object.create(BABYLON.InputController.prototype);
     BABYLON.GravityInputController.prototype.update = function () {
-        var orientation = this.target.getOrientation();
-        BABYLON.Matrix.RotationYawPitchRollToRef(orientation.yaw, orientation.pitch, orientation.roll, this._invertMatrix);
-        this._invertMatrix.invert();
         this._moveVectorGlobal.x = 0;
         this._moveVectorGlobal.y = -this._fallSpeed * BABYLON.Tools.GetDeltaTime() / 1000.0;
         this._moveVectorGlobal.z = 0;
-        BABYLON.Vector3.TransformNormalToRef(this._moveVectorGlobal,this._invertMatrix, this._moveVectorLocal);
+        BABYLON.Vector3.TransformNormalToRef(this._moveVectorGlobal, this.target.getInvertOrientationMatrix(), this._moveVectorLocal);
         this.target.moveRelative(this._moveVectorLocal);
     };
 })();

+ 7 - 13
Babylon/Cameras/Controllers/babylon.inputCollisionFilter.js

@@ -3,10 +3,8 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-	BABYLON.inputCollisionFilter = function (scene, target, ellipsoid) {
+	BABYLON.InputCollisionFilter = function (scene, target, ellipsoid) {
 		BABYLON.inputFilter.call(this, scene, target);
-		this._orientationMatrix = new BABYLON.Matrix();
-		this._orientationMatrixInvert = new BABYLON.Matrix();
 		this._transformedDirection = new BABYLON.Vector3();
 		this._tempNewPosition = new BABYLON.Vector3();
 		this._tempNewPosition2 = new BABYLON.Vector3();
@@ -16,11 +14,10 @@ var BABYLON = BABYLON || {};
 		this._cameraHeight = 1.7;
 		this._positionBottom = new BABYLON.Vector3(0, 0, 0);
 	};
-	BABYLON.inputCollisionFilter.prototype = Object.create(BABYLON.inputFilter.prototype);
-	BABYLON.inputCollisionFilter.prototype.moveRelative = function (relativeMovement) {
+	BABYLON.InputCollisionFilter.prototype = Object.create(BABYLON.inputFilter.prototype);
+	BABYLON.InputCollisionFilter.prototype.moveRelative = function (relativeMovement) {
 		var rotation = this.getOrientation();
-		BABYLON.Matrix.RotationYawPitchRollToRef(rotation.yaw, rotation.pitch, rotation.roll, this._orientationMatrix);
-		BABYLON.Vector3.TransformNormalToRef(relativeMovement, this._orientationMatrix, this._transformedDirection);
+		BABYLON.Vector3.TransformNormalToRef(relativeMovement, this.getOrientationMatrix(), this._transformedDirection);
 		this.getPosition().addToRef(this._transformedDirection, this._tempNewPosition);
 		//this._tempNewPosition.y -= this._ellipsoid.y;
 		this._collider.radius = this._ellipsoid;
@@ -34,14 +31,11 @@ var BABYLON = BABYLON || {};
 
 
 		this._collidedPosition.subtractToRef(this._positionBottom, this._tempNewPosition2);
+		if (this._tempNewPosition2.length() > BABYLON.Engine.collisionsEpsilon * 5) {
 
-		if (this._tempNewPosition2.length() > BABYLON.Engine.collisionsEpsilon) {
-
-		    this._orientationMatrix.invertToRef(this._orientationMatrixInvert);
-		    BABYLON.Vector3.TransformNormalToRef(this._tempNewPosition2, this._orientationMatrixInvert, this._tempNewPosition);
-
+		    BABYLON.Vector3.TransformNormalToRef(this._tempNewPosition2, this.getInvertOrientationMatrix(), this._tempNewPosition);
 		    this.target.moveRelative(this._tempNewPosition);
-		}
+		} 
 
 	};
 })();

+ 27 - 18
Babylon/Cameras/Controllers/babylon.inputController.js

@@ -4,26 +4,28 @@ var BABYLON = BABYLON || {};
 
 (function () {
 
-	BABYLON.inputControllerTarget = function () {
+	BABYLON.InputControllerTarget = function () {
 		this._position = new BABYLON.Vector3(0, 0, 0);
 		this._orientation = { yaw: 0.0, pitch: 0.0, roll: 0.0 };
 	};
 
-	BABYLON.inputControllerTarget.prototype.getPosition = function () {
+	BABYLON.InputControllerTarget.prototype.getPosition = function () {
 		return this._position;
 	};
-	BABYLON.inputControllerTarget.prototype.getOrientation = function () {
+	BABYLON.InputControllerTarget.prototype.getOrientation = function () {
 		return this._orientation;
 	};
-	BABYLON.inputControllerTarget.prototype.moveRelative = function (movementVector) {
+	BABYLON.InputControllerTarget.prototype.moveRelative = function (movementVector) {
 
 	};
 	
-	BABYLON.inputControllerTarget.prototype.rotateRelative = function (relativeOrientation) {
+	BABYLON.InputControllerTarget.prototype.rotateRelative = function (relativeOrientation) {
 
 	};
+	BABYLON.InputControllerTarget.prototype.getOrientationMatrix = function () { return new BABYLON.Matrix(); };
+	BABYLON.InputControllerTarget.prototype.getInvertOrientationMatrix = function () { return new BABYLON.Matrix(); };
 
-	BABYLON.inputControllerMultiTarget = function (targets) {
+	BABYLON.InputControllerMultiTarget = function (targets) {
 	    this.targets = targets;
 	    var mainTarget = this.targets[0];
 	    if (!mainTarget.controllers) {
@@ -33,25 +35,30 @@ var BABYLON = BABYLON || {};
 	    }
 	};
 
-	BABYLON.inputControllerMultiTarget.prototype.getPosition = function () {
+	BABYLON.InputControllerMultiTarget.prototype.getPosition = function () {
 		return this.targets[0].getPosition();
 	};
-	BABYLON.inputControllerMultiTarget.prototype.getOrientation = function () {
+	BABYLON.InputControllerMultiTarget.prototype.getOrientation = function () {
 		return this.targets[0].getOrientation();
 	};
-	BABYLON.inputControllerMultiTarget.prototype.moveRelative = function (movementVector) {
+
+
+	BABYLON.InputControllerMultiTarget.prototype.getOrientationMatrix = function () { return this.targets[0].getOrientationMatrix(); };
+	BABYLON.InputControllerMultiTarget.prototype.getInvertOrientationMatrix = function () { return this.targets[0].getInvertOrientationMatrix(); };
+
+	BABYLON.InputControllerMultiTarget.prototype.moveRelative = function (movementVector) {
 		for (var i = 0; i < this.targets.length; ++i) {
 			this.targets[i].moveRelative(movementVector);
 		}
 	};
 
-	BABYLON.inputControllerMultiTarget.prototype.rotateRelative = function (relativeOrientation) {
+	BABYLON.InputControllerMultiTarget.prototype.rotateRelative = function (relativeOrientation) {
 		for (var i = 0; i < this.targets.length; ++i) {
 			this.targets[i].rotateRelative(relativeOrientation);
 		}
 	};
 
-	BABYLON.inputControllerMultiTarget.prototype.update = function () {
+	BABYLON.InputControllerMultiTarget.prototype.update = function () {
 		if (this.controllers) {
 			for (var i = 0; i < this.controllers.length; ++i) {
 				this.controllers[i].update();
@@ -59,7 +66,7 @@ var BABYLON = BABYLON || {};
 		}
 	};
 	
-	BABYLON.inputController = function (scene, target) {
+	BABYLON.InputController = function (scene, target) {
 		this.scene = scene;
 		this.target = target;
 		if (!this.target.controllers) {
@@ -68,24 +75,24 @@ var BABYLON = BABYLON || {};
 			this.target.controllers.push(this);
 		}
 	};
-	BABYLON.inputController.prototype.attachToCanvas = function (canvas) {
+	BABYLON.InputController.prototype.attachToCanvas = function (canvas) {
 
 	};
-	BABYLON.inputController.prototype.detachFromCanvas = function (canvas) {
+	BABYLON.InputController.prototype.detachFromCanvas = function (canvas) {
 
 	};
-	BABYLON.inputController.prototype.update = function () {
+	BABYLON.InputController.prototype.update = function () {
 
 	};
 
-	BABYLON.inputController.prototype.dispose = function () {
+	BABYLON.InputController.prototype.dispose = function () {
 
 	};
 
 	BABYLON.inputFilter = function (scene, target) {
-	    BABYLON.inputController.call(this, scene, target);
+	    BABYLON.InputController.call(this, scene, target);
 	};
-	BABYLON.inputFilter.prototype = Object.create(BABYLON.inputController.prototype);
+	BABYLON.inputFilter.prototype = Object.create(BABYLON.InputController.prototype);
 	BABYLON.inputFilter.prototype.update = function () {
 	    if (this.controllers) {
 	        for (var i = 0; i < this.controllers.length; ++i) {
@@ -100,6 +107,8 @@ var BABYLON = BABYLON || {};
 	BABYLON.inputFilter.prototype.getOrientation = function () {
 	    return this.target.getOrientation();
 	};
+	BABYLON.inputFilter.prototype.getOrientationMatrix = function () { return this.target.getOrientationMatrix(); };
+	BABYLON.inputFilter.prototype.getInvertOrientationMatrix = function () { return this.target.getInvertOrientationMatrix(); };
 	BABYLON.inputFilter.prototype.moveRelative = function (movementVector) {
 	    this.target.moveRelative(movementVector);
 	};

+ 7 - 7
Babylon/Cameras/Controllers/babylon.keyboardMoveController.js

@@ -3,8 +3,8 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-	BABYLON.keyboardMoveController = function (scene, target) {
-		BABYLON.inputController.call(this, scene, target);
+	BABYLON.KeyboardMoveController = function (scene, target) {
+		BABYLON.InputController.call(this, scene, target);
 		this._keys = [];
 		this.keysUp = [38];
 		this.keysDown = [40];
@@ -19,8 +19,8 @@ var BABYLON = BABYLON || {};
 		this.maxAbsoluteAcceleration = 5; // 2 meters per second²
 		this._targetSpeed = new BABYLON.Vector3(0, 0, 0);
 	};
-	BABYLON.keyboardMoveController.prototype = Object.create(BABYLON.inputController.prototype);
-	BABYLON.keyboardMoveController.prototype.attachToCanvas = function (canvas) {
+	BABYLON.KeyboardMoveController.prototype = Object.create(BABYLON.InputController.prototype);
+	BABYLON.KeyboardMoveController.prototype.attachToCanvas = function (canvas) {
 		var that = this;
 		this._canvas = canvas;
 
@@ -58,12 +58,12 @@ var BABYLON = BABYLON || {};
 		window.addEventListener("keyup", this._onKeyUp, false);
 		window.addEventListener("blur", this._onLostFocus, false);
 	};
-	BABYLON.keyboardMoveController.prototype.detachFromCanvas = function (canvas) {
+	BABYLON.KeyboardMoveController.prototype.detachFromCanvas = function (canvas) {
 		window.removeEventListener("keydown", this._onKeyDown, false);
 		window.removeEventListener("keyup", this._onKeyUp, false);
 		window.removeEventListener("blur", this._onLostFocus, false);
 	};
-	BABYLON.keyboardMoveController.prototype.updateCurrentSpeed = function () {
+	BABYLON.KeyboardMoveController.prototype.updateCurrentSpeed = function () {
 		this._lastFrameSpeed.x = this._currentSpeed.x;
 		this._lastFrameSpeed.y = this._currentSpeed.y;
 		this._lastFrameSpeed.z = this._currentSpeed.z;
@@ -92,7 +92,7 @@ var BABYLON = BABYLON || {};
 			this._currentSpeed.addInPlace(dv);
 		}
 	};
-	BABYLON.keyboardMoveController.prototype.update = function () {
+	BABYLON.KeyboardMoveController.prototype.update = function () {
 		this._targetSpeed.x = 0;
 		this._targetSpeed.y = 0;
 		this._targetSpeed.z = 0;

+ 2 - 2
Babylon/Cameras/Controllers/babylon.oculusController.js

@@ -4,14 +4,14 @@ var BABYLON = BABYLON || {};
 
 (function () {
     BABYLON.OculusController = function (scene, target) {
-        BABYLON.inputController.call(this, scene, target);
+        BABYLON.InputController.call(this, scene, target);
         this._deviceOrientationHandler = this.onOrientationEvent.bind(this);
         this._tempOrientation = { yaw: 0.0, pitch: 0.0, roll: 0.0 };
         this._relativeOrientation = { yaw: 0.0, pitch: 0.0, roll: 0.0 };
         window.addEventListener("deviceorientation", this._deviceOrientationHandler);
     };
 
-    BABYLON.OculusController.prototype = Object.create(BABYLON.inputController.prototype);
+    BABYLON.OculusController.prototype = Object.create(BABYLON.InputController.prototype);
 
     BABYLON.OculusController.prototype.onOrientationEvent = function (ev) {
         this._tempOrientation.yaw = ev.alpha / 180 * Math.PI;

+ 32 - 0
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -371,5 +371,37 @@ var BABYLON = BABYLON || {};
 
         return this._viewMatrix;
     };
+
+    BABYLON.ArcRotateCamera.ZOOM_ON_FACTOR = 1;
+    BABYLON.ArcRotateCamera.prototype.zoomOn = function (meshes) {
+        meshes = meshes || this._scene.meshes;
+
+        var minMaxVector = BABYLON.Mesh.MinMax(meshes);
+        var distance = BABYLON.Vector3.Distance(minMaxVector.min, minMaxVector.max);
+
+        this.radius = distance * BABYLON.ArcRotateCamera.ZOOM_ON_FACTOR;
+
+        this.focusOn({min: minMaxVector.min, max: minMaxVector.max, distance: distance});
+    };
+
+    BABYLON.ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance) {
+        var meshesOrMinMaxVector;
+        var distance;
+
+        if (meshesOrMinMaxVectorAndDistance.min === undefined) { // meshes
+            meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance || this._scene.meshes;
+            meshesOrMinMaxVector = BABYLON.Mesh.MinMax(meshesOrMinMaxVector);
+            distance = BABYLON.Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);
+        }
+        else { //minMaxVector and distance
+            meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance;
+            distance = meshesOrMinMaxVectorAndDistance.distance;
+        }
+        
+        this.target = BABYLON.Mesh.Center(meshesOrMinMaxVector);
+        
+        this.maxZ = distance * 2;
+    };
+
 })();
 

+ 0 - 134
Babylon/Cameras/babylon.oculusCamera.js

@@ -1,134 +0,0 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.OculusController = function () {
-        this._currentOrientation = { yaw: 0, pitch: 0, roll: 0 };
-        this._deviceOrientationHandler = this.onOrientationEvent.bind(this);
-        window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-    };
-
-    BABYLON.OculusController.prototype.onOrientationEvent = function (ev) {
-        var yaw = ev.alpha / 180 * Math.PI;
-        if(!this._referenceYaw){
-            this._referenceYaw= yaw;
-        }
-        this._currentOrientation.yaw = yaw - this._referenceYaw;
-        this._currentOrientation.pitch = ev.beta / 180 * Math.PI;
-        this._currentOrientation.roll = ev.gamma / 180 * Math.PI;
-    };
-    BABYLON.OculusController.prototype.dispose = function () {
-        window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-    };
-
-    BABYLON.OculusController.prototype.getCurrentOrientation = function () {
-        return this._currentOrientation;
-    };
-
-    BABYLON.OculusController.CameraSettings_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
-    };
-
-    BABYLON.OculusOrientedCamera = function (name, position, scene, controller, isLeftEye, ovrSettings, neutralOrientation) {
-        BABYLON.Camera.call(this, name, position, scene);
-        this._controller = controller;
-        this._referenceDirection = new BABYLON.Vector3(0, 0, 1);
-        this._referenceUp = new BABYLON.Vector3(0, 1, 0);
-        this._actualDirection = new BABYLON.Vector3(1, 0, 0);
-        this._actualUp = new BABYLON.Vector3(0, 1, 0);
-        this._currentTargetPoint = new BABYLON.Vector3(0, 0, 0);
-        this._currentOculusOrientation = { yaw: 0.0, pitch: 0.0, roll: 0.0 };
-        this._currentViewMatrix = new BABYLON.Matrix();
-        this._currentOculusOrientationMatrix = new BABYLON.Matrix();
-        this._tempMatrix = new BABYLON.Matrix();
-        neutralOrientation = neutralOrientation || { yaw: 0.0, pitch: 0.0, roll: 0.0 };
-        this._neutralOrientation = neutralOrientation;
-        if (isLeftEye) {
-            this.viewport = new BABYLON.Viewport(0, 0, 0.5, 1.0);
-        } else {
-            this.viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
-        }
-
-        this._aspectRatioAspectRatio = ovrSettings.HResolution / (2 * ovrSettings.VResolution);
-        this._aspectRatioFov = (2 * Math.atan((ovrSettings.PostProcessScaleFactor * ovrSettings.VScreenSize) / (2 * ovrSettings.EyeToScreenDistance))) ;
-        var hMeters = (ovrSettings.HScreenSize / 4) - (ovrSettings.LensSeparationDistance / 2);
-        var h = (4 * hMeters) / ovrSettings.HScreenSize;
-        this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
-
-        this._projectionMatrix = new BABYLON.Matrix();
-        this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * ovrSettings.InterpupillaryDistance : -.5 * ovrSettings.InterpupillaryDistance, 0, 0);
-        new BABYLON.oculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, ovrSettings);
-    };
-    BABYLON.OculusOrientedCamera.buildOculusStereoCamera = function (scene, name, canvas, minZ, maxZ, position, neutralOrientation, useFXAA, controller, ovrSettings) {
-        position = position || new BABYLON.Vector2(0, 0);
-        neutralOrientation = neutralOrientation || { yaw: 0.0, pitch: 0.0, roll: 0.0 };
-        controller = controller || new BABYLON.OculusController();
-        ovrSettings = ovrSettings || BABYLON.OculusController.CameraSettings_OculusRiftDevKit2013_Metric;
-
-        var leftCamera = new BABYLON.OculusOrientedCamera(name + "_left", position, scene, controller, true, ovrSettings, neutralOrientation);
-        leftCamera.minZ = minZ;
-        leftCamera.maxZ = maxZ;
-        if (useFXAA) {
-            new BABYLON.FxaaPostProcess("fxaa_left", 1.0, leftCamera);
-        }
-
-        var rightCamera = new BABYLON.OculusOrientedCamera(name + "_right", position, scene, controller, false, ovrSettings, neutralOrientation);
-        rightCamera.minZ = minZ;
-        rightCamera.maxZ = maxZ;
-        if (useFXAA) {
-            new BABYLON.FxaaPostProcess("fxaa_right", 1.0, rightCamera);
-        }
-        scene.activeCameras = [];
-        scene.activeCameras.push(leftCamera);
-        scene.activeCameras.push(rightCamera);
-        leftCamera.attachControl(canvas);
-        rightCamera.attachControl(canvas);
-    };
-    BABYLON.OculusOrientedCamera.prototype = Object.create(BABYLON.Camera.prototype);
-
-    BABYLON.OculusOrientedCamera.prototype.getViewMatrix = function () {
-
-        BABYLON.Matrix.RotationYawPitchRollToRef(
-            this._currentOculusOrientation.yaw + this._neutralOrientation.yaw,
-            this._currentOculusOrientation.pitch + this._neutralOrientation.pitch,
-            -this._currentOculusOrientation.roll + this._neutralOrientation.roll
-            , this._currentOculusOrientationMatrix);
-
-        BABYLON.Vector3.TransformCoordinatesToRef(this._referenceDirection, this._currentOculusOrientationMatrix, this._actualDirection);
-        BABYLON.Vector3.TransformCoordinatesToRef(this._referenceUp, this._currentOculusOrientationMatrix, this._actualUp);
-        
-        BABYLON.Vector3.FromFloatsToRef(this.position.x + this._actualDirection.x, this.position.y + this._actualDirection.y, this.position.z + this._actualDirection.z, this._currentTargetPoint);
-        BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTargetPoint, this._actualUp, this._tempMatrix);
-        this._tempMatrix.multiplyToRef(this._preViewMatrix, this._currentViewMatrix);
-        return this._currentViewMatrix;
-    };
-
-    BABYLON.OculusOrientedCamera.prototype._update = function () {
-        if (!this._referenceOculusOrientation) {
-            this._referenceOculusOrientation = { yaw: this._controller._currentOrientation.yaw, pitch: this._controller._currentOrientation.pitch, roll: this._controller._currentOrientation.roll };
-        }
-        else {
-            this._currentOculusOrientation.yaw = this._controller._currentOrientation.yaw - this._referenceOculusOrientation.yaw;
-            this._currentOculusOrientation.pitch = this._controller._currentOrientation.pitch - this._referenceOculusOrientation.pitch;
-            this._currentOculusOrientation.roll = this._controller._currentOrientation.roll - this._referenceOculusOrientation.roll;
-        }
-    };
-
-    BABYLON.OculusOrientedCamera.prototype.getProjectionMatrix = function (force) {
-        BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._tempMatrix);
-        this._tempMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
-        return this._projectionMatrix;
-    };
-})();

+ 16 - 6
Babylon/Cameras/babylon.oculusOrientedCamera.js

@@ -13,6 +13,7 @@ var BABYLON = BABYLON || {};
         this._currentOrientation = Object.create(neutralOrientation || { yaw: 0.0, pitch: 0.0, roll: 0.0 });
         this._currentViewMatrix = new BABYLON.Matrix();
         this._currentOrientationMatrix = new BABYLON.Matrix();
+        this._currentInvertOrientationMatrix = new BABYLON.Matrix();
         this._tempMatrix = new BABYLON.Matrix();
         
         if (isLeftEye) {
@@ -29,7 +30,7 @@ var BABYLON = BABYLON || {};
 
         this._projectionMatrix = new BABYLON.Matrix();
         this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * ovrSettings.InterpupillaryDistance : -.5 * ovrSettings.InterpupillaryDistance, 0, 0);
-        new BABYLON.oculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, ovrSettings);
+        new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, ovrSettings);
         this.resetProjectionMatrix();
         this.resetViewMatrix();
     };
@@ -58,20 +59,20 @@ var BABYLON = BABYLON || {};
         scene.activeCameras.push(rightCamera);
         leftCamera.attachControl(canvas);
         rightCamera.attachControl(canvas);
-        var multiTarget = new BABYLON.inputControllerMultiTarget([leftCamera, rightCamera]);
+        var multiTarget = new BABYLON.InputControllerMultiTarget([leftCamera, rightCamera]);
         var controller = new BABYLON.OculusController(scene, multiTarget);
         var moveTarget = multiTarget;
         if (!disableCollisions) {
-            var collisionFilter = new BABYLON.inputCollisionFilter(scene, multiTarget);
+            var collisionFilter = new BABYLON.InputCollisionFilter(scene, multiTarget);
             moveTarget = collisionFilter;
         }
         if (!disableGravity) {
 
-            var globalAxisFactorFilter = new BABYLON.globalAxisFactorsFilter(scene, moveTarget, 1, 0, 1);
+            var globalAxisFactorFilter = new BABYLON.GlobalAxisFactorsFilter(scene, moveTarget, 1, 0, 1);
             var gravityController = new BABYLON.GravityInputController(scene, moveTarget);
             moveTarget = globalAxisFactorFilter;
         }
-        var moveController = new BABYLON.keyboardMoveController(scene, moveTarget);
+        var moveController = new BABYLON.KeyboardMoveController(scene, moveTarget);
         moveController.attachToCanvas(canvas);
         var result = {
             leftCamera: leftCamera, rightCamera: rightCamera, intermediateControllerTarget: multiTarget,
@@ -98,6 +99,7 @@ var BABYLON = BABYLON || {};
             this._currentOrientation.pitch,
             -this._currentOrientation.roll
             , this._currentOrientationMatrix);
+        this._currentOrientationMatrix.invertToRef(this._currentInvertOrientationMatrix);
 
         BABYLON.Vector3.TransformNormalToRef(this._referenceDirection, this._currentOrientationMatrix, this._actualDirection);
         BABYLON.Vector3.TransformNormalToRef(this._referenceUp, this._currentOrientationMatrix, this._actualUp);
@@ -120,6 +122,14 @@ var BABYLON = BABYLON || {};
         }
     };
 
+    BABYLON.OculusOrientedCamera.prototype.getOrientationMatrix = function () {
+        return this._currentOrientationMatrix;
+    };
+
+    BABYLON.OculusOrientedCamera.prototype.getInvertOrientationMatrix = function () {
+        return this._currentInvertOrientationMatrix;
+    };
+
     BABYLON.OculusOrientedCamera.prototype.resetProjectionMatrix = function () {
         BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._tempMatrix);
         this._tempMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
@@ -130,7 +140,7 @@ var BABYLON = BABYLON || {};
         return this._projectionMatrix;
     };
 
-    // implementation of inputControllerTarget
+    // implementation of InputControllerTarget
     BABYLON.OculusOrientedCamera.prototype.getOrientation = function () {
         return this._currentOrientation;
     };

+ 0 - 34
Babylon/Collisions/babylon.collisionPlane.js

@@ -1,34 +0,0 @@
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.CollisionPlane = function (origin, normal) {
-        this.normal = normal;
-        this.origin = origin;
-
-        normal.normalize();
-
-        this.equation = [];
-        this.equation[0] = normal.x;
-        this.equation[1] = normal.y;
-        this.equation[2] = normal.z;
-        this.equation[3] = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);
-    };
-
-    // Methods
-    BABYLON.CollisionPlane.prototype.isFrontFacingTo = function (direction, epsilon) {
-        var dot = BABYLON.Vector3.Dot(this.normal, direction);
-
-        return (dot <= epsilon);
-    };
-
-    BABYLON.CollisionPlane.prototype.signedDistanceTo = function (point) {
-        return BABYLON.Vector3.Dot(point, this.normal) + this.equation[3];
-    };
-
-    // Statics
-    BABYLON.CollisionPlane.CreateFromPoints = function (p1, p2, p3) {
-        var normal = BABYLON.Vector3.Cross(p2.subtract(p1), p3.subtract(p1));
-
-        return new BABYLON.CollisionPlane(p1, normal);
-    };
-})();

+ 5 - 4
Babylon/Materials/textures/babylon.cubeTexture.js

@@ -3,16 +3,17 @@
 var BABYLON = BABYLON || {};
 
 (function () {    
-    BABYLON.CubeTexture = function (rootUrl, scene, extensions) {
+    BABYLON.CubeTexture = function (rootUrl, scene, extensions, noMipmap) {
         this._scene = scene;
         this._scene.textures.push(this);
         
         this.name = rootUrl;
         this.url = rootUrl;
+        this._noMipmap = noMipmap;
         this.hasAlpha = false;
         this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
 
-        this._texture = this._getFromCache(rootUrl);
+        this._texture = this._getFromCache(rootUrl, noMipmap);
 
         if (!extensions) {
             extensions = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"];
@@ -22,7 +23,7 @@ var BABYLON = BABYLON || {};
         
         if (!this._texture) {
             if (!scene.useDelayedTextureLoading) {
-                this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, extensions);
+                this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, extensions, noMipmap);
             } else {
                 this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
             }            
@@ -42,7 +43,7 @@ var BABYLON = BABYLON || {};
         }
 
         this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-        this._texture = this._getFromCache(this.url);
+        this._texture = this._getFromCache(this.url, this._noMipmap);
 
         if (!this._texture) {
             this._texture = this._scene.getEngine().createCubeTexture(this.url, this._scene, this._extensions);

+ 33 - 8
Babylon/Math/babylon.math.js

@@ -247,6 +247,10 @@ var BABYLON = BABYLON || {};
     BABYLON.Color3.FromArray = function (array) {
         return new BABYLON.Color3(array[0], array[1], array[2]);
     };
+    
+    BABYLON.Color3.FromInts = function (r, g, b) {
+        return new BABYLON.Color3(r / 255.0, g / 255.0, b / 255.0);
+    };
 
     ////////////////////////////////// Color4 //////////////////////////////////
 
@@ -340,6 +344,11 @@ var BABYLON = BABYLON || {};
 
         return new BABYLON.Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);
     };
+    
+    BABYLON.Color4.FromInts = function (r, g, b, a) {
+        return new BABYLON.Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
+    };
+
 
     ////////////////////////////////// Vector2 //////////////////////////////////
 
@@ -647,6 +656,18 @@ var BABYLON = BABYLON || {};
         result.z = this.z / otherVector.z;
     };
 
+    BABYLON.Vector3.prototype.MinimizeInPlace = function (other) {
+        if (other.x < this.x) this.x = other.x;
+        if (other.y < this.y) this.y = other.y;
+        if (other.z < this.z) this.z = other.z;
+    };
+
+    BABYLON.Vector3.prototype.MaximizeInPlace = function (other) {
+        if (other.x > this.x) this.x = other.x;
+        if (other.y > this.y) this.y = other.y;
+        if (other.z > this.z) this.z = other.z;
+    };
+
     // Properties
     BABYLON.Vector3.prototype.length = function () {
         return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
@@ -889,17 +910,15 @@ var BABYLON = BABYLON || {};
     };
 
     BABYLON.Vector3.Minimize = function (left, right) {
-        var x = (left.x < right.x) ? left.x : right.x;
-        var y = (left.y < right.y) ? left.y : right.y;
-        var z = (left.z < right.z) ? left.z : right.z;
-        return new BABYLON.Vector3(x, y, z);
+        var min = left.clone();
+        min.MinimizeInPlace(right);
+        return min;
     };
 
     BABYLON.Vector3.Maximize = function (left, right) {
-        var x = (left.x > right.x) ? left.x : right.x;
-        var y = (left.y > right.y) ? left.y : right.y;
-        var z = (left.z > right.z) ? left.z : right.z;
-        return new BABYLON.Vector3(x, y, z);
+        var max = left.clone();
+        max.MaximizeInPlace(right);
+        return max;
     };
 
     BABYLON.Vector3.Distance = function (value1, value2) {
@@ -914,6 +933,12 @@ var BABYLON = BABYLON || {};
         return (x * x) + (y * y) + (z * z);
     };
 
+    BABYLON.Vector3.Center = function (value1, value2) {
+        var center = value1.add(value2);
+        center.scaleInPlace(0.5);
+        return center;
+    };
+
     ////////////////////////////////// Quaternion //////////////////////////////////
 
     BABYLON.Quaternion = function (initialX, initialY, initialZ, initialW) {

+ 30 - 6
Babylon/Mesh/babylon.csg.js

@@ -15,7 +15,10 @@ var BABYLON = BABYLON || {};
 
     // Convert BABYLON.Mesh to BABYLON.CSG
     BABYLON.CSG.FromMesh = function (mesh) {
-        var vertex, normal, uv, position, polygon, polygons = [], vertices;
+        var vertex, normal, uv, position,
+            polygon,
+            polygons = [],
+            vertices;
 
         if (mesh instanceof BABYLON.Mesh) {
             mesh.computeWorldMatrix(true);
@@ -49,7 +52,11 @@ var BABYLON = BABYLON || {};
                 }
 
                 polygon = new BABYLON.CSG.Polygon(vertices, { subMeshId: sm, meshId: _currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex });
-                polygons.push(polygon);
+
+                // To handle the case of degenerated triangle
+                // polygon.plane == null <=> the polygon does not represent 1 single plane <=> the triangle is degenerated
+                if (polygon.plane)
+                    polygons.push(polygon);
             }
         }
 
@@ -333,6 +340,10 @@ var BABYLON = BABYLON || {};
             return Math.sqrt(this.dot(this));
         },
 
+        lengthSq: function () {
+            return this.dot(this);
+        },
+
         unit: function () {
             return this.dividedBy(this.length());
         },
@@ -400,6 +411,13 @@ var BABYLON = BABYLON || {};
     BABYLON.CSG.Plane.EPSILON = 1e-5;
 
     BABYLON.CSG.Plane.fromPoints = function (a, b, c) {
+        var v0 = c.minus(a);
+        var v1 = b.minus(a);
+
+        if (v0.lengthSq() === 0 || v1.lengthSq() === 0) {
+            return null;
+        }
+
         var n = c.minus(a).cross(b.minus(a)).unit();
         return new BABYLON.CSG.Plane(n, n.dot(a));
     };
@@ -484,6 +502,7 @@ var BABYLON = BABYLON || {};
         this.vertices = vertices;
         this.shared = shared;
         this.plane = BABYLON.CSG.Plane.fromPoints(vertices[0].pos, vertices[1].pos, vertices[2].pos);
+
     };
 
     BABYLON.CSG.Polygon.prototype = {
@@ -530,8 +549,12 @@ var BABYLON = BABYLON || {};
                 this.polygons[i].flip();
             }
             this.plane.flip();
-            if (this.front) this.front.invert();
-            if (this.back) this.back.invert();
+            if (this.front) {
+                this.front.invert();
+            }
+            if (this.back) {
+                this.back.invert();
+            }
             var temp = this.front;
             this.front = this.back;
             this.back = temp;
@@ -545,7 +568,9 @@ var BABYLON = BABYLON || {};
             for (var i = 0; i < polygons.length; i++) {
                 this.plane.splitPolygon(polygons[i], front, back, front, back);
             }
-            if (this.front) front = this.front.clipPolygons(front);
+            if (this.front) {
+                front = this.front.clipPolygons(front);
+            }
             if (this.back) {
                 back = this.back.clipPolygons(back);
             } else {
@@ -591,5 +616,4 @@ var BABYLON = BABYLON || {};
             }
         }
     };
-
 })();

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

@@ -1597,4 +1597,30 @@ var BABYLON = BABYLON || {};
             normals[index * 3 + 2] = normal.z;
         }
     };
+
+    BABYLON.Mesh.MinMax = function(meshes) {
+        var minVector;
+        var maxVector;
+        for(var i in meshes) {
+            var mesh = meshes[i];
+            var boundingBox = mesh.getBoundingInfo().boundingBox;
+            if (!minVector) {
+                minVector = boundingBox.minimumWorld;
+                maxVector = boundingBox.maximumWorld;
+                continue;
+            }
+            minVector.MinimizeInPlace(boundingBox.minimumWorld);
+            maxVector.MaximizeInPlace(boundingBox.maximumWorld);
+        }
+
+        return {
+            min: minVector,
+            max: maxVector
+        };
+    };
+
+    BABYLON.Mesh.Center = function(meshesOrMinMaxVector) {
+        var minMaxVector = meshesOrMinMaxVector.min !== undefined ? meshesOrMinMaxVector : BABYLON.Mesh.MinMax(meshesOrMinMaxVector);
+        return BABYLON.Vector3.Center(minMaxVector.min, minMaxVector.max);
+    };
 })();

+ 4 - 4
Babylon/PostProcess/babylon.oculusDistortionCorrectionPostProcess.js

@@ -3,7 +3,7 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.oculusDistortionCorrectionPostProcess = function (name, camera, isRightEye, cameraSettings) {
+    BABYLON.OculusDistortionCorrectionPostProcess = function (name, camera, isRightEye, cameraSettings) {
         BABYLON.PostProcess.call(this, name, "oculusDistortionCorrection", [
 			'LensCenter',
 		    'Scale',
@@ -16,14 +16,14 @@ var BABYLON = BABYLON || {};
         this._lensCenterOffset = cameraSettings.LensCenterOffset;
     };
 
-    BABYLON.oculusDistortionCorrectionPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
-    BABYLON.oculusDistortionCorrectionPostProcess.prototype.onSizeChanged = function () {
+    BABYLON.OculusDistortionCorrectionPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
+    BABYLON.OculusDistortionCorrectionPostProcess.prototype.onSizeChanged = function () {
         this.aspectRatio = this.width * .5 / this.height;
         this._scaleIn = new BABYLON.Vector2(2, 2 / this.aspectRatio);
         this._scaleFactor = new BABYLON.Vector2(.5 * (1/this._postProcessScaleFactor), .5 * (1/this._postProcessScaleFactor) * this.aspectRatio);
         this._lensCenter = new BABYLON.Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);
     };
-    BABYLON.oculusDistortionCorrectionPostProcess.prototype.onApply = function (effect) {
+    BABYLON.OculusDistortionCorrectionPostProcess.prototype.onApply = function (effect) {
         effect.setFloat2("LensCenter", this._lensCenter.x, this._lensCenter.y);
         effect.setFloat2("Scale", this._scaleFactor.x, this._scaleFactor.y);
         effect.setFloat2("ScaleIn", this._scaleIn.x, this._scaleIn.y);

+ 7 - 4
Babylon/babylon.engine.js

@@ -44,7 +44,7 @@ var BABYLON = BABYLON || {};
 
         // Extensions
         this._caps.standardDerivatives = (this._gl.getExtension('OES_standard_derivatives') !== null);
-        this._caps.s3tc = this._gl.getExtension('WEBGL_compressed_texture_s3tc') ;
+        this._caps.s3tc = this._gl.getExtension('WEBGL_compressed_texture_s3tc');
         this._caps.textureFloat = (this._gl.getExtension('OES_texture_float') !== null);        
         this._caps.textureAnisotropicFilterExtension = this._gl.getExtension('EXT_texture_filter_anisotropic') || this._gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || this._gl.getExtension('MOZ_EXT_texture_filter_anisotropic');
         this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;
@@ -865,7 +865,7 @@ var BABYLON = BABYLON || {};
         scene._addPendingData(img);
     };
 
-    BABYLON.Engine.prototype.createCubeTexture = function (rootUrl, scene, extensions) {
+    BABYLON.Engine.prototype.createCubeTexture = function (rootUrl, scene, extensions, noMipmap) {
         var gl = this._gl;
 
         var texture = gl.createTexture();
@@ -895,9 +895,12 @@ var BABYLON = BABYLON || {};
                 gl.texImage2D(faces[index], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, that._workingCanvas);
             }
 
-            gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+            if (!noMipmap) {
+                gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+            }
+            
             gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
-            gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
+            gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, noMipmap ? gl.LINEAR : gl.LINEAR_MIPMAP_LINEAR);
             gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
             gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
 

+ 4 - 2
Tools/BuildOurOwnBabylonJS/BabylonJS/BabylonJS.csproj

@@ -15,20 +15,22 @@
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <UseIISExpress>false</UseIISExpress>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
     <OutputPath>bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
+    <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>

+ 16 - 21
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.sln

@@ -17,29 +17,24 @@ Global
 		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Any CPU.Build.0 = Release|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|x86.ActiveCfg = Release|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|x86.ActiveCfg = Release|Any CPU
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|x86.ActiveCfg = Debug|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Debug|x86.Build.0 = Debug|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Any CPU.ActiveCfg = Release|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|x86.ActiveCfg = Release|x86
+		{0263AD0D-56E6-4439-BC05-6EC957200F52}.Release|x86.Build.0 = Release|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|x86.ActiveCfg = Debug|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Debug|x86.Build.0 = Debug|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Any CPU.ActiveCfg = Release|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|x86.ActiveCfg = Release|x86
+		{93EF5B02-72EB-4B55-831E-E5051269EDA6}.Release|x86.Build.0 = Release|x86
 		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Debug|Any CPU.ActiveCfg = Debug|x86
 		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
-		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Debug|Mixed Platforms.Build.0 = Debug|x86
 		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Debug|x86.ActiveCfg = Debug|x86
 		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Debug|x86.Build.0 = Debug|x86
 		{CFBE5149-1605-4824-8BD2-55C9B3C1DA60}.Release|Any CPU.ActiveCfg = Release|x86

+ 4 - 4
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/babylonJS.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <files xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="babylonJS.xsd">
-  <script src="Babylon/Cameras/Controllers/babylon.inputController.js"></script>
-  <script src="Babylon/PostProcess/babylon.oculusDistortionCorrectionPostProcess.js"></script>
+  <script src="Babylon/Cameras/babylon.virtualJoysticksCamera.js"></script>
   <script src="Babylon/Tools/babylon.virtualJoystick.js"></script>
-  <script src="Babylon/Cameras/Controllers/babylon.oculusController.js"></script>
   <script src="Babylon/Cameras/babylon.oculusOrientedCamera.js"></script>
-  <script src="Babylon/Cameras/babylon.virtualJoysticksCamera.js"></script>
+  <script src="Babylon/PostProcess/babylon.oculusDistortionCorrectionPostProcess.js"></script>
+  <script src="Babylon/Cameras/Controllers/babylon.oculusController.js"></script>
   <script src="Babylon/Cameras/Controllers/babylon.keyboardMoveController.js"></script>
+  <script src="Babylon/Cameras/Controllers/babylon.inputController.js"></script>
   <script src="Babylon/Mesh/babylon.csg.js"></script>
   <script src="Babylon/Tools/babylon.sceneSerializer.js"></script>
   <script src="Babylon/Physics/babylon.physicsEngine.js"></script>

+ 5 - 3
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/BuildOurOwnBabylonJSServer.csproj

@@ -16,20 +16,22 @@
     <MvcBuildViews>false</MvcBuildViews>
     <UseIISExpress>false</UseIISExpress>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
     <OutputPath>bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
+    <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
@@ -64,6 +66,7 @@
   <ItemGroup>
     <Compile Include="Controllers\BabylonJSDemoController.cs" />
     <Compile Include="Controllers\OurDemoController.cs" />
+    <Compile Include="ViewModel\OurDemoViewModel.cs" />
     <Compile Include="WebViewPageExtensions.cs" />
     <Compile Include="Controllers\HomeController.cs" />
     <Compile Include="Controllers\BuildOurOwnBabylonJSController.cs" />
@@ -152,7 +155,6 @@
       <Private>True</Private>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 28 - 2
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/Controllers/OurDemoController.cs

@@ -3,14 +3,40 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
+using System.IO;
+using BuildOurOwnBabylonJSServer.ViewModels;
 
 namespace BuildOurOwnBabylonJSServer.Controllers
 {
     public class OurDemoController : Controller
     {
-        public ActionResult Show(string demo)
+        public ActionResult Show(string viewName, 
+            string folder = "")
         {
-            return View(demo);
+            var form = Request.Form;
+            var queryString = Request.QueryString;
+            var dictionary = new Dictionary<string, string>(form.Count + queryString.Count);
+
+            var keys = form.AllKeys;
+            
+            foreach(var k in keys)
+            {
+                if (k == "viewName" || k == "folder")
+                    continue;
+                dictionary.Add(k, form.GetValues(k).First());
+            }
+
+            keys = queryString.AllKeys;
+
+            foreach (var k in keys)
+            {
+                if (k == "viewName" || k == "folder")
+                    continue;
+                dictionary.Add(k, queryString.GetValues(k).First());
+            }
+
+            return View(Path.Combine(folder, viewName),
+                new OurDemoViewModel { Folder = folder, Dictionary = dictionary });
         }
     }
 }

+ 15 - 0
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/ViewModel/OurDemoViewModel.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.IO;
+
+namespace BuildOurOwnBabylonJSServer.ViewModels
+{
+    public class OurDemoViewModel
+    {
+        public string Folder { get; set; }
+        public IDictionary<string, string> Dictionary { get; set; }
+    }
+}

+ 47 - 0
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJSServer/Views/OurDemo/sample.cshtml

@@ -0,0 +1,47 @@
+@model OurDemoViewModel
+@using BuildOurOwnBabylonJSServer.ViewModels
+@using System.Text.RegularExpressions
+
+@{
+    ViewBag.Title = "Our Own BabylonJS";
+    ViewBag.BabylonJSFolder = "..\\..\\..\\";
+
+    var myRegex = new Regex(@"[\\]", RegexOptions.Singleline);
+
+    Model.Folder = myRegex.Replace(Model.Folder, @"/");
+    Model.Folder = Model.Folder.Trim('/');
+
+    if (!String.IsNullOrEmpty(Model.Folder))
+    {
+        Model.Folder += "/";
+    }
+}
+
+<script type="text/javascript">
+    $(document).ready(function () {
+        BABYLON.SceneLoader.Load("/Content/@Model.Folder", "@Model.Dictionary["fileBJS"]" + ".babylon", OURBABYLON.engine, function (scene) {
+
+            scene.activeCamera = new BABYLON.ArcRotateCamera("defaultCamera", 0, 0, 100, BABYLON.Vector3.Zero(), scene);
+
+            scene.activeCamera.zoomOn();
+            scene.activeCamera.attachControl(OURBABYLON.canvas);
+
+            var material = new BABYLON.StandardMaterial("default", scene);
+            material.emissiveColor = new BABYLON.Color3(0.7, 0.7, 0.7);
+
+            for (var m in scene.meshes) {
+                scene.meshes[m].material = material;
+            }
+
+            // Render loop
+            var renderLoop = function () {
+                scene.render();
+            };
+
+            // Launch render loop
+            scene.getEngine().runRenderLoop(renderLoop);
+
+            OURBABYLON.currentScene = scene;
+        });
+    });
+</script>

Plik diff jest za duży
+ 2 - 2
babylon.1.9.0.js