Browse Source

1.0.10:
- Using typed arrays for Matrix
- Improving IE11 support
- Support for new mesh primitives : Torus and cylinder

David Catuhe 12 years ago
parent
commit
890de0cec1

+ 8 - 3
Babylon/Materials/babylon.standardMaterial.js

@@ -1,6 +1,11 @@
 var BABYLON = BABYLON || {};
 
 (function () {
+
+    var isIE = function() {
+        return window.ActiveXObject !== undefined;
+    };
+    
     BABYLON.StandardMaterial = function (name, scene) {
         this.name = name;
         this.id = name;
@@ -95,7 +100,7 @@
             defines.push("#define SPECULAR");
         }
         
-        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives) {
+        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives && !isIE()) {
             defines.push("#define BUMP");
         }
 
@@ -157,7 +162,7 @@
             
             // IE patch
             var shaderName = "default";
-            if (window.ActiveXObject !== undefined) {
+            if (isIE()) {
                 shaderName = "iedefault";
             }
 
@@ -249,7 +254,7 @@
             this._effect.setMatrix("specularMatrix", this.specularTexture._computeTextureMatrix());
         }
         
-        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives) {
+        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives && !isIE()) {
             this._effect.setTexture("bumpSampler", this.bumpTexture);
 
             this._effect.setVector2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);

+ 181 - 18
Babylon/Mesh/babylon.mesh.js

@@ -82,7 +82,7 @@
     BABYLON.Mesh.prototype.getVertices = function () {
         return this._vertices;
     };
-    
+
     BABYLON.Mesh.prototype.getTotalIndices = function () {
         return this._indices.length;
     };
@@ -125,13 +125,13 @@
 
         return true;
     };
-    
+
     BABYLON.Mesh.prototype.isReady = function () {
         return this._isReady;
     };
 
     BABYLON.Mesh.prototype.isEnabled = function () {
-        if (!this.isReady ()|| !this._isEnabled) {
+        if (!this.isReady() || !this._isEnabled) {
             return false;
         }
 
@@ -234,39 +234,38 @@
         this.subMeshes = [];
         return new BABYLON.SubMesh(0, 0, this._totalVertices, 0, this._indices.length, this);
     };
-    
 
-    BABYLON.Mesh.prototype.subdivide = function(count) {
+
+    BABYLON.Mesh.prototype.subdivide = function (count) {
         if (count < 1) {
             return;
         }
-        
+
         var subdivisionSize = this._indices.length / count;
         var offset = 0;
-        
+
         this.subMeshes = [];
-        for (var index = 0; index < count; index++)
-        {
+        for (var index = 0; index < count; index++) {
             BABYLON.SubMesh.CreateFromIndices(0, offset, Math.min(subdivisionSize, this._indices.length - offset), this);
 
             offset += subdivisionSize;
         }
     };
-    
+
     BABYLON.Mesh.prototype.setVertices = function (vertices, uvCount, updatable) {
         if (this._vertexBuffer) {
             this._scene.getEngine()._releaseBuffer(this._vertexBuffer);
         }
 
         this._uvCount = uvCount;
-        
+
         if (updatable) {
             this._vertexBuffer = this._scene.getEngine().createDynamicVertexBuffer(vertices.length * 4);
             this._scene.getEngine().updateDynamicVertexBuffer(this._vertexBuffer, vertices);
         } else {
             this._vertexBuffer = this._scene.getEngine().createVertexBuffer(vertices);
         }
-        
+
         this._vertices = vertices;
 
         this._totalVertices = vertices.length / this.getFloatVertexStrideSize();
@@ -277,7 +276,7 @@
         this._positions = null;
     };
 
-    BABYLON.Mesh.prototype.updateVertices = function(vertices) {
+    BABYLON.Mesh.prototype.updateVertices = function (vertices) {
         var engine = this._scene.getEngine();
         engine.updateDynamicVertexBuffer(this._vertexBuffer, vertices);
         this._vertices = vertices;
@@ -723,6 +722,170 @@
         return sphere;
     };
 
+    // Cylinder (Code from SharpDX.org)
+    BABYLON.Mesh.CreateCylinder = function (name, height, diameter, tessellation, scene, updatable) {
+        var radius = diameter / 2;
+        var indices = [];
+        var vertices = [];
+        var cylinder = new BABYLON.Mesh(name, [3, 3, 2], scene);
+
+
+        var getCircleVector = function (i) {
+            var angle = (i * 2.0 * Math.PI / tessellation);
+            var dx = Math.sin(angle);
+            var dz = Math.cos(angle);
+
+            return new BABYLON.Vector3(dx, 0, dz);
+        };
+
+        var createCylinderCap = function (isTop) {
+            // Create cap indices.
+            for (var i = 0; i < tessellation - 2; i++) {
+                var i1 = (i + 1) % tessellation;
+                var i2 = (i + 2) % tessellation;
+
+                if (isTop) {
+                    var tmp = i1;
+                    var i1 = i2;
+                    i2 = tmp;
+                }
+
+                var vbase = vertices.length / cylinder.getFloatVertexStrideSize();
+                indices.push(vbase);
+                indices.push(vbase + i1);
+                indices.push(vbase + i2);
+            }
+
+
+            // Which end of the cylinder is this?
+            var normal = new BABYLON.Vector3(0, 1, 0);
+            var textureScale = new BABYLON.Vector2(-0.5, -0.5);
+
+            if (!isTop) {
+                normal = normal.scale(-1);
+                textureScale.x = -textureScale.x;
+            }
+
+            // Create cap vertices.
+            for (var i = 0; i < tessellation; i++) {
+                var circleVector = getCircleVector(i);
+                var position = circleVector.scale(radius).add(normal.scale(height));
+                var textureCoordinate = new BABYLON.Vector2(circleVector.x * textureScale.x + 0.5, circleVector.z * textureScale.y + 0.5);
+
+                vertices.push(
+                    position.x, position.y, position.z,
+                    normal.x, normal.y, normal.z,
+                    textureCoordinate.x, textureCoordinate.y
+                );
+            }
+        };
+
+        height /= 2;
+
+        var topOffset = new BABYLON.Vector3(0, 1, 0).scale(height);
+
+        var stride = tessellation + 1;
+
+        // Create a ring of triangles around the outside of the cylinder.
+        for (var i = 0; i <= tessellation; i++)
+        {
+            var normal = getCircleVector(i);
+            var sideOffset = normal.scale(radius);
+            var textureCoordinate = new BABYLON.Vector2(i / tessellation, 0);
+
+            var position = sideOffset.add(topOffset);
+            vertices.push(
+                            position.x, position.y, position.z,
+                            normal.x, normal.y, normal.z,
+                            textureCoordinate.x, textureCoordinate.y
+                        );
+
+            position = sideOffset.subtract(topOffset);
+            textureCoordinate.y += 1;
+            vertices.push(
+                            position.x, position.y, position.z,
+                            normal.x, normal.y, normal.z,
+                            textureCoordinate.x, textureCoordinate.y
+                        );
+
+            indices.push(i * 2);
+            indices.push((i * 2 + 2) % (stride * 2));
+            indices.push(i * 2 + 1);
+
+            indices.push(i * 2 + 1);
+            indices.push((i * 2 + 2) % (stride * 2));
+            indices.push((i * 2 + 3) % (stride * 2));
+        }
+
+        // Create flat triangle fan caps to seal the top and bottom.
+        createCylinderCap(true);
+        createCylinderCap(false);
+        
+        cylinder.setVertices(vertices, 1, updatable);
+        cylinder.setIndices(indices);
+
+        return cylinder;
+    };
+
+    // Torus  (Code from SharpDX.org)
+    BABYLON.Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable) {
+        var torus = new BABYLON.Mesh(name, [3, 3, 2], scene);
+
+        var indices = [];
+        var vertices = [];
+
+        var stride = tessellation + 1;
+
+        for (var i = 0; i <= tessellation; i++) {
+            var u = i / tessellation;
+
+            var outerAngle = i * Math.PI * 2.0 / tessellation - Math.PI / 2.0;
+
+            var transform = BABYLON.Matrix.Translation(diameter / 2.0, 0, 0).multiply(BABYLON.Matrix.RotationY(outerAngle));
+
+            for (var j = 0; j <= tessellation; j++) {
+                var v = 1 - j / tessellation;
+
+                var innerAngle = j * Math.PI * 2.0 / tessellation + Math.PI;
+                var dx = Math.cos(innerAngle);
+                var dy = Math.sin(innerAngle);
+
+                // Create a vertex.
+                var normal = new BABYLON.Vector3(dx, dy, 0);
+                var position = normal.scale(thickness / 2);
+                var textureCoordinate = new BABYLON.Vector2(u, v);
+
+                position = BABYLON.Vector3.TransformCoordinates(position, transform);
+                normal = BABYLON.Vector3.TransformNormal(normal, transform);
+
+                vertices.push(
+                    position.x, position.y, position.z,
+                    normal.x, normal.y, normal.z,
+                    textureCoordinate.x, textureCoordinate.y
+                );
+
+                // And create indices for two triangles.
+                var nextI = (i + 1) % stride;
+                var nextJ = (j + 1) % stride;
+
+                indices.push(i * stride + j);
+                indices.push(i * stride + nextJ);
+                indices.push(nextI * stride + j);
+
+
+                indices.push(i * stride + nextJ);
+                indices.push(nextI * stride + nextJ);
+                indices.push(nextI * stride + j);
+            }
+        }
+
+        torus.setVertices(vertices, 1, updatable);
+        torus.setIndices(indices);
+
+        return torus;
+    };
+
+
     // Plane
     BABYLON.Mesh.CreatePlane = function (name, size, scene, updatable) {
         var plane = new BABYLON.Mesh(name, [3, 3, 2], scene);
@@ -752,7 +915,7 @@
         return plane;
     };
 
-    BABYLON.Mesh.CreateGround = function(name, width, height, subdivisions, scene, updatable) {
+    BABYLON.Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {
         var ground = new BABYLON.Mesh(name, [3, 3, 2], scene);
 
         var indices = [];
@@ -788,11 +951,11 @@
         return ground;
     };
 
-    BABYLON.Mesh.CreateGroundFromHeightMap = function(name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable) {
+    BABYLON.Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable) {
         var ground = new BABYLON.Mesh(name, [3, 3, 2], scene);
 
         var img = new Image();
-        img.onload = function() {
+        img.onload = function () {
             var indices = [];
             var vertices = [];
             var row, col;
@@ -863,9 +1026,9 @@
 
         return ground;
     };
-    
+
     // Tools
-    BABYLON.Mesh.ComputeNormal = function(vertices, indices, stride, normalOffset) {
+    BABYLON.Mesh.ComputeNormal = function (vertices, indices, stride, normalOffset) {
         var positions = [];
         var facesOfVertices = [];
         var index;

+ 34 - 35
Babylon/Shaders/default.fragment.fx

@@ -11,6 +11,11 @@ uniform vec4 vDiffuseColor;
 uniform vec4 vSpecularColor;
 uniform vec3 vEmissiveColor;
 
+
+// Input
+varying vec3 vPositionW;
+varying vec3 vNormalW;
+
 // Lights
 #ifdef LIGHT0
 uniform vec4 vLightData0;
@@ -98,16 +103,41 @@ uniform vec2 vSpecularInfos;
 uniform sampler2D specularSampler;
 #endif
 
+// Bump
 #ifdef BUMP
 #extension GL_OES_standard_derivatives : enable
 varying vec2 vBumpUV;
 uniform vec2 vBumpInfos;
 uniform sampler2D bumpSampler;
-#endif
 
-// Input
-varying vec3 vPositionW;
-varying vec3 vNormalW;
+// Thanks to http://www.thetenthplanet.de/archives/1180
+mat3 cotangent_frame(vec3 normal, vec3 p, vec2 uv)
+{
+	// get edge vectors of the pixel triangle
+	vec3 dp1 = dFdx(p);
+	vec3 dp2 = dFdy(p);
+	vec2 duv1 = dFdx(uv);
+	vec2 duv2 = dFdy(uv);
+
+	// solve the linear system
+	vec3 dp2perp = cross(dp2, normal);
+	vec3 dp1perp = cross(normal, dp1);
+	vec3 tangent = dp2perp * duv1.x + dp1perp * duv2.x;
+	vec3 binormal = dp2perp * duv1.y + dp1perp * duv2.y;
+
+	// construct a scale-invariant frame 
+	float invmax = inversesqrt(max(dot(tangent, tangent), dot(binormal, binormal)));
+	return mat3(tangent * invmax, binormal * invmax, normal);
+}
+
+vec3 perturbNormal(vec3 viewDir)
+{
+	vec3 map = texture2D(bumpSampler, vBumpUV).xyz * vBumpInfos.y;
+	map = map * 255. / 127. - 128. / 127.;
+	mat3 TBN = cotangent_frame(vNormalW, -viewDir, vBumpUV);
+	return normalize(TBN * map);
+}
+#endif
 
 #ifdef CLIPPLANE
 varying float fClipDistance;
@@ -150,37 +180,6 @@ float CalcFogFactor()
 }
 #endif
 
-#ifdef BUMP
-// Bump
-// Thanks to http://www.thetenthplanet.de/archives/1180
-mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)
-{
-	// get edge vectors of the pixel triangle
-	vec3 dp1 = dFdx(p);
-	vec3 dp2 = dFdy(p);
-	vec2 duv1 = dFdx(uv);
-	vec2 duv2 = dFdy(uv);
-
-	// solve the linear system
-	vec3 dp2perp = cross(dp2, N);
-	vec3 dp1perp = cross(N, dp1);
-	vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
-	vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
-
-	// construct a scale-invariant frame 
-	float invmax = inversesqrt(max(dot(T, T), dot(B, B)));
-	return mat3(T * invmax, B * invmax, N);
-}
-
-vec3 perturbNormal(vec3 viewDir)
-{
-	vec3 map = texture2D(bumpSampler, vBumpUV).xyz * vBumpInfos.y;
-	map = map * 255. / 127. - 128. / 127.;
-	mat3 TBN = cotangent_frame(vNormalW, -viewDir, vBumpUV);
-	return normalize(TBN * map);
-}
-#endif
-
 // Light Computing
 struct lightingInfo
 {

+ 60 - 46
Babylon/Shaders/iedefault.fragment.fx

@@ -18,11 +18,17 @@ uniform vec3 vLightDiffuse0;
 uniform vec3 vLightSpecular0;
 #endif
 
-#ifdef LIGHT1
-uniform vec4 vLightData1;
-uniform vec3 vLightDiffuse1;
-uniform vec3 vLightSpecular1;
-#endif
+//#ifdef LIGHT1
+//uniform vec4 vLightData1;
+//uniform vec3 vLightDiffuse1;
+//uniform vec3 vLightSpecular1;
+//#endif
+
+//#ifdef LIGHT2
+//uniform vec4 vLightData2;
+//uniform vec3 vLightDiffuse2;
+//uniform vec3 vLightSpecular2;
+//#endif
 
 // Samplers
 #ifdef DIFFUSE
@@ -108,6 +114,42 @@ float CalcFogFactor()
 
 #endif
 
+vec3 computeDiffuseLighting(vec3 vNormal, vec4 lightData, vec3 diffuseColor) {
+	vec3 lightVectorW;
+	if (lightData.w == 0.)
+	{
+		lightVectorW = normalize(lightData.xyz - vPositionW);
+	}
+	else
+	{
+		lightVectorW = normalize(-lightData.xyz);
+	}
+
+	// diffuse
+	float ndl = max(0., dot(vNormal, lightVectorW));
+
+	return ndl * diffuseColor;
+}
+
+vec3 computeSpecularLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightData, vec3 specularColor) {
+	vec3 lightVectorW;
+	if (lightData.w == 0.)
+	{
+		lightVectorW = normalize(lightData.xyz - vPositionW);
+	}
+	else
+	{
+		lightVectorW = normalize(-lightData.xyz);
+	}
+
+	// Specular
+	vec3 angleW = normalize(viewDirectionW + lightVectorW);
+	float specComp = max(0., dot(vNormal, angleW));
+	specComp = pow(specComp, vSpecularColor.a);
+
+	return specComp * specularColor;
+}
+
 void main(void) {
 	// Clip plane
 #ifdef CLIPPLANE
@@ -132,6 +174,9 @@ void main(void) {
 	baseColor.rgb *= vDiffuseInfos.y;
 #endif
 
+	// Bump
+	vec3 normalW = vNormalW;
+
 	// Ambient color
 	vec3 baseAmbientColor = vec3(1., 1., 1.);
 
@@ -144,48 +189,17 @@ void main(void) {
 	vec3 specularBase = vec3(0., 0., 0.);
 
 #ifdef LIGHT0
-	vec3 lightVectorW;
-	if (vLightData0.w == 0.)
-	{
-		lightVectorW = normalize(vLightData0.xyz - vPositionW);
-	}
-	else 
-	{
-		lightVectorW = normalize(-vLightData0.xyz);
-	}
-
-	// diffuse
-	float ndl = max(0., dot(vNormalW, lightVectorW));
-
-	// Specular
-	vec3 angleW = normalize(viewDirectionW + lightVectorW);
-	float specComp = max(0., dot(vNormalW, angleW));
-	specComp = pow(specComp, vSpecularColor.a);
-
-	diffuseBase += ndl * vLightDiffuse0;
-	specularBase += specComp * vLightSpecular0;
-#endif
-#ifdef LIGHT1
-	if (vLightData1.w == 0.)
-	{
-		lightVectorW = normalize(vLightData1.xyz - vPositionW);
-	}
-	else
-	{
-		lightVectorW = normalize(-vLightData1.xyz);
-	}
-
-	// diffuse
-	ndl = max(0., dot(vNormalW, lightVectorW));
-
-	// Specular
-	angleW = normalize(viewDirectionW + lightVectorW);
-	specComp = max(0., dot(vNormalW, angleW));
-	specComp = pow(specComp, vSpecularColor.a);
-
-	diffuseBase += ndl * vLightDiffuse1;
-	specularBase += specComp * vLightSpecular1;
+	diffuseBase += computeDiffuseLighting(normalW, vLightData0, vLightDiffuse0);
+	specularBase += computeSpecularLighting(viewDirectionW, normalW, vLightData0, vLightSpecular0);
 #endif
+//#ifdef LIGHT1
+//	diffuseBase += computeDiffuseLighting(normalW, vLightData1, vLightDiffuse1);
+//	specularBase += computeSpecularLighting(viewDirectionW, normalW, vLightData1, vLightSpecular1);
+//#endif
+//#ifdef LIGHT2
+//	diffuseBase += computeDiffuseLighting(normalW, vLightData2, vLightDiffuse2);
+//	specularBase += computeSpecularLighting(viewDirectionW, normalW, vLightData2, vLightSpecular2);
+//#endif
 
 
 	// Reflection

+ 5 - 1
Babylon/Tools/babylon.math.js

@@ -719,9 +719,13 @@
     };
 
     ////////////////////////////////// Matrix //////////////////////////////////
+    
+    if(!MatrixType) {
+        var MatrixType = (typeof Float32Array !== 'undefined') ? Float32Array : Array;
+    }
 
     BABYLON.Matrix = function () {
-        this.m = new Array(16);
+        this.m = new MatrixType(16);
     };
 
     // Properties

+ 1 - 1
Samples/Scenes/Customs/heightMap_test.js

@@ -16,7 +16,7 @@
     skybox.material = skyboxMaterial;
     
     // Ground
-    var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "Scenes/Customs/heightMap.png", 100, 100, 100, 0, 10, scene, true);
+    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);
     groundMaterial.diffuseTexture.uScale = 6;

+ 17 - 15
Samples/Scenes/Customs/test.js

@@ -3,12 +3,13 @@
     //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 material = new BABYLON.StandardMaterial("leaves", scene);
     var material2 = new BABYLON.StandardMaterial("kosh transparent", scene);
+    var material3 = new BABYLON.StandardMaterial("kosh", 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 cylinder = BABYLON.Mesh.CreateCylinder("Cylinder", 2, 0.8, 16, scene);
+    var torus = BABYLON.Mesh.CreateTorus("Torus", 1.0, 0.5, 16, scene);
     var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
     var plane = BABYLON.Mesh.CreatePlane("plane", 3, scene);
 
@@ -19,6 +20,7 @@
     material2.diffuseTexture = new BABYLON.Texture("Assets/kosh.jpg", scene);
     material2.alpha = 0.5;
     material2.backFaceCulling = false;
+    material3.diffuseTexture = new BABYLON.Texture("Assets/kosh.jpg", scene);
     planeMaterial.backFaceCulling = false;
     var planeTexture = new BABYLON.DynamicTexture("dynamic texture", 512, scene, true);
     planeTexture.hasAlpha = true;
@@ -26,13 +28,13 @@
     plane.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL;
 
     box.material = material;
-    box2.material = material;
-    box3.material = material2;
+    cylinder.material = material3;
+    torus.material = material2;
     sphere.material = material;
     plane.material = planeMaterial;
-    box2.position.x += 13;
-    box3.position.x -= 3;
-    box3.parent = sphere;
+    cylinder.position.x += 13;
+    torus.position.x -= 3;
+    torus.parent = sphere;
     sphere.position.z = 3;
     plane.position = new BABYLON.Vector3(0, 7, 0);
 
@@ -45,7 +47,7 @@
     particleSystem.maxSize = 1.0;
     particleSystem.minLifeTime = 0.5;
     particleSystem.maxLifeTime = 1.0;
-    particleSystem.emitter = box3;
+    particleSystem.emitter = torus;
     particleSystem.emitRate = 300;
     particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE;
     particleSystem.minEmitBox = new BABYLON.Vector3(0, 0.1, 0);
@@ -60,7 +62,7 @@
     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.renderList = [box, cylinder, torus, sphere];
     mirror.material.reflectionTexture.level = 0.5;
     mirror.position = new BABYLON.Vector3(0, -5.0, 0);
     
@@ -129,10 +131,10 @@
     var count = 0;
     scene.registerBeforeRender(function () {
         box.rotation.y += 0.01;
-        box2.rotation.x += 0.01;
+        cylinder.rotation.x += 0.01;
         sphere.rotation.y += 0.02;
         //  box3.scaling.y = 1 + Math.cos(alpha);
-        box3.rotation.z += 0.01;
+        torus.rotation.z += 0.01;
         alpha += 0.01;
 
         if (spaceDek) {
@@ -147,12 +149,12 @@
             spaceDek3.rotation.y -= 0.01;
         }
         
-        if (box3.intersectsMesh(box)) {
+        if (torus.intersectsMesh(box)) {
             material2.alpha = 1;
-            box3.scaling = new BABYLON.Vector3(2, 2, 2);
+            torus.scaling = new BABYLON.Vector3(2, 2, 2);
         } else {
             material2.alpha = 0.5;
-            box3.scaling = new BABYLON.Vector3(1, 1, 1);
+            torus.scaling = new BABYLON.Vector3(1, 1, 1);
         }
 
         // Sprites

File diff suppressed because it is too large
+ 3 - 3
Samples/Scenes/WorldMonger/babylon.js


+ 35 - 5
Samples/Scenes/WorldMonger/index.css

@@ -11,10 +11,40 @@ a {
     color: white;
 }
 
-a:visited {
+    a:visited {
+        color: white;
+    }
+
+.hidden {
+    display: none;
+}
+
+#warning {
+    text-align: center;
+    color: white;
+    opacity: 0.8;
+    font-size: 12px;
+    position: absolute;
+    width: 100%;
+    bottom: 60px;
+    cursor: default;
+}
+
+#notSupported {
+    text-align: center;
     color: white;
+    opacity: 0.8;
+    background-color: #0077DB;
+    font-size: 40px;
+    padding-top: 20%;
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    z-index: 1000;
+    cursor: default;
 }
 
+
 #renderCanvas {
     position: absolute;
     width: 100%;
@@ -40,10 +70,10 @@ a:visited {
     -webkit-transform: translateX(400px);
 }
 
-.help.shown {
-    transform: translateX(0px);
-    -webkit-transform: translateX(0px);
-}
+    .help.shown {
+        transform: translateX(0px);
+        -webkit-transform: translateX(0px);
+    }
 
 .helpText {
     cursor: default;

+ 6 - 0
Samples/Scenes/WorldMonger/index.html

@@ -54,5 +54,11 @@
     <audio autoplay loop>
         <source src="Assets/WorldMongerTheme.mp3" type="audio/mpeg">
     </audio>
+    <div id="notSupported" class="hidden">
+        Your browser does not support WebGL :(
+    </div>
+    <div id="warning">
+        * Warning: <i>IE11 WebGL</i> support is still in <b>preview stage</b> and some rendering may be incorrect *<br />
+    </div>
 </body>
 </html>

+ 5 - 0
Samples/Scenes/WorldMonger/index.js

@@ -2,6 +2,11 @@
     var canvas = document.getElementById("renderCanvas");
     var divFps = document.getElementById("fps");
     var mode = "CAMERA";
+    
+    if (!BABYLON.Engine.isSupported()) {
+        document.getElementById("notSupported").className = "";
+        return;
+    }
 
     // Babylon
     BABYLON.Engine.ShadersRepository = "";

File diff suppressed because it is too large
+ 3 - 3
Samples/babylon.js


+ 3 - 3
Samples/index.js

@@ -4,7 +4,7 @@
     // Demos
     var demos = [
         { title: "WORLDMONGER", url: "Scenes/Worldmonger/index.html", screenshot: "worldmonger.jpg", size: "8.5 MB", big: true },
-        { title: "HEART", scene: "heart", screenshot: "heart.jpg", size: "14 MB", },
+        { title: "HEART", scene: "Heart", screenshot: "heart.jpg", size: "14 MB", },
         { title: "ESPILIT", scene: "Espilit", screenshot: "espilit.jpg", size: "50 MB" },
         { title: "WINDOWS CAFE", scene: "WCafe", screenshot: "wcafe.jpg", size: "28 MB" },
         {
@@ -17,9 +17,9 @@
                 ecran.material.diffuseTexture = new BABYLON.VideoTexture("video", ["Scenes/Flat2009/babylonjs.mp4", "Scenes/Flat2009/babylonjs.webm"], 256, scene, true);
             }
         },
-        { title: "THE CAR", scene: "theCar", screenshot: "thecar.jpg", size: "100 MB" },
+        { title: "THE CAR", scene: "TheCar", screenshot: "thecar.jpg", size: "100 MB" },
         { title: "VIPER", scene: "Viper", screenshot: "viper.jpg", size: "18 MB" },
-        { title: "SPACESHIP", scene: "spaceship", screenshot: "spaceship.jpg", size: "1 MB" },
+        { title: "SPACESHIP", scene: "Spaceship", screenshot: "spaceship.jpg", size: "1 MB" },
         {
             title: "OMEGA CRUSHER", scene: "SpaceDek", screenshot: "omegacrusher.jpg", size: "10 MB", onload: function () {
                 scene.collisionsEnabled = false;

File diff suppressed because it is too large
+ 11 - 0
babylon.1.0.10.js


File diff suppressed because it is too large
+ 0 - 11
babylon.1.0.9.js


+ 4 - 0
what's new.txt

@@ -1,3 +1,7 @@
+1.0.10:
+ - Using typed arrays for Matrix
+ - Improving IE11 support
+ - Support for new mesh primitives : Torus and cylinder
 1.0.9:
  - Orthographic camera
 1.0.8: