Selaa lähdekoodia

Merge pull request #127 from gwenael-hagenmuller/ourOwnBabylonJS-cameraFixes

Moved BabylonJS.csproj to Tools/BuildOurOwnBabylonJS/BabylonJS and fixed Julien's pull-request
deltakosh 11 vuotta sitten
vanhempi
commit
c76c751c73

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

@@ -90,13 +90,16 @@ var BABYLON = BABYLON || {};
         this._cache.maxZ = this.maxZ;
 
         this._cache.fov = this.fov;
+
+        var engine = this._scene.getEngine();
+
         this._cache.aspectRatio = engine.getAspectRatio();
 
         this._cache.orthoLeft = this.orthoLeft;
         this._cache.orthoRight = this.orthoRight;
         this._cache.orthoBottom = this.orthoBottom;
         this._cache.orthoTop = this.orthoTop;
-        this._cache.renderWidth = engine.getRenderWidth()
+        this._cache.renderWidth = engine.getRenderWidth();
         this._cache.renderHeight = engine.getRenderHeight();
     };
 
@@ -121,6 +124,9 @@ var BABYLON = BABYLON || {};
         if (!r)
             return false;
 
+
+        var engine = this._scene.getEngine();
+
         if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
             r = this._cache.fov === this.fov
                  && this._cache.aspectRatio === engine.getAspectRatio();
@@ -152,11 +158,11 @@ var BABYLON = BABYLON || {};
     };
 
     BABYLON.Camera.prototype.getWorldMatrix = function () {
-        var viewMatrix = this.getViewMatrix();
-
         if (!this._worldMatrix) {
             this._worldMatrix = BABYLON.Matrix.Identity();
         }
+        
+        var viewMatrix = this.getViewMatrix();
 
         viewMatrix.invertToRef(this._worldMatrix);
 
@@ -175,6 +181,10 @@ var BABYLON = BABYLON || {};
             || (!this.hasNewParent() && this.parent.isSynchronized())) {
             return this._computedViewMatrix;
         }
+
+        if (!this._worldMatrix) {
+            this._worldMatrix = BABYLON.Matrix.Identity();
+        }
         
         this._computedViewMatrix.invertToRef(this._worldMatrix);
 

+ 1 - 1
Babylon/Mesh/babylon.mesh.js

@@ -1349,7 +1349,7 @@ var BABYLON = BABYLON || {};
         return ground;
     };
     
-    BABYLON.Mesh.prototype._initCache = function (
+    BABYLON.Mesh.prototype._initCache = function () {
         this._cache.localMatrixUpdated = false;
         this._cache.position = BABYLON.Vector3.Zero();
         this._cache.scaling = BABYLON.Vector3.Zero();

+ 2 - 2
Babylon/babylon.node.js

@@ -50,9 +50,9 @@ var BABYLON = BABYLON || {};
     BABYLON.Node.prototype.isSynchronized = function (updateCache) {
         var r = this.hasNewParent();
 
-        r = r ? true : (this.parent && this.parent._needToSynchonizeChildren());
+        r = r || (this.parent && this.parent._needToSynchonizeChildren());
         
-        r = r ? true : !this._isSynchronized();
+        r = r || !this._isSynchronized();
         
         if(updateCache)
             this.updateCache(true);

+ 12 - 4
BabylonJS.csproj

@@ -33,10 +33,18 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Content Include="cannon.js" />
-    <Content Include="babylon.*.*.*.js" />
-    <Content Include="Babylon\**\*.*" />
-    <Content Include="Typescript\**\*.*" />
+    <Resource Include="..\..\..\cannon.js">
+      <Link>cannon.js</Link>
+    </Resource>
+    <Resource Include="..\..\..\babylon.*.*.*.js">
+      <Link>%(Filename)%(Extension)</Link>
+    </Resource>
+    <Resource Include="..\..\..\Babylon\**\*.*">
+      <Link>Babylon\%(RecursiveDir)%(Filename)%(Extension)</Link>
+    </Resource>
+    <Resource Include="..\..\..\Typescript\**\*.*">
+      <Link>Typescript\%(RecursiveDir)%(Filename)%(Extension)</Link>
+    </Resource>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />

+ 1 - 1
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BabylonJS", "..\..\BabylonJS.csproj", "{0263AD0D-56E6-4439-BC05-6EC957200F52}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BabylonJS", "BabylonJS\BabylonJS.csproj", "{0263AD0D-56E6-4439-BC05-6EC957200F52}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildOurOwnBabylonJSServer", "BuildOurOwnBabylonJSServer\BuildOurOwnBabylonJSServer.csproj", "{93EF5B02-72EB-4B55-831E-E5051269EDA6}"
 EndProject

+ 5 - 5
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/.gitignore

@@ -1,6 +1,6 @@
 # User-specific files
-executables/jskompactor.exe
-ourOwnBabylonJS.xml
-ourOwnBabylon.js
-#is in repo do have an example of command line
-BuildOurOwnBabylonJS.csproj.user 
+/executables/jskompactor.bat
+/ourOwnBabylonJS.xml
+/ourOwnBabylon.js
+#is in repo to have an example of command line
+/BuildOurOwnBabylonJS.csproj.user 

+ 6 - 0
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.csproj

@@ -76,6 +76,12 @@
   <ItemGroup>
     <None Include="app.config" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\BabylonJS\BabylonJS.csproj">
+      <Project>{0263AD0D-56E6-4439-BC05-6EC957200F52}</Project>
+      <Name>BabylonJS</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
     <PostBuildEvent>

+ 9 - 0
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.csproj.user

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <StartArguments>/w:"..\..\..\..\.." /i:"..\..\ourOwnBabylonJS.xml" /s:"Babylon\Shaders" /o:"..\.."</StartArguments>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <StartArguments>/w:"..\..\..\..\.." /i:"..\..\ourOwnBabylonJS.xml" /s:"Babylon\Shaders" /o:"..\.."</StartArguments>
+  </PropertyGroup>
+</Project>

+ 40 - 0
Tools/BuildOurOwnBabylonJS/readme.md

@@ -0,0 +1,40 @@
+BuildOurOwnBabylonJS
+====================
+
+Tool to start playing with and tuning BabylonJS as soon as possible
+
+(Paths in this file are relative to this file location.)
+
+## Content
+- BabylonJS folder: contains a Visual Studio 2010 project that links to the last version of babylon.js file (under ..\..\..\),
+                    to ..\..\..\cannon.js and to all the files under ..\..\..\Babylon and ..\..\..\Typescript
+- BuildOurOwnBabylonJS: contains a Visual Studio 2010 project to create ourOwnBabylon.js with ourOwnBabylonJS.xml as input;
+                        it also contains the executables (no need to compile the project to create ourOwnBabylon.js)
+- BuildOurOwnBabylonJSServer: contains a Visual Studio 2010 project which is a simple MVC3 application with a single sample page;
+                              this sample page includes ourOwnBabylon.js to load the [Train demo] (http://www.babylonjs.com/)
+
+## Goal of it
+[JSKompactor.exe](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/executables/JSKompactor.exe) provided by Deltakosh enables you to pass a list of javascript files to create the minified version of Babylon.js.
+[BuildOurOwnBabylonJS.bat](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/executables/BuildOurOwnBabylonJS.bat) generates for your this list by dealing with dependencies defined in [ourOwnBabylonJS.xml](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylonJS.xml)
+By editing [ourOwnBabylonJS.xml](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylonJS.xml), you customize this list to get only what needed from BabylonJS in [ourOwnBabylon.js](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylon.js).
+[ourOwnBabylon.js](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylon.js) can be included in your project instead of the last version of Babylon.js.
+Changes made in the separate files of Babylon.js will appear in [ourOwnBabylon.js](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylon.js) once [BuildOurOwnBabylonJS.bat](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/executables/BuildOurOwnBabylonJS.bat) has been run. 
+
+## How to use it
+- Edit the files that you want to modify under the files under ..\..\..\Babylon, add new files too if you want and then update [babylonJS.xml](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/babylonJS.xml) and [ourOwnBabylonJS.xml](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylonJS.xml) accordingly
+- Generate [ourOwnBabylon.js](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylon.js). For this, you have two options:
+   1. use [BuildOurOwnBabylonJS.bat](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/executables/BuildOurOwnBabylonJS.bat)
+   2. open in Visual Studio 2010 [BuildOurOwnBabylonJS.sln](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.sln), set 'BuildOurOwnBabylonJSServer' as default project and then 'Build Solution'
+- If you use i., include in your projects [ourOwnBabylon.js](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/ourOwnBabylon.js) instead of including the last version of Babylon.js (or the files separately).
+  If you use ii., 'Start Without Debugging'
+  
+## Use of the Visual Studio 2010 solution
+- Open in Visual Studio 2010 [BuildOurOwnBabylonJS.sln](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS.sln), set 'BuildOurOwnBabylonJSServer' as default project
+- **DO NOT MANUALLY ADD** files in [BabylonJS.csproj](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BabylonJS/BabylonJS.csproj), they are automatically added thanks to wildcards.
+  If you want to add files to extend BabylonJS, add them at the right place under ..\..\..\Babylon, then 'Unload Project' for [BabylonJS.csproj](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BabylonJS/BabylonJS.csproj) and 'Reload Project' for [BabylonJS.csproj](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/BuildOurOwnBabylonJS/BabylonJS/BabylonJS.csproj)
+- Edit all the files that you want directly inside Visual Studio 2010
+- Add all your projects/demos by adding new Views under the Home folder of BuildOurOwnBabylonJS.csproj. Index.cshtml is an example to help you start.
+- Anytime you modify javascript files or babylonJS.xml or ourOwnBabylonJS.xml, build the solution and refresh your page in your web browser to see the changes.
+
+## Support
+Please contact [Gwenaël Hagenmuller](mailto:gwenaelhagen@gmail.com)