David Catuhe 11 年之前
父節點
當前提交
3be3495d90
共有 100 個文件被更改,包括 342 次插入12 次删除
  1. 1 1
      Babylon/Cameras/babylon.camera.js
  2. 4 2
      Babylon/Cameras/babylon.freeCamera.js
  3. 3 2
      Babylon/Cameras/babylon.oculusOrientedCamera.js
  4. 3 3
      Babylon/Mesh/babylon.csg.js
  5. 99 0
      Samples/Scenes/Customs/cellShading.js
  6. 64 0
      Samples/Scenes/Customs/csg.js
  7. 2 0
      Samples/Scenes/Customs/fog_test.js
  8. 二進制
      Samples/Scenes/Customs/grass.dds
  9. 7 3
      Samples/Scenes/Customs/heightMap_test.js
  10. 1 0
      Samples/Scenes/Customs/lights_test.js
  11. 1 0
      Samples/Scenes/Customs/physics.js
  12. 62 0
      Samples/Scenes/Customs/postprocessConvolution.js
  13. 50 0
      Samples/Scenes/Customs/shaders/cellShading.fragment.fx
  14. 27 0
      Samples/Scenes/Customs/shaders/cellShading.vertex.fx
  15. 8 1
      Samples/Scenes/Customs/shadows.js
  16. 4 0
      Samples/Scenes/Customs/test.js
  17. 二進制
      Samples/Scenes/hillvalley/AlderBark.jpg
  18. 二進制
      Samples/Scenes/hillvalley/AlderBranches.png
  19. 二進制
      Samples/Scenes/hillvalley/Colonne simpleCompleteMap.jpg
  20. 二進制
      Samples/Scenes/hillvalley/D1_delorean_seatDiffuseMap2.jpg
  21. 二進制
      Samples/Scenes/hillvalley/D1_ext_cable_01 .jpg
  22. 二進制
      Samples/Scenes/hillvalley/D1_ext_cable_02 .jpg
  23. 二進制
      Samples/Scenes/hillvalley/D1_ext_cable_03 .jpg
  24. 二進制
      Samples/Scenes/hillvalley/D1_ext_cable_grid .jpg
  25. 二進制
      Samples/Scenes/hillvalley/D1_ext_cables_LM.jpg
  26. 二進制
      Samples/Scenes/hillvalley/D1_ext_carrosserieDiffuseMap.jpg
  27. 二進制
      Samples/Scenes/hillvalley/D1_ext_metal_01 .jpg
  28. 二進制
      Samples/Scenes/hillvalley/D1_ext_neons_grid.png
  29. 二進制
      Samples/Scenes/hillvalley/D1_ext_reactor_01DiffuseMap2.jpg
  30. 二進制
      Samples/Scenes/hillvalley/D1_ext_wheelsAV_01DiffuseMap.jpg
  31. 二進制
      Samples/Scenes/hillvalley/D1_ext_wheelsAV_01_spec.png
  32. 二進制
      Samples/Scenes/hillvalley/D1_porte_01DiffuseMap.jpg
  33. 二進制
      Samples/Scenes/hillvalley/D1_porte_02DiffuseMap.jpg
  34. 二進制
      Samples/Scenes/hillvalley/D1_vitre_ext_LM.jpg
  35. 二進制
      Samples/Scenes/hillvalley/Fils.png
  36. 1 0
      Samples/Scenes/hillvalley/HillValley.babylon
  37. 5 0
      Samples/Scenes/hillvalley/HillValley.babylon.manifest
  38. 二進制
      Samples/Scenes/hillvalley/LampasoloDiffuseMap.jpg
  39. 二進制
      Samples/Scenes/hillvalley/Parcmetre2CompleteMap.jpg
  40. 二進制
      Samples/Scenes/hillvalley/PoteauDiffuseMap.jpg
  41. 二進制
      Samples/Scenes/hillvalley/SycamoreLeaves5.png
  42. 二進制
      Samples/Scenes/hillvalley/allstateDiffuseMap.jpg
  43. 二進制
      Samples/Scenes/hillvalley/arbres_plan_04.png
  44. 二進制
      Samples/Scenes/hillvalley/arbuste.png
  45. 二進制
      Samples/Scenes/hillvalley/arbuste14_LM.jpg
  46. 二進制
      Samples/Scenes/hillvalley/armstrongDiffuseMap.jpg
  47. 二進制
      Samples/Scenes/hillvalley/bancDiffuseMap.jpg
  48. 二進制
      Samples/Scenes/hillvalley/bank_of_nyDiffuseMap.jpg
  49. 二進制
      Samples/Scenes/hillvalley/bat_annexDiffuseMap.jpg
  50. 二進制
      Samples/Scenes/hillvalley/bat_arriereDiffuseMap.jpg
  51. 二進制
      Samples/Scenes/hillvalley/bat_arriere_02DiffuseMap.jpg
  52. 二進制
      Samples/Scenes/hillvalley/blue_birdDiffuseMap.jpg
  53. 二進制
      Samples/Scenes/hillvalley/bois_peint_vert.jpg
  54. 二進制
      Samples/Scenes/hillvalley/bouche_incendieDiffuseMap.jpg
  55. 二進制
      Samples/Scenes/hillvalley/boutderueDiffuseMap.jpg
  56. 二進制
      Samples/Scenes/hillvalley/branche_chene.png
  57. 二進制
      Samples/Scenes/hillvalley/branche_liquidambar_alpha.png
  58. 二進制
      Samples/Scenes/hillvalley/branche_morte.png
  59. 二進制
      Samples/Scenes/hillvalley/brousaille_01.png
  60. 二進制
      Samples/Scenes/hillvalley/brousaille_03.png
  61. 二進制
      Samples/Scenes/hillvalley/buisson_LM.jpg
  62. 二進制
      Samples/Scenes/hillvalley/cabane_boisDiffuseMap.jpg
  63. 二進制
      Samples/Scenes/hillvalley/cattle_queenDiffuseMap.jpg
  64. 二進制
      Samples/Scenes/hillvalley/charDiffuseMap.jpg
  65. 二進制
      Samples/Scenes/hillvalley/coullons_bush.png
  66. 二進制
      Samples/Scenes/hillvalley/courthouseDiffuseMap.jpg
  67. 二進制
      Samples/Scenes/hillvalley/courthouse_vitre_01_LM.jpg
  68. 二進制
      Samples/Scenes/hillvalley/courthouse_vitre_02_LM.jpg
  69. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_nx.jpg
  70. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_ny.jpg
  71. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_nz.jpg
  72. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_px.jpg
  73. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_py.jpg
  74. 二進制
      Samples/Scenes/hillvalley/cubmap_hhv_pz.jpg
  75. 二進制
      Samples/Scenes/hillvalley/delorean_cables_int_LM.jpg
  76. 二進制
      Samples/Scenes/hillvalley/delorean_convecteurDiffuseMap2.jpg
  77. 二進制
      Samples/Scenes/hillvalley/delorean_convecteur_light_test.png
  78. 二進制
      Samples/Scenes/hillvalley/delorean_plate_01 .jpg
  79. 二進制
      Samples/Scenes/hillvalley/delorean_volantDiffuseMap2.jpg
  80. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_nx.jpg
  81. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_ny.jpg
  82. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_nz.jpg
  83. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_px.jpg
  84. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_py.jpg
  85. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapext_pz.jpg
  86. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_nx.jpg
  87. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_ny.jpg
  88. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_nz.jpg
  89. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_px.jpg
  90. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_py.jpg
  91. 二進制
      Samples/Scenes/hillvalley/delroean_cubmapint_pz.jpg
  92. 二進制
      Samples/Scenes/hillvalley/dernier_bat_LM.jpg
  93. 二進制
      Samples/Scenes/hillvalley/elite_barberDiffuseMap.jpg
  94. 二進制
      Samples/Scenes/hillvalley/enduit03_c .jpg
  95. 二進制
      Samples/Scenes/hillvalley/enduit04_b .jpg
  96. 二進制
      Samples/Scenes/hillvalley/essexDiffuseMap.jpg
  97. 二進制
      Samples/Scenes/hillvalley/feux_trico_LM.jpg
  98. 二進制
      Samples/Scenes/hillvalley/feux_tricolor .jpg
  99. 二進制
      Samples/Scenes/hillvalley/florigoldDiffuseMap.jpg
  100. 0 0
      Samples/Scenes/hillvalley/fond_mountain.png

+ 1 - 1
Babylon/Cameras/babylon.camera.js

@@ -325,4 +325,4 @@ var BABYLON = BABYLON || {};
             this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
         }
     };
-})();
+})();

+ 4 - 2
Babylon/Cameras/babylon.freeCamera.js

@@ -72,10 +72,12 @@ var BABYLON = BABYLON || {};
             this._cache.lockedTarget = null;
         }
         else {
-            if (!this._cache.lockedTarget)
+            if (!this._cache.lockedTarget) {
                 this._cache.lockedTarget = lockedTargetPosition.clone();
-            else
+            }
+            else {
                 this._cache.lockedTarget.copyFrom(lockedTargetPosition);
+            }
         }
 
         this._cache.rotation.copyFrom(this.rotation);

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

@@ -35,8 +35,9 @@ var BABYLON = BABYLON || {};
         this.resetViewMatrix();
     };
     
-    BABYLON.OculusOrientedCamera.BuildOculusStereoCamera = function (scene, name, canvas, minZ, maxZ, position, neutralOrientation, useFXAA, disableGravity,disableCollisions, ovrSettings) {
-        position = position || new BABYLON.Vector2(0, 0);
+    BABYLON.OculusOrientedCamera.BuildOculusStereoCamera = function (scene, name, minZ, maxZ, position, neutralOrientation, useFXAA, disableGravity, disableCollisions, ovrSettings) {
+        var canvas = scene.getEngine().getRenderingCanvas();
+        position = position || BABYLON.Vector3.Zero(0, 0, 0);
         neutralOrientation = neutralOrientation || { yaw: 0.0, pitch: 0.0, roll: 0.0 };
         //var controller =  new BABYLON.OculusController();
         ovrSettings = ovrSettings || BABYLON.OculusController.CameraSettings_OculusRiftDevKit2013_Metric;

+ 3 - 3
Babylon/Mesh/babylon.csg.js

@@ -7,7 +7,7 @@ var BABYLON = BABYLON || {};
 (function () {
 
     // Unique ID when we import meshes from Babylon to CSG
-    var _currentCSGMeshId = 0;
+    var currentCSGMeshId = 0;
 
     BABYLON.CSG = function () {
         this.polygons = [];
@@ -51,7 +51,7 @@ var BABYLON = BABYLON || {};
                     vertices.push(vertex);
                 }
 
-                polygon = new BABYLON.CSG.Polygon(vertices, { subMeshId: sm, meshId: _currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex });
+                polygon = new BABYLON.CSG.Polygon(vertices, { subMeshId: sm, meshId: currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex });
 
                 // To handle the case of degenerated triangle
                 // polygon.plane == null <=> the polygon does not represent 1 single plane <=> the triangle is degenerated
@@ -62,7 +62,7 @@ var BABYLON = BABYLON || {};
 
         var csg = BABYLON.CSG.fromPolygons(polygons);
         csg.copyTransformAttributes(this);
-        _currentCSGMeshId++;
+        currentCSGMeshId++;
 
         return csg;
     };

+ 99 - 0
Samples/Scenes/Customs/cellShading.js

@@ -0,0 +1,99 @@
+var CreateCellShadingScene = function (engine) {
+    
+    var CellShadingMaterial = function (name, scene, light) {
+        this.name = name;
+        this.id = name;
+        this.light = light;
+
+        this._scene = scene;
+        scene.materials.push(this);
+
+        this.texture = null;
+
+        this.toonThresholds = [0.95, 0.5, 0.2, 0.03];
+        this.toonBrightnessLevels = [1.0, 0.8, 0.6, 0.35, 0.01];
+    };
+
+    CellShadingMaterial.prototype = Object.create(BABYLON.Material.prototype);
+
+    // Properties   
+    CellShadingMaterial.prototype.needAlphaBlending = function () {
+        return false;
+    };
+
+    CellShadingMaterial.prototype.needAlphaTesting = function () {
+        return false;
+    };
+
+    // Methods   
+    CellShadingMaterial.prototype.isReady = function (mesh) {
+        var engine = this._scene.getEngine();
+
+        if (this.texture && !this.texture.isReady) {
+            return false;
+        }
+
+        this._effect = engine.createEffect("./Scenes/Customs/shaders/cellShading",
+            ["position", "normal", "uv"],
+            ["worldViewProjection", "world", "view", "vLightPosition", "vLightColor", "ToonBrightnessLevels", "ToonThresholds"],
+            ["textureSampler"],
+            "");
+
+        if (!this._effect.isReady()) {
+            return false;
+        }
+
+        return true;
+    };
+
+    CellShadingMaterial.prototype.bind = function (world, mesh) {
+        this._effect.setMatrix("world", world);
+        this._effect.setMatrix("worldViewProjection", world.multiply(this._scene.getTransformMatrix()));
+        this._effect.setVector3("vLightPosition", this.light.position);
+        this._effect.setColor3("vLightColor", this.light.diffuse);
+
+        this._effect.setArray("ToonThresholds", this.toonThresholds);
+        this._effect.setArray("ToonBrightnessLevels", this.toonBrightnessLevels);
+
+        // Textures        
+        this._effect.setTexture("textureSampler", this.texture);
+    };
+
+    CellShadingMaterial.prototype.dispose = function () {
+        if (this.texture) {
+            this.texture.dispose();
+        }
+        this.baseDispose();
+    };
+
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, Math.PI / 4, 40, BABYLON.Vector3.Zero(), scene);
+    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
+    var sphere = BABYLON.Mesh.CreateSphere("Sphere0", 32, 3, scene);
+    var cylinder = BABYLON.Mesh.CreateCylinder("Sphere1", 5, 3, 2, 32, scene);
+    var torus = BABYLON.Mesh.CreateTorus("Sphere2", 3, 1, 32, scene);
+
+    var cellShadingMaterial = new CellShadingMaterial("mat0", scene, light);
+    cellShadingMaterial.texture = new BABYLON.Texture("Scenes/Customs/Ground.jpg", scene);
+    
+    sphere.material = cellShadingMaterial;
+    sphere.position = new BABYLON.Vector3(-10, 0, 0);
+    cylinder.material = cellShadingMaterial;
+    torus.material = cellShadingMaterial;
+    torus.position = new BABYLON.Vector3(10, 0, 0);
+    
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function () {
+        sphere.rotation.y = alpha;
+        sphere.rotation.x = alpha;
+        cylinder.rotation.y = alpha;
+        cylinder.rotation.x = alpha;
+        torus.rotation.y = alpha;
+        torus.rotation.x = alpha;
+
+        alpha += 0.05;
+    });
+    
+    return scene;
+};

+ 64 - 0
Samples/Scenes/Customs/csg.js

@@ -0,0 +1,64 @@
+var CreateCSGTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -0.5, -1.0), scene);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, new BABYLON.Vector3(0, 0, 0), scene);
+    camera.setPosition(new BABYLON.Vector3(10, 10, 10));
+    light.position = new BABYLON.Vector3(20, 150, 70);
+    camera.minZ = 10.0;
+
+    scene.ambientColor = new BABYLON.Color3(0.3, 0.3, 0.3);
+
+    var sourceMat = new BABYLON.StandardMaterial("sourceMat", scene);
+    sourceMat.wireframe = true;
+    sourceMat.backFaceCulling = false;
+
+    var a = BABYLON.Mesh.CreateSphere("sphere", 16, 4, scene);
+    var b = BABYLON.Mesh.CreateBox("box", 4, scene);
+    var c = BABYLON.Mesh.CreateBox("box", 4, scene);
+
+    a.material = sourceMat;
+    b.material = sourceMat;
+    c.material = sourceMat;
+
+    a.position.y += 5;
+    b.position.y += 2.5;
+    c.position.y += 3.5;
+    c.rotation.y += Math.PI / 8.0;
+
+    var aCSG = BABYLON.CSG.FromMesh(a);
+    var bCSG = BABYLON.CSG.FromMesh(b);
+    var cCSG = BABYLON.CSG.FromMesh(c);
+
+    // Set up a MultiMaterial
+    var mat0 = new BABYLON.StandardMaterial("mat0", scene);
+    var mat1 = new BABYLON.StandardMaterial("mat1", scene);
+
+    mat0.diffuseColor.copyFromFloats(0.8, 0.2, 0.2);
+    mat0.backFaceCulling = false;
+
+    mat1.diffuseColor.copyFromFloats(0.2, 0.8, 0.2);
+    mat1.backFaceCulling = false;
+
+    var subCSG = bCSG.subtract(aCSG);
+    var newMesh = subCSG.toMesh("csg", mat0, scene);
+    newMesh.position = new BABYLON.Vector3(-10, 0, 0);
+
+    subCSG = aCSG.subtract(bCSG);
+    newMesh = subCSG.toMesh("csg2", mat0, scene);
+    newMesh.position = new BABYLON.Vector3(10, 0, 0);
+
+    subCSG = aCSG.intersect(bCSG);
+    newMesh = subCSG.toMesh("csg3", mat0, scene);
+    newMesh.position = new BABYLON.Vector3(0, 0, 10);
+
+    // Submeshes are built in order : mat0 will be for the first cube, and mat1 for the second
+    var multiMat = new BABYLON.MultiMaterial("multiMat", scene);
+    multiMat.subMaterials.push(mat0, mat1);
+
+    // Last parameter to true means you want to build 1 subMesh for each mesh involved
+    subCSG = bCSG.subtract(cCSG);
+    newMesh = subCSG.toMesh("csg4", multiMat, scene, true);
+    newMesh.position = new BABYLON.Vector3(0, 0, -10);
+
+    return scene;
+};

+ 2 - 0
Samples/Scenes/Customs/fog_test.js

@@ -19,6 +19,8 @@
     material2.diffuseColor = new BABYLON.Color3(1, 0, 1);
     sphere2.material = material2;
     sphere2.position = new BABYLON.Vector3(10, 0, 0);
+
+    sphere1.convertToFlatShadedMesh();
     
     camera.setTarget(new BABYLON.Vector3(0, 0, 0));
     

二進制
Samples/Scenes/Customs/grass.dds


+ 7 - 3
Samples/Scenes/Customs/heightMap_test.js

@@ -18,7 +18,11 @@
     // Ground
     var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "Scenes/Customs/heightMap.png", 100, 100, 100, 0, 10, scene, false);
     var groundMaterial = new BABYLON.StandardMaterial("ground", scene);
-    groundMaterial.diffuseTexture = new BABYLON.Texture("Scenes/Customs/ground.jpg", scene);
+    if (engine.getCaps().s3tc) {
+        groundMaterial.diffuseTexture = new BABYLON.Texture("Scenes/Customs/grass.dds", scene);
+    } else {
+        groundMaterial.diffuseTexture = new BABYLON.Texture("Scenes/Customs/ground.jpg", scene);
+    }
     groundMaterial.diffuseTexture.uScale = 6;
     groundMaterial.diffuseTexture.vScale = 6;
     groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
@@ -32,8 +36,8 @@
         else if (camera.beta > (Math.PI / 2) * 0.9)
             camera.beta = (Math.PI / 2) * 0.9;
 
-        if (camera.radius > 30)
-            camera.radius = 30;
+        if (camera.radius > 50)
+            camera.radius = 50;
 
         if (camera.radius < 5)
             camera.radius = 5;

+ 1 - 0
Samples/Scenes/Customs/lights_test.js

@@ -58,6 +58,7 @@
     skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
     skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
     skybox.material = skyboxMaterial;
+    skybox.infiniteDistance = true;
 
     // Animations
     var alpha = 0;

+ 1 - 0
Samples/Scenes/Customs/physics.js

@@ -80,6 +80,7 @@
     shadowGenerator.getShadowMap().renderList.push(part0);
     shadowGenerator.getShadowMap().renderList.push(part1);
 
+
     // Playground
     var ground = BABYLON.Mesh.CreateBox("Ground", 1, scene);
     ground.scaling = new BABYLON.Vector3(100, 1, 100);

+ 62 - 0
Samples/Scenes/Customs/postprocessConvolution.js

@@ -0,0 +1,62 @@
+var CreateConvolutionTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
+    var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, -0.2), scene);
+    var light2 = new BABYLON.DirectionalLight("dir02", new BABYLON.Vector3(-1, 2, -1), scene);
+    light.position = new BABYLON.Vector3(0, 30, 0);
+    light2.position = new BABYLON.Vector3(10, 20, 10);
+
+    light.intensity = 0.6;
+    light2.intensity = 0.6;
+
+    camera.setPosition(new BABYLON.Vector3(-40, 40, 0));
+
+    // Skybox
+    var skybox = BABYLON.Mesh.CreateBox("skyBox", 500.0, scene);
+    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
+    skyboxMaterial.backFaceCulling = false;
+    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("Scenes/Customs/skybox/skybox", scene);
+    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
+    skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
+    skybox.material = skyboxMaterial;
+    skybox.infiniteDistance = true;
+        
+    // Spheres
+    var sphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 10, scene);
+    var sphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 10, scene);
+    var sphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 10, scene);
+    var cube = BABYLON.Mesh.CreateBox("Cube", 10.0, scene);
+
+    sphere0.material = new BABYLON.StandardMaterial("white", scene);
+    sphere0.material.diffuseColor = new BABYLON.Color3(0.5, 0.5, 1.0);
+    
+    sphere1.material = sphere0.material;
+    sphere2.material = sphere0.material;
+
+    sphere0.convertToFlatShadedMesh();
+    sphere1.convertToFlatShadedMesh();
+    sphere2.convertToFlatShadedMesh();
+    
+    cube.material = new BABYLON.StandardMaterial("red", scene);
+    cube.material.diffuseColor = new BABYLON.Color3(1.0, 0.5, 0.5);
+    cube.material.specularColor = new BABYLON.Color3(0, 0, 0);
+       
+    // Post-process
+    var postProcess = new BABYLON.ConvolutionPostProcess("convolution", BABYLON.ConvolutionPostProcess.EmbossKernel, 1.0, camera);
+    
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function() {
+        sphere0.position = new BABYLON.Vector3(20 * Math.sin(alpha), 0, 20 * Math.cos(alpha));
+        sphere1.position = new BABYLON.Vector3(20 * Math.sin(alpha), -20 * Math.cos(alpha), 0);
+        sphere2.position = new BABYLON.Vector3(0, 20 * Math.cos(alpha), 20 * Math.sin(alpha));
+
+        cube.rotation.y += 0.01;
+        cube.rotation.z += 0.01;
+
+        alpha += 0.05;
+    });
+    
+    return scene;
+};

+ 50 - 0
Samples/Scenes/Customs/shaders/cellShading.fragment.fx

@@ -0,0 +1,50 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Lights
+varying vec3 vPositionW;
+varying vec3 vNormalW;
+varying vec2 vUV;
+
+
+// Refs
+uniform float ToonThresholds[4];
+uniform float ToonBrightnessLevels[5];
+uniform vec3 vLightPosition;
+uniform vec3 vLightColor;
+
+uniform sampler2D textureSampler;
+
+void main(void) {
+	// Light
+	vec3 lightVectorW = normalize(vLightPosition - vPositionW);
+
+	// diffuse
+	float ndl = max(0., dot(vNormalW, lightVectorW));
+
+	vec3 color = texture2D(textureSampler, vUV).rgb * vLightColor;
+
+	if (ndl > ToonThresholds[0])
+	{
+		color *= ToonBrightnessLevels[0];
+	} 
+	else if (ndl > ToonThresholds[1])
+	{
+		color *= ToonBrightnessLevels[1];
+	}
+	else if (ndl > ToonThresholds[2])
+	{
+		color *= ToonBrightnessLevels[2];
+	}
+	else if (ndl > ToonThresholds[3])
+	{
+		color *= ToonBrightnessLevels[3];
+	}
+	else
+	{
+		color *= ToonBrightnessLevels[4];
+	}
+	
+	gl_FragColor = vec4(color, 1.);
+}

+ 27 - 0
Samples/Scenes/Customs/shaders/cellShading.vertex.fx

@@ -0,0 +1,27 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Attributes
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 uv;
+
+// Uniforms
+uniform mat4 world;
+uniform mat4 worldViewProjection;
+
+// Normal
+varying vec3 vPositionW;
+varying vec3 vNormalW;
+varying vec2 vUV;
+
+void main(void) {
+	vec4 outPosition = worldViewProjection * vec4(position, 1.0);
+	gl_Position = outPosition;
+	
+	vPositionW = vec3(world * vec4(position, 1.0));
+	vNormalW = normalize(vec3(world * vec4(normal, 0.0)));
+
+	vUV = uv;
+}

+ 8 - 1
Samples/Scenes/Customs/shadows.js

@@ -24,7 +24,7 @@
     // Ground
     var ground = BABYLON.Mesh.CreateGround("ground", 1000, 1000, 1, scene, false);
     var groundMaterial = new BABYLON.StandardMaterial("ground", scene);
-    groundMaterial.diffuseTexture = new BABYLON.Texture("assets/grass.jpg", scene);
+    groundMaterial.diffuseTexture = new BABYLON.Texture("/Assets/grass.jpg", scene);
     groundMaterial.diffuseTexture.uScale = 60;
     groundMaterial.diffuseTexture.vScale = 60;
     groundMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
@@ -37,6 +37,13 @@
     torus.position.y = 6.0;
     var torus2 = BABYLON.Mesh.CreateTorus("torus2", 4, 1, 32, scene, false);
     torus2.position.y = 6.0;
+
+    var torusMaterial = new BABYLON.StandardMaterial("torus", scene);
+    torusMaterial.diffuseTexture = new BABYLON.Texture("/Scenes/Customs/rocks.dds", scene);
+    torusMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    torusMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
+    torus.material = torusMaterial;
+    torus2.material = torusMaterial;
     
     // Shadows
     var shadowGenerator = new BABYLON.ShadowGenerator(512, light);

+ 4 - 0
Samples/Scenes/Customs/test.js

@@ -137,6 +137,10 @@
         spaceDek3.infiniteDistance = true;
 
         scene.beginAnimation(spaceDek3, 0, 100, true, 1.0);
+
+        // Test serialization
+        var serializationObject = BABYLON.SceneSerializer.Serialize(scene);
+        var string = JSON.stringify(serializationObject);
     });
 
     // Animations

二進制
Samples/Scenes/hillvalley/AlderBark.jpg


二進制
Samples/Scenes/hillvalley/AlderBranches.png


二進制
Samples/Scenes/hillvalley/Colonne simpleCompleteMap.jpg


二進制
Samples/Scenes/hillvalley/D1_delorean_seatDiffuseMap2.jpg


二進制
Samples/Scenes/hillvalley/D1_ext_cable_01 .jpg


二進制
Samples/Scenes/hillvalley/D1_ext_cable_02 .jpg


二進制
Samples/Scenes/hillvalley/D1_ext_cable_03 .jpg


二進制
Samples/Scenes/hillvalley/D1_ext_cable_grid .jpg


二進制
Samples/Scenes/hillvalley/D1_ext_cables_LM.jpg


二進制
Samples/Scenes/hillvalley/D1_ext_carrosserieDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/D1_ext_metal_01 .jpg


二進制
Samples/Scenes/hillvalley/D1_ext_neons_grid.png


二進制
Samples/Scenes/hillvalley/D1_ext_reactor_01DiffuseMap2.jpg


二進制
Samples/Scenes/hillvalley/D1_ext_wheelsAV_01DiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/D1_ext_wheelsAV_01_spec.png


二進制
Samples/Scenes/hillvalley/D1_porte_01DiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/D1_porte_02DiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/D1_vitre_ext_LM.jpg


二進制
Samples/Scenes/hillvalley/Fils.png


File diff suppressed because it is too large
+ 1 - 0
Samples/Scenes/hillvalley/HillValley.babylon


+ 5 - 0
Samples/Scenes/hillvalley/HillValley.babylon.manifest

@@ -0,0 +1,5 @@
+{
+	"version" : 3,
+	"enableSceneOffline" : true,
+	"enableTexturesOffline" : true
+}

二進制
Samples/Scenes/hillvalley/LampasoloDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/Parcmetre2CompleteMap.jpg


二進制
Samples/Scenes/hillvalley/PoteauDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/SycamoreLeaves5.png


二進制
Samples/Scenes/hillvalley/allstateDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/arbres_plan_04.png


二進制
Samples/Scenes/hillvalley/arbuste.png


二進制
Samples/Scenes/hillvalley/arbuste14_LM.jpg


二進制
Samples/Scenes/hillvalley/armstrongDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bancDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bank_of_nyDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bat_annexDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bat_arriereDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bat_arriere_02DiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/blue_birdDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/bois_peint_vert.jpg


二進制
Samples/Scenes/hillvalley/bouche_incendieDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/boutderueDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/branche_chene.png


二進制
Samples/Scenes/hillvalley/branche_liquidambar_alpha.png


二進制
Samples/Scenes/hillvalley/branche_morte.png


二進制
Samples/Scenes/hillvalley/brousaille_01.png


二進制
Samples/Scenes/hillvalley/brousaille_03.png


二進制
Samples/Scenes/hillvalley/buisson_LM.jpg


二進制
Samples/Scenes/hillvalley/cabane_boisDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/cattle_queenDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/charDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/coullons_bush.png


二進制
Samples/Scenes/hillvalley/courthouseDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/courthouse_vitre_01_LM.jpg


二進制
Samples/Scenes/hillvalley/courthouse_vitre_02_LM.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_nx.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_ny.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_nz.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_px.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_py.jpg


二進制
Samples/Scenes/hillvalley/cubmap_hhv_pz.jpg


二進制
Samples/Scenes/hillvalley/delorean_cables_int_LM.jpg


二進制
Samples/Scenes/hillvalley/delorean_convecteurDiffuseMap2.jpg


二進制
Samples/Scenes/hillvalley/delorean_convecteur_light_test.png


二進制
Samples/Scenes/hillvalley/delorean_plate_01 .jpg


二進制
Samples/Scenes/hillvalley/delorean_volantDiffuseMap2.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_nx.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_ny.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_nz.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_px.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_py.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapext_pz.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_nx.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_ny.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_nz.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_px.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_py.jpg


二進制
Samples/Scenes/hillvalley/delroean_cubmapint_pz.jpg


二進制
Samples/Scenes/hillvalley/dernier_bat_LM.jpg


二進制
Samples/Scenes/hillvalley/elite_barberDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/enduit03_c .jpg


二進制
Samples/Scenes/hillvalley/enduit04_b .jpg


二進制
Samples/Scenes/hillvalley/essexDiffuseMap.jpg


二進制
Samples/Scenes/hillvalley/feux_trico_LM.jpg


二進制
Samples/Scenes/hillvalley/feux_tricolor .jpg


二進制
Samples/Scenes/hillvalley/florigoldDiffuseMap.jpg


+ 0 - 0
Samples/Scenes/hillvalley/fond_mountain.png


Some files were not shown because too many files changed in this diff