Explorar o código

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

Deltakosh %!s(int64=11) %!d(string=hai) anos
pai
achega
3e6ecf40ca

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

@@ -4,12 +4,12 @@ var BABYLON = BABYLON || {};
 
 (function () {
     BABYLON.GravityInputController = function (scene, target) {
-        BABYLON.inputController.call(this, scene, target);
+        BABYLON.InputController.call(this, scene, target);
         this._moveVectorGlobal = new BABYLON.Vector3(0, 0, 0);
         this._moveVectorLocal = new BABYLON.Vector3(0, 0, 0);
         this._fallSpeed = .6;
     };
-    BABYLON.GravityInputController.prototype = Object.create(BABYLON.inputController.prototype);
+    BABYLON.GravityInputController.prototype = Object.create(BABYLON.InputController.prototype);
     BABYLON.GravityInputController.prototype.update = function () {
         this._moveVectorGlobal.x = 0;
         this._moveVectorGlobal.y = -this._fallSpeed * BABYLON.Tools.GetDeltaTime() / 1000.0;

+ 22 - 22
Babylon/Cameras/Controllers/babylon.inputController.js

@@ -4,28 +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.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) {
@@ -35,30 +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.getOrientationMatrix = function () { return this.targets[0].getOrientationMatrix(); };
-	BABYLON.inputControllerMultiTarget.prototype.getInvertOrientationMatrix = function () { return this.targets[0].getInvertOrientationMatrix(); };
+	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) {
+	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();
@@ -66,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) {
@@ -75,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) {

+ 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;
+    };
+
 })();
 

+ 3 - 3
Babylon/Cameras/babylon.oculusOrientedCamera.js

@@ -59,7 +59,7 @@ 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) {
@@ -72,7 +72,7 @@ var BABYLON = BABYLON || {};
             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,
@@ -140,7 +140,7 @@ var BABYLON = BABYLON || {};
         return this._projectionMatrix;
     };
 
-    // implementation of inputControllerTarget
+    // implementation of InputControllerTarget
     BABYLON.OculusOrientedCamera.prototype.getOrientation = function () {
         return this._currentOrientation;
     };

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

@@ -656,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);
@@ -898,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) {
@@ -923,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) {

+ 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 - 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>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
babylon.1.9.0.js