deltakosh 12 лет назад
Родитель
Сommit
d25a4e4e95
100 измененных файлов с 466 добавлено и 21 удалено
  1. 8 0
      Babylon/Materials/babylon.effect.js
  2. 2 2
      Babylon/Materials/textures/babylon.dynamicTexture.js
  3. 2 2
      Babylon/Materials/textures/babylon.mirrorTexture.js
  4. 6 6
      Babylon/Materials/textures/babylon.renderTargetTexture.js
  5. 7 2
      Babylon/Materials/textures/babylon.texture.js
  6. 2 2
      Babylon/Materials/textures/babylon.videoTexture.js
  7. 1 0
      Babylon/Mesh/babylon.mesh.js
  8. 6 1
      Babylon/Shaders/default.vertex.fx
  9. 2 2
      Babylon/Sprites/babylon.spriteManager.js
  10. 31 3
      Babylon/babylon.engine.js
  11. 1 1
      Babylon/babylon.scene.js
  12. BIN
      Samples/Assets/BandeauEmbleme.png
  13. BIN
      Samples/Assets/Bandeauhaut.png
  14. BIN
      Samples/Assets/BtnAbout.png
  15. BIN
      Samples/Assets/BtnDownload.png
  16. BIN
      Samples/Assets/Download.png
  17. BIN
      Samples/Assets/Flare.png
  18. BIN
      Samples/Assets/Layer0_0.png
  19. BIN
      Samples/Assets/Layer1_0.png
  20. BIN
      Samples/Assets/Layer2_0.png
  21. BIN
      Samples/Assets/Logo.png
  22. BIN
      Samples/Assets/MonsterARun.png
  23. BIN
      Samples/Assets/Player.png
  24. BIN
      Samples/Assets/SpotDown.png
  25. BIN
      Samples/Assets/SpotLast.png
  26. BIN
      Samples/Assets/Tree.png
  27. BIN
      Samples/Assets/gradient.png
  28. BIN
      Samples/Assets/kosh.jpg
  29. BIN
      Samples/Scenes/Blender/63_Free_Windows_Xp_Vista_Wallpapers.jpg
  30. BIN
      Samples/Scenes/Blender/69_Free_Windows_Xp_Vista_Wallpapers.jpg
  31. BIN
      Samples/Scenes/Blender/Ciel.png
  32. BIN
      Samples/Scenes/Blender/Finishes.Plaster.Stucco.Fine.Mauve.jpg
  33. BIN
      Samples/Scenes/Blender/MS-384.jpg
  34. BIN
      Samples/Scenes/Blender/Tree.png
  35. BIN
      Samples/Scenes/Blender/WP_20121206_003.jpg
  36. 7 0
      Samples/Scenes/Blender/blender.babylon
  37. BIN
      Samples/Scenes/Blender/new-york1-1600-1200.jpg
  38. BIN
      Samples/Scenes/Blender/skin.png
  39. BIN
      Samples/Scenes/Blender/snow.jpg
  40. BIN
      Samples/Scenes/Blender/test_vase_color.jpg
  41. BIN
      Samples/Scenes/Blender/tyrol_austria___misty_mountain_village-1600x1200.jpg
  42. 11 0
      Samples/Scenes/Blender/untitled.babylon
  43. BIN
      Samples/Scenes/Blender/vase_test1.png
  44. 20 0
      Samples/Scenes/Customs/bump_test.js
  45. 40 0
      Samples/Scenes/Customs/fog_test.js
  46. 75 0
      Samples/Scenes/Customs/lights_test.js
  47. 40 0
      Samples/Scenes/Customs/multimat.js
  48. BIN
      Samples/Scenes/Customs/normalMap.jpg
  49. BIN
      Samples/Scenes/Customs/skybox/skybox_nx.jpg
  50. BIN
      Samples/Scenes/Customs/skybox/skybox_ny.jpg
  51. BIN
      Samples/Scenes/Customs/skybox/skybox_nz.jpg
  52. BIN
      Samples/Scenes/Customs/skybox/skybox_px.jpg
  53. BIN
      Samples/Scenes/Customs/skybox/skybox_py.jpg
  54. BIN
      Samples/Scenes/Customs/skybox/skybox_pz.jpg
  55. 205 0
      Samples/Scenes/Customs/test.js
  56. BIN
      Samples/Scenes/Espilit/Blanc.png
  57. BIN
      Samples/Scenes/Espilit/Booklet.png
  58. BIN
      Samples/Scenes/Espilit/BouteilleBlanc.png
  59. BIN
      Samples/Scenes/Espilit/BouteilleRouge.png
  60. BIN
      Samples/Scenes/Espilit/ChaisesLightingMap.png
  61. BIN
      Samples/Scenes/Espilit/ChaisesSpecMap.png
  62. BIN
      Samples/Scenes/Espilit/Chassis table CorbuLightingMap.png
  63. BIN
      Samples/Scenes/Espilit/Ciel.png
  64. BIN
      Samples/Scenes/Espilit/Cuir.png
  65. BIN
      Samples/Scenes/Espilit/Depliant.png
  66. BIN
      Samples/Scenes/Espilit/DepliantLightingMap.png
  67. BIN
      Samples/Scenes/Espilit/Expo1.png
  68. BIN
      Samples/Scenes/Espilit/Expo2.png
  69. BIN
      Samples/Scenes/Espilit/GravierDiff.png
  70. BIN
      Samples/Scenes/Espilit/Line01CompMap.png
  71. BIN
      Samples/Scenes/Espilit/Line01LightingMap.png
  72. BIN
      Samples/Scenes/Espilit/Metal NoirLightingMap.png
  73. BIN
      Samples/Scenes/Espilit/Murs pansLightingMap.png
  74. BIN
      Samples/Scenes/Espilit/MursLightingMap.png
  75. BIN
      Samples/Scenes/Espilit/Plaques Faux PlafondsLightingMap.png
  76. BIN
      Samples/Scenes/Espilit/PlaquesPlafond.png
  77. BIN
      Samples/Scenes/Espilit/Refcube_nx.jpg
  78. BIN
      Samples/Scenes/Espilit/Refcube_ny.jpg
  79. BIN
      Samples/Scenes/Espilit/Refcube_nz.jpg
  80. BIN
      Samples/Scenes/Espilit/Refcube_px.jpg
  81. BIN
      Samples/Scenes/Espilit/Refcube_py.jpg
  82. BIN
      Samples/Scenes/Espilit/Refcube_pz.jpg
  83. BIN
      Samples/Scenes/Espilit/Refcubenoire_nx.jpg
  84. BIN
      Samples/Scenes/Espilit/Refcubenoire_ny.jpg
  85. BIN
      Samples/Scenes/Espilit/Refcubenoire_nz.jpg
  86. BIN
      Samples/Scenes/Espilit/Refcubenoire_px.jpg
  87. BIN
      Samples/Scenes/Espilit/Refcubenoire_py.jpg
  88. BIN
      Samples/Scenes/Espilit/Refcubenoire_pz.jpg
  89. BIN
      Samples/Scenes/Espilit/Refsol.png
  90. BIN
      Samples/Scenes/Espilit/Rochers.png
  91. BIN
      Samples/Scenes/Espilit/Rouge.png
  92. BIN
      Samples/Scenes/Espilit/Sol.png
  93. BIN
      Samples/Scenes/Espilit/SolsLightingMap.png
  94. BIN
      Samples/Scenes/Espilit/Spec.png
  95. BIN
      Samples/Scenes/Espilit/T33LightingMap.png
  96. BIN
      Samples/Scenes/Espilit/TableauxDiffuseMap.png
  97. BIN
      Samples/Scenes/Espilit/Tables bonettoLightingMap.png
  98. BIN
      Samples/Scenes/Espilit/Tapis.png
  99. BIN
      Samples/Scenes/Espilit/Toile.png
  100. 0 0
      Samples/Scenes/Espilit/Tree.png

+ 8 - 0
Babylon/Materials/babylon.effect.js

@@ -123,6 +123,14 @@
         this._engine.setVector3(this.getUniform(uniformName), vector3);
     };
     
+    BABYLON.Effect.prototype.setFloat2 = function (uniformName, x, y) {
+        if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y)
+            return;
+
+        this._valueCache[uniformName] = [x, y];
+        this._engine.setFloat2(this.getUniform(uniformName), x, y);
+    };
+    
     BABYLON.Effect.prototype.setFloat3 = function (uniformName, x, y, z) {
         if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y && this._valueCache[uniformName][2] == z)
             return;

+ 2 - 2
Babylon/Materials/textures/babylon.dynamicTexture.js

@@ -7,8 +7,8 @@
 
         this.name = name;
 
-        this.wrapU = false;
-        this.wrapV = false;
+        this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
+        this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
 
         this._texture = scene.getEngine().createDynamicTexture(size, generateMipMaps);
         var textureSize = this.getSize();

+ 2 - 2
Babylon/Materials/textures/babylon.mirrorTexture.js

@@ -16,7 +16,7 @@
     BABYLON.MirrorTexture.prototype.mirrorPlane = new BABYLON.Plane(0, 1, 0, 1);
     
     // Method
-    BABYLON.MirrorTexture.prototype._onBeforeRender = function () {
+    BABYLON.MirrorTexture.prototype.onBeforeRender = function () {
         var scene = this._scene;
 
         var mirrorMatrix = BABYLON.Matrix.Reflection(this.mirrorPlane);
@@ -29,7 +29,7 @@
         scene.getEngine().cullBackFaces = false;
     };
 
-    BABYLON.MirrorTexture.prototype._onAfterRender = function () {
+    BABYLON.MirrorTexture.prototype.onAfterRender = function () {
         var scene = this._scene;
 
         scene.setTransformMatrix(this._savedViewMatrix, scene.getProjectionMatrix());

+ 6 - 6
Babylon/Materials/textures/babylon.renderTargetTexture.js

@@ -18,12 +18,12 @@
     BABYLON.RenderTargetTexture.prototype.coordinatesMode = BABYLON.Texture.PROJECTION_MODE;
 
     // Methods  
-    BABYLON.RenderTargetTexture.prototype._onBeforeRender = null;
-    BABYLON.RenderTargetTexture.prototype._onAfterRender = null;
+    BABYLON.RenderTargetTexture.prototype.onBeforeRender = null;
+    BABYLON.RenderTargetTexture.prototype.onAfterRender = null;
     
     BABYLON.RenderTargetTexture.prototype.render = function () {
-        if (this._onBeforeRender) {
-            this._onBeforeRender();
+        if (this.onBeforeRender) {
+            this.onBeforeRender();
         }
 
         var scene = this._scene;
@@ -81,8 +81,8 @@
         // Unbind
         engine.unBindFramebuffer(this._texture);
         
-        if (this._onAfterRender) {
-            this._onAfterRender();
+        if (this.onAfterRender) {
+            this.onAfterRender();
         }
     };
 

+ 7 - 2
Babylon/Materials/textures/babylon.texture.js

@@ -25,6 +25,11 @@
     BABYLON.Texture.PLANAR_MODE = 2;
     BABYLON.Texture.CUBIC_MODE = 3;
     BABYLON.Texture.PROJECTION_MODE = 4;
+    BABYLON.Texture.SKYBOX_MODE = 5;
+    
+    BABYLON.Texture.CLAMP_ADDRESSMODE = 0;
+    BABYLON.Texture.WRAP_ADDRESSMODE = 1;
+    BABYLON.Texture.MIRROR_ADDRESSMODE = 2;
 
     // Members
     BABYLON.Texture.prototype.uOffset = 0;
@@ -34,8 +39,8 @@
     BABYLON.Texture.prototype.uAng = 0;
     BABYLON.Texture.prototype.vAng = 0;
     BABYLON.Texture.prototype.wAng = 0;
-    BABYLON.Texture.prototype.wrapU = true;
-    BABYLON.Texture.prototype.wrapV = true;
+    BABYLON.Texture.prototype.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
+    BABYLON.Texture.prototype.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
     BABYLON.Texture.prototype.coordinatesIndex = 0;
     BABYLON.Texture.prototype.coordinatesMode = BABYLON.Texture.EXPLICIT_MODE;
 

+ 2 - 2
Babylon/Materials/textures/babylon.videoTexture.js

@@ -7,8 +7,8 @@
 
         this.name = name;
 
-        this.wrapU = false;
-        this.wrapV = false;
+        this.wrapU = BABYLON.Texture.REPEAT_CLAMPMODE;
+        this.wrapV = BABYLON.Texture.REPEAT_CLAMPMODE;
 
         this._texture = scene.getEngine().createDynamicTexture(size, generateMipMaps);
         var textureSize = this.getSize();

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

@@ -53,6 +53,7 @@
     BABYLON.Mesh.prototype.parent = null;
     BABYLON.Mesh.prototype._isEnabled = true;
     BABYLON.Mesh.prototype.isVisible = true;
+    BABYLON.Mesh.prototype.isPickable = true;
     BABYLON.Mesh.prototype.visibility = 1.0;
     BABYLON.Mesh.prototype.billboardMode = BABYLON.Mesh.BILLBOARDMODE_NONE;
     BABYLON.Mesh.prototype.checkCollisions = false;

+ 6 - 1
Babylon/Shaders/default.vertex.fx

@@ -3,6 +3,7 @@
 #define MAP_PLANAR		2.
 #define MAP_CUBIC		3.
 #define MAP_PROJECTION	4.
+#define MAP_SKYBOX		5.
 
 // Attributes
 attribute vec3 position;
@@ -96,12 +97,16 @@ vec3 computeReflectionCoords(float mode, vec4 worldPos, vec3 worldNormal)
 		vec3 viewDir = worldPos.xyz - vEyePosition;
 		vec3 coords = reflect(viewDir, worldNormal);
 
-		return vec3(reflectionMatrix * vec4(coords, 0));	
+		return vec3(reflectionMatrix * vec4(coords, 0));
 	}
 	else if (mode == MAP_PROJECTION)
 	{
 		return vec3(reflectionMatrix * (view * worldPos));
 	}
+	else if (mode == MAP_SKYBOX)
+	{
+		return position;
+	}
 
 	return vec3(0, 0, 0);
 }

+ 2 - 2
Babylon/Sprites/babylon.spriteManager.js

@@ -36,8 +36,8 @@
         this._capacity = capacity;
         this.cellSize = cellSize;
         this._spriteTexture = new BABYLON.Texture(imgUrl, scene, true, false);
-        this._spriteTexture.wrapU = false;
-        this._spriteTexture.wrapV = false;
+        this._spriteTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
+        this._spriteTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
         this._epsilon = epsilon === undefined ? 0.01 : epsilon;
 
         this._scene = scene;

+ 31 - 3
Babylon/babylon.engine.js

@@ -27,7 +27,7 @@
         this._workingContext = this._workingCanvas.getContext("2d");
 
         // Viewport
-        this._hardwareScalingLevel = 1.0;
+        this._hardwareScalingLevel = 1.0 / window.devicePixelRatio || 1.0
         this.resize();
 
         // Caps
@@ -380,6 +380,13 @@
         this._gl.uniform3f(uniform, vector3.x, vector3.y, vector3.z);
     };
     
+    BABYLON.Engine.prototype.setFloat2 = function (uniform, x, y) {
+        if (!uniform)
+            return;
+
+        this._gl.uniform2f(uniform, x, y);
+    };
+    
     BABYLON.Engine.prototype.setFloat3 = function (uniform, x, y, z) {
         if (!uniform)
             return;
@@ -785,12 +792,33 @@
 
             if (internalTexture._cachedWrapU !== texture.wrapU) {
                 internalTexture._cachedWrapU = texture.wrapU;
-                this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, texture.wrapU ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE);
+
+                switch (texture.wrapU) {
+                    case BABYLON.Texture.WRAP_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT);
+                        break;
+                    case BABYLON.Texture.CLAMP_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);
+                        break;
+                    case BABYLON.Texture.MIRROR_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.MIRRORED_REPEAT);
+                        break;
+                }
             }
 
             if (internalTexture._cachedWrapV !== texture.wrapV) {
                 internalTexture._cachedWrapV = texture.wrapV;
-                this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, texture.wrapV ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE);
+                switch (texture.wrapV) {
+                    case BABYLON.Texture.WRAP_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT);
+                        break;
+                    case BABYLON.Texture.CLAMP_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);
+                        break;
+                    case BABYLON.Texture.MIRROR_ADDRESSMODE:
+                        this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.MIRRORED_REPEAT);
+                        break;
+                }
             }
         }
     };

+ 1 - 1
Babylon/babylon.scene.js

@@ -632,7 +632,7 @@
         for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {
             var mesh = this.meshes[meshIndex];
 
-            if (!mesh.isEnabled() || !mesh.isVisible) {
+            if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
                 continue;
             }
 

BIN
Samples/Assets/BandeauEmbleme.png


BIN
Samples/Assets/Bandeauhaut.png


BIN
Samples/Assets/BtnAbout.png


BIN
Samples/Assets/BtnDownload.png


BIN
Samples/Assets/Download.png


BIN
Samples/Assets/Flare.png


BIN
Samples/Assets/Layer0_0.png


BIN
Samples/Assets/Layer1_0.png


BIN
Samples/Assets/Layer2_0.png


BIN
Samples/Assets/Logo.png


BIN
Samples/Assets/MonsterARun.png


BIN
Samples/Assets/Player.png


BIN
Samples/Assets/SpotDown.png


BIN
Samples/Assets/SpotLast.png


BIN
Samples/Assets/Tree.png


BIN
Samples/Assets/gradient.png


BIN
Samples/Assets/kosh.jpg


BIN
Samples/Scenes/Blender/63_Free_Windows_Xp_Vista_Wallpapers.jpg


BIN
Samples/Scenes/Blender/69_Free_Windows_Xp_Vista_Wallpapers.jpg


BIN
Samples/Scenes/Blender/Ciel.png


BIN
Samples/Scenes/Blender/Finishes.Plaster.Stucco.Fine.Mauve.jpg


BIN
Samples/Scenes/Blender/MS-384.jpg


BIN
Samples/Scenes/Blender/Tree.png


BIN
Samples/Scenes/Blender/WP_20121206_003.jpg


Разница между файлами не показана из-за своего большого размера
+ 7 - 0
Samples/Scenes/Blender/blender.babylon


BIN
Samples/Scenes/Blender/new-york1-1600-1200.jpg


BIN
Samples/Scenes/Blender/skin.png


BIN
Samples/Scenes/Blender/snow.jpg


BIN
Samples/Scenes/Blender/test_vase_color.jpg


BIN
Samples/Scenes/Blender/tyrol_austria___misty_mountain_village-1600x1200.jpg


Разница между файлами не показана из-за своего большого размера
+ 11 - 0
Samples/Scenes/Blender/untitled.babylon


BIN
Samples/Scenes/Blender/vase_test1.png


+ 20 - 0
Samples/Scenes/Customs/bump_test.js

@@ -0,0 +1,20 @@
+var CreateBumpScene = 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.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
+    var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
+    var material = new BABYLON.StandardMaterial("kosh", scene);
+    material.bumpTexture = new BABYLON.Texture("Scenes/Customs/normalMap.jpg", scene);
+    material.diffuseColor = new BABYLON.Color3(1, 0, 0);
+    
+    sphere.material = material;
+    
+    camera.setPosition(new BABYLON.Vector3(-5, 5, 0));
+
+    // Animations
+    scene.registerBeforeRender(function() {
+        sphere.rotation.y += 0.02;
+    });
+
+    return scene;
+};

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

@@ -0,0 +1,40 @@
+var CreateFogScene = function(engine) {
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 0, -20), scene);
+    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
+    var sphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 3, scene);
+    var sphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 3, scene);
+    var sphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 3, scene);
+
+    var material0 = new BABYLON.StandardMaterial("mat0", scene);
+    material0.diffuseColor = new BABYLON.Color3(1, 0, 0);
+    sphere0.material = material0;
+    sphere0.position = new BABYLON.Vector3(-10, 0, 0);
+
+    var material1 = new BABYLON.StandardMaterial("mat1", scene);
+    material1.diffuseColor = new BABYLON.Color3(1, 1, 0);
+    sphere1.material = material1;
+
+    var material2 = new BABYLON.StandardMaterial("mat2", scene);
+    material2.diffuseColor = new BABYLON.Color3(1, 0, 1);
+    sphere2.material = material2;
+    sphere2.position = new BABYLON.Vector3(10, 0, 0);
+    
+    camera.setTarget(new BABYLON.Vector3(0, 0, 0));
+    
+    // Fog
+    scene.fogMode = BABYLON.Scene.FOGMODE_EXP;
+    scene.fogDensity = 0.1;
+
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function () {
+        sphere0.position.z = 4 * Math.cos(alpha);
+        sphere1.position.z = 4 * Math.sin(alpha);
+        sphere2.position.z = 4 * Math.cos(alpha);
+
+        alpha += 0.1;
+    });
+
+    return scene;
+};

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

@@ -0,0 +1,75 @@
+var CreateLightsTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
+    var light0 = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(0, 10, 0), scene);
+    var light1 = new BABYLON.PointLight("Omni1", new BABYLON.Vector3(0, -10, 0), scene);
+    var light2 = new BABYLON.PointLight("Omni2", new BABYLON.Vector3(10, 0, 0), scene);
+    var light3 = new BABYLON.DirectionalLight("Dir0", new BABYLON.Vector3(1, -1, 0), scene);
+    var material = new BABYLON.StandardMaterial("kosh", scene);
+    var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
+
+    camera.setPosition(new BABYLON.Vector3(-10, 10, 0));
+    
+    // Creating light sphere
+    var lightSphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 0.5, scene);
+    var lightSphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 0.5, scene);
+    var lightSphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 0.5, scene);
+    
+    lightSphere0.material = new BABYLON.StandardMaterial("red", scene);
+    lightSphere0.material.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere0.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere0.material.emissiveColor = new BABYLON.Color3(1, 0, 0);
+
+    lightSphere1.material = new BABYLON.StandardMaterial("green", scene);
+    lightSphere1.material.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere1.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere1.material.emissiveColor = new BABYLON.Color3(0, 1, 0);
+
+    lightSphere2.material = new BABYLON.StandardMaterial("blue", scene);
+    lightSphere2.material.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere2.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    lightSphere2.material.emissiveColor = new BABYLON.Color3(0, 0, 1);
+
+    // Sphere material
+    material.diffuseColor = new BABYLON.Color3(1, 1, 1);
+    sphere.material = material;
+
+    // Lights colors
+    light0.diffuse = new BABYLON.Color3(1, 0, 0);
+    light0.specular = new BABYLON.Color3(1, 0, 0);
+    
+    light1.diffuse = new BABYLON.Color3(0, 1, 0);
+    light1.specular = new BABYLON.Color3(0, 1, 0);
+    
+    light2.diffuse = new BABYLON.Color3(0, 0, 1);
+    light2.specular = new BABYLON.Color3(0, 0, 1);
+    
+    light3.diffuse = new BABYLON.Color3(1, 1, 1);
+    light3.specular = new BABYLON.Color3(1, 1, 1);
+    
+    // Skybox
+    var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.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;
+
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function () {
+        light0.position = new BABYLON.Vector3(10 * Math.sin(alpha), 0, 10 * Math.cos(alpha));
+        light1.position = new BABYLON.Vector3(10 * Math.sin(alpha), 0, -10 * Math.cos(alpha));
+        light2.position = new BABYLON.Vector3(10 * Math.cos(alpha), 0, 10 * Math.sin(alpha));
+
+        lightSphere0.position = light0.position;
+        lightSphere1.position = light1.position;
+        lightSphere2.position = light2.position;
+
+        alpha += 0.01;
+    });
+
+    return scene;
+};

+ 40 - 0
Samples/Scenes/Customs/multimat.js

@@ -0,0 +1,40 @@
+var CreateMultiMaterialScene = 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.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
+    
+
+    var material0 = new BABYLON.StandardMaterial("mat0", scene);
+    material0.diffuseColor = new BABYLON.Color3(1, 0, 0);
+    material0.bumpTexture = new BABYLON.Texture("Scenes/Customs/normalMap.jpg", scene);
+    
+    var material1 = new BABYLON.StandardMaterial("mat1", scene);
+    material1.diffuseColor = new BABYLON.Color3(0, 0, 1);
+    
+    var material2 = new BABYLON.StandardMaterial("mat2", scene);
+    material2.emissiveColor = new BABYLON.Color3(0.4, 0, 0.4);
+
+    var multimat = new BABYLON.MultiMaterial("multi", scene);
+    multimat.subMaterials.push(material0);
+    multimat.subMaterials.push(material1);
+    multimat.subMaterials.push(material2);
+
+    var sphere = BABYLON.Mesh.CreateSphere("Sphere0", 16, 3, scene);
+    sphere.material = multimat;
+
+    sphere.subMeshes = [];
+    var verticesCount = sphere.getTotalVertices();
+    
+    sphere.subMeshes.push(new BABYLON.SubMesh(0, 0, verticesCount, 0, 900, sphere));
+    sphere.subMeshes.push(new BABYLON.SubMesh(1, 0, verticesCount, 900, 900, sphere));
+    sphere.subMeshes.push(new BABYLON.SubMesh(2, 0, verticesCount, 1800, 2088, sphere));
+
+    camera.setPosition(new BABYLON.Vector3(-3, 3, 0));
+    
+    // Animations
+    scene.registerBeforeRender(function () {
+        sphere.rotation.y += 0.01;
+    });
+
+    return scene;
+};

BIN
Samples/Scenes/Customs/normalMap.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_nx.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_ny.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_nz.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_px.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_py.jpg


BIN
Samples/Scenes/Customs/skybox/skybox_pz.jpg


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

@@ -0,0 +1,205 @@
+var CreateTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    //var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 10, BABYLON.Vector3.Zero(), scene);
+    var camera2 = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 0, -10), scene);
+    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
+    var material = new BABYLON.StandardMaterial("kosh", scene);
+    var material2 = new BABYLON.StandardMaterial("kosh transparent", scene);
+    var planeMaterial = new BABYLON.StandardMaterial("plane material", scene);
+    var box = BABYLON.Mesh.CreateBox("Box", 1.0, scene);
+    var box2 = BABYLON.Mesh.CreateBox("Box2", 1.2, scene);
+    var box3 = BABYLON.Mesh.CreateBox("Box3", 0.8, scene);
+    var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
+    var plane = BABYLON.Mesh.CreatePlane("plane", 3, scene);
+
+    //material.diffuseColor = new BABYLON.Color3(0, 0, 1);
+    material.diffuseTexture = new BABYLON.Texture("Assets/Tree.png", scene);
+    material.diffuseTexture.hasAlpha = true;
+    material.backFaceCulling = false;
+    material2.diffuseTexture = new BABYLON.Texture("Assets/kosh.jpg", scene);
+    material2.alpha = 0.5;
+    material2.backFaceCulling = false;
+    planeMaterial.backFaceCulling = false;
+    var planeTexture = new BABYLON.DynamicTexture("dynamic texture", 512, scene, true);
+    planeTexture.hasAlpha = true;
+    planeMaterial.diffuseTexture = planeTexture;
+    plane.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL;
+
+    box.material = material;
+    box2.material = material;
+    box3.material = material2;
+    sphere.material = material;
+    plane.material = planeMaterial;
+    box2.position.x += 13;
+    box3.position.x -= 3;
+    box3.parent = sphere;
+    sphere.position.z = 3;
+    plane.position = new BABYLON.Vector3(0, 7, 0);
+
+    // Particles
+    var particleSystem = new BABYLON.ParticleSystem("particles", 4000, scene);
+    particleSystem.particleTexture = new BABYLON.Texture("Assets/Flare.png", scene);
+    particleSystem.minAngularSpeed = -0.5;
+    particleSystem.maxAngularSpeed = 0.5;
+    particleSystem.minSize = 0.5;
+    particleSystem.maxSize = 1.0;
+    particleSystem.minLifeTime = 0.5;
+    particleSystem.maxLifeTime = 1.0;
+    particleSystem.emitter = box3;
+    particleSystem.emitRate = 300;
+    particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE;
+    particleSystem.minEmitBox = new BABYLON.Vector3(0, 0.1, 0);
+    particleSystem.maxEmitBox = new BABYLON.Vector3(0, -0.1, 0);
+    particleSystem.gravity = new BABYLON.Vector3(0, -0.5, 0);
+    particleSystem.start();
+
+    // Mirror
+    var mirror = BABYLON.Mesh.CreateBox("Mirror", 1.0, scene);
+    mirror.scaling = new BABYLON.Vector3(100.0, 0.01, 100.0);
+    mirror.material = new BABYLON.StandardMaterial("mirror", scene);
+    mirror.material.diffuseColor = new BABYLON.Color3(0.4, 0.4, 0.4);
+    mirror.material.reflectionTexture = new BABYLON.MirrorTexture("mirror", 512, scene, true);
+    mirror.material.reflectionTexture.mirrorPlane = new BABYLON.Plane(0, -1.0, 0, -5.0);
+    mirror.material.reflectionTexture.renderList = [box, box2, box3, sphere];
+    mirror.material.reflectionTexture.level = 0.5;
+    mirror.position = new BABYLON.Vector3(0, -5.0, 0);
+
+    // Sprites
+    var spriteManager = new BABYLON.SpriteManager("MonsterA", "Assets/Player.png", 500, 64, scene);
+    for (var index = 0; index < 500; index++) {
+        var sprite = new BABYLON.Sprite("toto", spriteManager);
+        sprite.position.y = -4.5;
+        sprite.position.z = Math.random() * 20 - 10;
+        sprite.position.x = Math.random() * 20 - 10;
+        sprite.dir = Math.round(Math.random()) * 2 - 1;
+        sprite.invertU = (sprite.dir < 0);
+
+        sprite.playAnimation(0, 9, true, 100);
+
+        sprite.color = new BABYLON.Color4(1, 0, 0, 1);
+    }
+    
+    // Backgrounds
+    var background0 = new BABYLON.Layer("back0", "Assets/Layer0_0.png", scene);
+    var background1 = new BABYLON.Layer("back1", "Assets/Layer1_0.png", scene);
+    var foreground = new BABYLON.Layer("back0", "Assets/Layer2_0.png", scene, true, new BABYLON.Color4(1, 0, 0, 1));
+    
+    // Import
+    var spaceDek;
+    BABYLON.SceneLoader.ImportMesh("Vaisseau", "Scenes/SpaceDek/", "SpaceDek.babylon", scene, function (newMeshes, particleSystems) {
+        spaceDek = newMeshes[0];
+        for (var index = 0; index < newMeshes.length; index++) {
+            mirror.material.reflectionTexture.renderList.push(newMeshes[index]);
+        }
+
+        spaceDek.position = new BABYLON.Vector3(0, 20, 0);
+        spaceDek.scaling = new BABYLON.Vector3(0.3, 0.3, 0.3);
+    });
+
+    var spaceDek2;
+    var spaceDek3;
+    BABYLON.SceneLoader.ImportMesh("Vaisseau", "Scenes/SpaceDek/", "SpaceDek.babylon", scene, function (newMeshes) {
+        spaceDek2 = newMeshes[0];
+        spaceDek2.name = "Vaisseau 2";
+        for (var index = 0; index < newMeshes.length; index++) {
+            mirror.material.reflectionTexture.renderList.push(newMeshes[index]);
+        }
+
+        spaceDek2.position = new BABYLON.Vector3(40, 20, 0);
+        spaceDek2.scaling = new BABYLON.Vector3(0.3, 0.3, 0.3);
+
+        // Clone
+        spaceDek3 = spaceDek2.clone("Vaisseau 3");
+        spaceDek3.position = new BABYLON.Vector3(-50, 20, 0);
+        spaceDek3.scaling = new BABYLON.Vector3(0.3, 0.3, 0.3);
+        mirror.material.reflectionTexture.renderList.push(spaceDek3);
+        var children = spaceDek3.getDescendants();
+        for (var index = 0; index < children.length; index++) {
+            mirror.material.reflectionTexture.renderList.push(children[index]);
+        }
+
+        scene.beginAnimation(spaceDek3, 0, 100, true, 1.0);
+    });
+
+    // Animations
+    var alpha = 0;
+    var frameCount = 0;
+    var reloop = 0;
+    var startDate = new Date();
+    var count = 0;
+    scene.registerBeforeRender(function () {
+        box.rotation.y += 0.01;
+        box2.rotation.x += 0.01;
+        sphere.rotation.y += 0.02;
+        //  box3.scaling.y = 1 + Math.cos(alpha);
+        box3.rotation.z += 0.01;
+        alpha += 0.01;
+
+        if (spaceDek) {
+            spaceDek.rotation.y += 0.01;
+        }
+
+        if (spaceDek2) {
+            spaceDek2.rotation.y -= 0.01;
+        }
+
+        if (spaceDek3) {
+            spaceDek3.rotation.y -= 0.01;
+        }
+        
+        if (box3.intersectsMesh(box)) {
+            material2.alpha = 1;
+            box3.scaling = new BABYLON.Vector3(2, 2, 2);
+        } else {
+            material2.alpha = 0.5;
+            box3.scaling = new BABYLON.Vector3(1, 1, 1);
+        }
+
+        // Sprites
+        frameCount++;
+        if (frameCount > 3) {
+            frameCount = 0;
+            reloop++;
+            for (var index = 0; index < spriteManager.sprites.length; index++) {
+                var sprite = spriteManager.sprites[index];
+                sprite.position.x -= 0.1 * sprite.dir;
+
+                if (reloop > 20) {
+                    sprite.dir *= -1;
+                    sprite.invertU = !sprite.invertU;
+                }
+            }
+
+            if (reloop > 20) {
+                reloop = 0;
+            }
+        }
+        
+        // Update dynamic texture
+        var diff = (new Date() - startDate);
+        
+        if (diff > 200) {
+            startDate = new Date();
+
+            var textureContext = planeTexture.getContext();
+            var size = planeTexture.getSize();
+            var text = count.toString();
+
+            textureContext.clearRect(0, 0, size.width, size.height);
+
+            textureContext.font = "bold 120px Calibri";
+            var textSize = textureContext.measureText(text);
+            textureContext.fillStyle = "white";
+            textureContext.fillText(text, (size.width - textSize.width) / 2, (size.height - 120) / 2);
+
+            planeTexture.update();
+
+            count++;
+        }
+        
+        // Background
+        background0.texture.uOffset += 0.001;
+    });
+
+    return scene;
+};

BIN
Samples/Scenes/Espilit/Blanc.png


BIN
Samples/Scenes/Espilit/Booklet.png


BIN
Samples/Scenes/Espilit/BouteilleBlanc.png


BIN
Samples/Scenes/Espilit/BouteilleRouge.png


BIN
Samples/Scenes/Espilit/ChaisesLightingMap.png


BIN
Samples/Scenes/Espilit/ChaisesSpecMap.png


BIN
Samples/Scenes/Espilit/Chassis table CorbuLightingMap.png


BIN
Samples/Scenes/Espilit/Ciel.png


BIN
Samples/Scenes/Espilit/Cuir.png


BIN
Samples/Scenes/Espilit/Depliant.png


BIN
Samples/Scenes/Espilit/DepliantLightingMap.png


BIN
Samples/Scenes/Espilit/Expo1.png


BIN
Samples/Scenes/Espilit/Expo2.png


BIN
Samples/Scenes/Espilit/GravierDiff.png


BIN
Samples/Scenes/Espilit/Line01CompMap.png


BIN
Samples/Scenes/Espilit/Line01LightingMap.png


BIN
Samples/Scenes/Espilit/Metal NoirLightingMap.png


BIN
Samples/Scenes/Espilit/Murs pansLightingMap.png


BIN
Samples/Scenes/Espilit/MursLightingMap.png


BIN
Samples/Scenes/Espilit/Plaques Faux PlafondsLightingMap.png


BIN
Samples/Scenes/Espilit/PlaquesPlafond.png


BIN
Samples/Scenes/Espilit/Refcube_nx.jpg


BIN
Samples/Scenes/Espilit/Refcube_ny.jpg


BIN
Samples/Scenes/Espilit/Refcube_nz.jpg


BIN
Samples/Scenes/Espilit/Refcube_px.jpg


BIN
Samples/Scenes/Espilit/Refcube_py.jpg


BIN
Samples/Scenes/Espilit/Refcube_pz.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_nx.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_ny.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_nz.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_px.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_py.jpg


BIN
Samples/Scenes/Espilit/Refcubenoire_pz.jpg


BIN
Samples/Scenes/Espilit/Refsol.png


BIN
Samples/Scenes/Espilit/Rochers.png


BIN
Samples/Scenes/Espilit/Rouge.png


BIN
Samples/Scenes/Espilit/Sol.png


BIN
Samples/Scenes/Espilit/SolsLightingMap.png


BIN
Samples/Scenes/Espilit/Spec.png


BIN
Samples/Scenes/Espilit/T33LightingMap.png


BIN
Samples/Scenes/Espilit/TableauxDiffuseMap.png


BIN
Samples/Scenes/Espilit/Tables bonettoLightingMap.png


BIN
Samples/Scenes/Espilit/Tapis.png


BIN
Samples/Scenes/Espilit/Toile.png


+ 0 - 0
Samples/Scenes/Espilit/Tree.png


Некоторые файлы не были показаны из-за большого количества измененных файлов